Move out Lexer related code.

Making code structure more clear.