예제 #1
0
파일: parser.cs 프로젝트: KevinT/manos
        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;
        }
예제 #2
0
파일: parser.cs 프로젝트: KevinT/manos
        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;
        }