Commit 632a5b76 authored by di68kap's avatar di68kap
Browse files

- faster Regex: instead of text[:end]

parent bff61c50
......@@ -1150,7 +1150,7 @@ class RegExp(Parser):
match = text.match(self.regexp)
if match:
end = text.index(match.end())
return Node(self, text[:end], True), text[end:]
return Node(self,, True), text[end:]
return None, text
def __repr__(self):
......@@ -52,6 +52,8 @@ def fail_on_error(src, result):
def tst_func():
with toolkit.logging(False):
if not os.path.exists('REPORT'):
files = os.listdir('testdata')
for file in files:
......@@ -60,10 +62,10 @@ def tst_func():
doc =
print('\n\nParsing document: "%s"\n' % file)
result = parser(doc)
with open('results/' + file[:-4]+'.cst', 'w', encoding='utf-8') as f:
with open('REPORT/' + file[:-4]+'.cst', 'w', encoding='utf-8') as f:
with open('results/' + file[:-4]+'.ast', 'w', encoding='utf-8') as f:
with open('REPORT/' + file[:-4]+'.ast', 'w', encoding='utf-8') as f:
fail_on_error(doc, result)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment