# PLY (Python Lex-Yacc) def t_SINGLE_CHAR_OPERATOR(t): r'/|\||\+|\-|\*' # Note that * can also be a name t.type = ambig_ops.get(t.value, 'OPERATOR') return t # [python lex yacc]