private void Consume(int tokenType) { if(_currentToken.Type == tokenType) { _currentToken = _lexer.GetNextToken(); } else { //Need to implement GetName method on token types and consider an enum throw new InvalidOperationException($"Unexpected token while parsing json expected: {tokenType}, Actual: {_currentToken.Type}"); } }
public JsonParser(JsonLexer lexer) { _lexer = lexer; _currentToken = lexer.GetNextToken(); }