refactoring lexer (simpler
lexer: better encaps