Refactor Lexer and Input classes and fix negative numbers in JSON parser.