lex_rule3.py revision 6498
16498Snate@binkert.org# lex_rule3.py 26498Snate@binkert.org# 36498Snate@binkert.org# Rule function with incorrect number of arguments 46498Snate@binkert.org 56498Snate@binkert.orgimport sys 66498Snate@binkert.orgif ".." not in sys.path: sys.path.insert(0,"..") 76498Snate@binkert.org 86498Snate@binkert.orgimport ply.lex as lex 96498Snate@binkert.org 106498Snate@binkert.orgtokens = [ 116498Snate@binkert.org "PLUS", 126498Snate@binkert.org "MINUS", 136498Snate@binkert.org "NUMBER", 146498Snate@binkert.org ] 156498Snate@binkert.org 166498Snate@binkert.orgt_PLUS = r'\+' 176498Snate@binkert.orgt_MINUS = r'-' 186498Snate@binkert.orgdef t_NUMBER(t,s): 196498Snate@binkert.org r'\d+' 206498Snate@binkert.org return t 216498Snate@binkert.org 226498Snate@binkert.orgdef t_error(t): 236498Snate@binkert.org pass 246498Snate@binkert.org 256498Snate@binkert.orglex.lex() 266498Snate@binkert.org 276498Snate@binkert.org 28