corrected final version of lexer