Ejemplo n.º 1
0
 public override Expression VisitIntegerValue(IntegerValueContext context)
 {
     var value = int.Parse(context.GetText());
     return Expression.Constant(value, typeof(int));
 }
Ejemplo n.º 2
0
    public ValueContext value()
    {
        ValueContext _localctx = new ValueContext(Context, State);

        EnterRule(_localctx, 8, RULE_value);
        try {
            State = 52;
            ErrorHandler.Sync(this);
            switch (TokenStream.LA(1))
            {
            case T__0:
                _localctx = new ArrayValueContext(_localctx);
                EnterOuterAlt(_localctx, 1);
                {
                    State = 46; array();
                }
                break;

            case BOOLEAN:
                _localctx = new BooleanValueContext(_localctx);
                EnterOuterAlt(_localctx, 2);
                {
                    State = 47; Match(BOOLEAN);
                }
                break;

            case INTEGER:
                _localctx = new IntegerValueContext(_localctx);
                EnterOuterAlt(_localctx, 3);
                {
                    State = 48; Match(INTEGER);
                }
                break;

            case T__6:
                _localctx = new NullValueContext(_localctx);
                EnterOuterAlt(_localctx, 4);
                {
                    State = 49; Match(T__6);
                }
                break;

            case T__3:
                _localctx = new ObjectValueContext(_localctx);
                EnterOuterAlt(_localctx, 5);
                {
                    State = 50; oBjEcT();
                }
                break;

            case STRING:
                _localctx = new StringValueContext(_localctx);
                EnterOuterAlt(_localctx, 6);
                {
                    State = 51; Match(STRING);
                }
                break;

            default:
                throw new NoViableAltException(this);
            }
        }
        catch (RecognitionException re) {
            _localctx.exception = re;
            ErrorHandler.ReportError(this, re);
            ErrorHandler.Recover(this, re);
        }
        finally {
            ExitRule();
        }
        return(_localctx);
    }