Commit 96d20898 authored by di68kap's avatar di68kap

- DHParser/parse.py ParserError Better string representation

parent 33f3e221
......@@ -117,6 +117,9 @@ class ParserError(Exception):
self.rest = rest # type: StringView
self.first_throw = first_throw # type: bool
def __str__(self):
return "%i: %s %s" % (self.node.pos, self.rest[:25], repr(self.node))
ResumeList = List[Union[str, Any]] # list of strings or regular expressiones
......
......@@ -146,7 +146,8 @@ def recompile_grammar(grammar_src, force):
testing.create_test_templates(grammar_src, grammar_tests_dir)
with DHParser.log.logging(LOGGING):
# recompiles Grammar only if it has changed
if not dsl.recompile_grammar(grammar_src, force=force):
if not dsl.recompile_grammar(grammar_src, force=force,
notify=lambda: print('recompiling ' + grammar_src)):
print('\nErrors while recompiling "%s":' % grammar_src +
'\n--------------------------------------\n\n')
with open('{name}_ebnf_ERRORS.txt') as f:
......
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