lex_rule1.py revision 2632:1bb2f91485ea
112855Sgabeblack@google.com# lex_token.py 212855Sgabeblack@google.com# 312855Sgabeblack@google.com# Rule defined as some other type 412855Sgabeblack@google.com 512855Sgabeblack@google.comimport lex 612855Sgabeblack@google.com 712855Sgabeblack@google.comtokens = [ 812855Sgabeblack@google.com "PLUS", 912855Sgabeblack@google.com "MINUS", 1012855Sgabeblack@google.com "NUMBER", 1112855Sgabeblack@google.com ] 1212855Sgabeblack@google.com 1312855Sgabeblack@google.comt_PLUS = r'\+' 1412855Sgabeblack@google.comt_MINUS = r'-' 1512855Sgabeblack@google.comt_NUMBER = 1 1612855Sgabeblack@google.com 1712855Sgabeblack@google.comdef t_error(t): 1812855Sgabeblack@google.com pass 1912855Sgabeblack@google.com 2012855Sgabeblack@google.comimport sys 2112855Sgabeblack@google.comsys.tracebacklimit = 0 2212855Sgabeblack@google.com 2312855Sgabeblack@google.comlex.lex() 2412855Sgabeblack@google.com 2512855Sgabeblack@google.com 2612855Sgabeblack@google.com