Esempio n. 1
0
 private JsonNode ParseNumber()
 {
     if (lexer.GetCurrentTokenType() != TokenType.Number)
         throw CreateExpectedException(lexer.GetCurrentToken(), TokenType.Number);
     JsonNode result = new JsonNode(NodeType.Integer);
     result.Assign(Convert.ToInt64(lexer.GetCurrentToken().Value));
     lexer.NextToken();
     return result;
 }
Esempio n. 2
0
 private JsonNode ParseString()
 {
     if (lexer.GetCurrentTokenType() != TokenType.String)
         throw CreateExpectedException(lexer.GetCurrentToken(), TokenType.String);
     JsonNode result = new JsonNode(NodeType.String);
     result.Assign(lexer.GetCurrentToken().Value);
     lexer.NextToken();
     return result;
 }
Esempio n. 3
0
 private JsonNode ParseLiteral()
 {
     if (lexer.GetCurrentTokenType() != TokenType.Literal)
         throw CreateExpectedException(lexer.GetCurrentToken(), TokenType.Literal);
     string value = lexer.GetCurrentToken().Value;
     JsonNode result;
     if (value == Consts.NoneLiteral)
         result = new JsonNode(NodeType.None);
     else
     {
         result = new JsonNode(NodeType.Boolean);
         result.Assign(value == Consts.TrueLiteral);
     }
     lexer.NextToken();
     return result;
 }