def __init__(self):
super(GenericIntegerLexer, self).__init__()
self.tokens = (
'NUMBER',
'PLUS',
'MINUS',
'TIMES',
'DIVIDE',
'POWER',
'LPAREN',
'RPAREN',
'SCALAR',
)
self.t_NUMBER = r'\d+'
self.t_PLUS = r'\+'
self.t_MINUS = r'-'
self.t_TIMES = r'\*'
self.t_DIVIDE = r'/'
self.t_POWER = r'\^'
self.t_LPAREN = r'\('
self.t_RPAREN = r'\)'
self.t_ignore = " \t"
self.lexer = lex.lex(object=self)
评论列表
文章目录