Changed to state based lexical analysis.