made lexer reentrant