16498Snate@binkert.org# lex_token_dup.py 26498Snate@binkert.org# 36498Snate@binkert.org# Duplicate token name in tokens 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 "MINUS" 156498Snate@binkert.org ] 166498Snate@binkert.org 176498Snate@binkert.orgt_PLUS = r'\+' 186498Snate@binkert.orgt_MINUS = r'-' 196498Snate@binkert.org 206498Snate@binkert.orgdef t_NUMBER(t): 216498Snate@binkert.org r'\d+' 226498Snate@binkert.org return t 236498Snate@binkert.org 246498Snate@binkert.orgdef t_error(t): 256498Snate@binkert.org pass 266498Snate@binkert.org 276498Snate@binkert.orglex.lex() 286498Snate@binkert.org 296498Snate@binkert.org 30