Example #1
0
        public Value ParseRValue(MingeTokenizer tk)
        {
            Value value = null;

            Token tok = NextNonWhiteSpaceToken (tk);
            switch (tok.Type) {
            case TokenType.TOKEN_NAME:
                value = new VariableValue (new NamedTarget (tok.Value));
                break;
            case TokenType.TOKEN_QUOTED_STRING:
                value = new ConstantStringValue (ValueOfQuotedString (tok.Value));
                break;
            case TokenType.TOKEN_DOUBLE:
                value = new ConstantDoubleValue ((double) tok.TokenizedValue);
                break;
            case TokenType.TOKEN_INTEGER:
                value = new ConstantIntValue ((int) tok.TokenizedValue);
                break;
            default:
                RaiseFailure (tk, String.Format ("Unexpected token '{0}', in rvalue", tok.Value));
                break;
            }

            return value;
        }
Example #2
0
        public ConstantValue ParseConstantValue(MingeTokenizer tk)
        {
            ConstantValue value = null;

            Token tok = NextNonWhiteSpaceToken (tk);
            switch (tok.Type) {
            case TokenType.TOKEN_QUOTED_STRING:
                value = new ConstantStringValue (ValueOfQuotedString (tok.Value));
                break;
            default:
                RaiseFailure (tk, String.Format ("Unexpected token '{0}', in constant value", tok.Value));
                break;
            }

            return value;
        }