Cleanup. Improvements to lexer pattern decorator

This commit is contained in:
David Beazley
2016-09-06 14:38:40 -05:00
parent 36cf652eae
commit 7bfadaaab3
4 changed files with 132 additions and 61 deletions

View File

@@ -86,11 +86,12 @@ class CalcParser(Parser):
if __name__ == '__main__':
lexer = CalcLexer()
parser = CalcParser()
while True:
try:
s = input('calc > ')
text = input('calc > ')
except EOFError:
break
if s:
parser.parse(CalcLexer(s))
if text:
parser.parse(lexer.tokenize(text))