added lexer implementation without regexps