Skip to content

Instantly share code, notes, and snippets.

@uenoku
Created September 16, 2018 13:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uenoku/85c855b93bb4c940a9f210c1c53b061a to your computer and use it in GitHub Desktop.
Save uenoku/85c855b93bb4c940a9f210c1c53b061a to your computer and use it in GitHub Desktop.
softwarefoundationから問題名とかを抽出する奴
import re
coq2 = [
'Maps.v',
'Imp.v',
'Preface.v',
'Equiv.v',
'Hoare.v',
'Hoare2.v',
'HoareAsLogic.v',
'Smallstep.v',
'Types.v',
'Stlc.v',
'StlcProp.v',
'MoreStlc.v',
'Sub.v',
'Typechecking.v',
'Records.v',
'References.v',
'RecordSub.v',
'Norm.v',
'LibTactics.v',
'UseTactics.v',
'UseAuto.v',
'PE.v',
'Postscript.v',
'Bib.v',
]
coq3 = [
'Maps.v',
'Preface.v',
'Perm.v',
'Sort.v',
'Multiset.v',
'Selection.v',
'SearchTree.v',
'ADT.v',
'Extract.v',
'Redblack.v',
'Trie.v',
'Priqueue.v',
'Binom.v',
'Decide.v',
'Color.v',
'MapsTest.v',
'PrefaceTest.v',
'PermTest.v',
'SortTest.v',
'MultisetTest.v',
'SelectionTest.v',
'SearchTreeTest.v',
'ADTTest.v',
'ExtractTest.v',
'RedblackTest.v',
'TrieTest.v',
'PriqueueTest.v',
'BinomTest.v',
'DecideTest.v',
'ColorTest.v',
]
coq4 = [
'Preface.v',
'Introduction.v',
'Typeclasses.v',
'QC.v',
'TImp.v',
'QuickChickTool.v',
'QuickChickInterface.v',
'PostScript.v',
'Bib.v',
]
coq = coq4
star = '[0-9] stars?'
s = re.compile(star)
pname = "\(.*\)"
p = re.compile(pname)
for name in coq:
with open(name, 'r') as f:
lines = f.readlines()
for line in lines:
if '(** **** Exercise' in line or '(** Exercise' in line:
if len(s.findall(line)) > 0:
star = s.findall(line)[0][0]
pname = (p.findall(line[1:-2])[0])[1:-1]
print name + ',' + pname + ',' + star
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment