lexer works correctly first time