Skip to content

Commit

Permalink
lexer fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
victorlei committed Oct 17, 2014
1 parent 3a44a4f commit c765a19
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions smop/lexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,13 +305,16 @@ def t_error(t):

if __name__ == "__main__":
lexer = new()
while 1:
line = raw_input("=>> ")
if not line:
break
while line[-1] == "\\":
line = line[:-1] + raw_input("... ")
print len(line), [c for c in line]
lexer.input(line)
for tok in lexer:
print len(str(tok.value)), tok
try:
while 1:
line = raw_input("=>> ")
if not line:
continue
while line[-1] == "\\":
line = line[:-1] + raw_input("... ")
print len(line), [c for c in line]
lexer.input(line)
for tok in lexer:
print len(str(tok.value)), tok
except EOFError:
pass

0 comments on commit c765a19

Please sign in to comment.