예제 #1
0
        object ParseValue()
        {
            switch (lexer.LookAhead())
            {
            case Lexer.Token.String:
                return(lexer.ParseString());

            case Lexer.Token.Number:
                return(lexer.ParseFloatNumber());

            case Lexer.Token.CurlyOpen:
                return(ParseObject());

            case Lexer.Token.SquaredOpen:
                return(ParseArray());

            case Lexer.Token.True:
                lexer.NextToken();
                return(true);

            case Lexer.Token.False:
                lexer.NextToken();
                return(false);

            case Lexer.Token.Null:
                lexer.NextToken();
                return(null);

            case Lexer.Token.None:
                break;
            }

            TriggerError("Unable to parse value");
            return(null);
        }
예제 #2
0
        private object ParseValue()
        {
            switch (lexer.LookAhead())
            {
            case Lexer.Token.String:
                return(EvalLexer(lexer.ParseString()));

            case Lexer.Token.Number:
                if (parseNumbersAsFloat)
                {
                    return(EvalLexer(lexer.ParseFloatNumber()));
                }
                return(EvalLexer(lexer.ParseDoubleNumber()));

            case Lexer.Token.CurlyOpen:
                return(ParseObject());

            case Lexer.Token.SquaredOpen:
                return(ParseArray());

            case Lexer.Token.True:
                lexer.NextToken();
                return(true);

            case Lexer.Token.False:
                lexer.NextToken();
                return(false);

            case Lexer.Token.Null:
                lexer.NextToken();
                return(null);

            default:
                TriggerError("Unable to parse value");
                return(null);
            }
        }