lean4-htt/script/find_uppers.py
2019-03-21 15:06:45 -07:00

15 lines
451 B
Python
Executable file

#!/usr/bin/env python3
import regex as re
import os
import sys
upper = re.compile(r"^\s*(?:namespace|class|structure|inductive) ((?!inductive)[\w.]+)|(?:def|constant) ([\w.]+).*(: (Type|Prop)$|:= ∀)", re.MULTILINE)
fpath = sys.argv[1]
with open(fpath) as f:
s = f.read()
for m in upper.findall(s):
for n in m:
if n not in ('and', 'or'):
for part in n.split('.'):
if part:
print(part)