lex: states must be defined as a tuple or list. Traceback (most recent call last): File "./lex_state1.py", line 38, in lex.lex() File "../ply/lex.py", line 759, in lex raise SyntaxError,"lex: Unable to build lexer." SyntaxError: lex: Unable to build lexer.