示例#1
0
 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}");
     }
 }
示例#2
0
 public JsonParser(JsonLexer lexer)
 {
     _lexer = lexer;
     _currentToken = lexer.GetNextToken();
 }