Esempio n. 1
0
    public IntegerContext integer()
    {
        IntegerContext _localctx = new IntegerContext(Context, State);

        EnterRule(_localctx, 4, RULE_integer);
        try {
            State = 56;
            switch (TokenStream.La(1))
            {
            case INT:
                EnterOuterAlt(_localctx, 1);
                {
                    State           = 47; _localctx._INT = Match(INT);
                    _localctx.value = PumpingLemma.LinearIntegerExpression.Constant((_localctx._INT != null?int.Parse(_localctx._INT.Text):0));
                }
                break;

            case IDENT:
                EnterOuterAlt(_localctx, 2);
                {
                    State           = 49; Match(IDENT);
                    _localctx.value = PumpingLemma.LinearIntegerExpression.Variable(TokenStream.GetText(_localctx.Start, TokenStream.Lt(-1)));
                }
                break;

            case LPAREN:
                EnterOuterAlt(_localctx, 3);
                {
                    State           = 51; Match(LPAREN);
                    State           = 52; _localctx.a = terms();
                    State           = 53; Match(RPAREN);
                    _localctx.value = _localctx.a.value;
                }
                break;

            default:
                throw new NoViableAltException(this);
            }
        }
        catch (RecognitionException re) {
            _localctx.exception = re;
            ErrorHandler.ReportError(this, re);
            ErrorHandler.Recover(this, re);
        }
        finally {
            ExitRule();
        }
        return(_localctx);
    }
Esempio n. 2
0
	public IntegerContext integer() {
		IntegerContext _localctx = new IntegerContext(Context, State);
		EnterRule(_localctx, 166, RULE_integer);
		int _la;
		try {
			EnterOuterAlt(_localctx, 1);
			{
			State = 1053;
			_la = TokenStream.La(1);
			if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << DECIMAL_INTEGER) | (1L << OCT_INTEGER) | (1L << HEX_INTEGER) | (1L << BIN_INTEGER))) != 0)) ) {
			ErrorHandler.RecoverInline(this);
			}
			else {
			    Consume();
			}
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			ErrorHandler.ReportError(this, re);
			ErrorHandler.Recover(this, re);
		}
		finally {
			ExitRule();
		}
		return _localctx;
	}
	public IntegerContext integer() {
		IntegerContext _localctx = new IntegerContext(Context, State);
		EnterRule(_localctx, 4, RULE_integer);
		try {
			State = 56;
			switch (TokenStream.La(1)) {
			case INT:
				EnterOuterAlt(_localctx, 1);
				{
				State = 47; _localctx._INT = Match(INT);
				 _localctx.value =  PumpingLemma.LinearIntegerExpression.Constant((_localctx._INT!=null?int.Parse(_localctx._INT.Text):0)); 
				}
				break;
			case IDENT:
				EnterOuterAlt(_localctx, 2);
				{
				State = 49; Match(IDENT);
				 _localctx.value =  PumpingLemma.LinearIntegerExpression.Variable(TokenStream.GetText(_localctx.Start, TokenStream.Lt(-1))); 
				}
				break;
			case LPAREN:
				EnterOuterAlt(_localctx, 3);
				{
				State = 51; Match(LPAREN);
				State = 52; _localctx.a = terms();
				State = 53; Match(RPAREN);
				 _localctx.value =  _localctx.a.value; 
				}
				break;
			default:
				throw new NoViableAltException(this);
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			ErrorHandler.ReportError(this, re);
			ErrorHandler.Recover(this, re);
		}
		finally {
			ExitRule();
		}
		return _localctx;
	}
	public IntegerContext integer() {
		IntegerContext _localctx = new IntegerContext(Context, State);
		EnterRule(_localctx, 292, RULE_integer);
		int _la;
		try {
			State = 2390;
			switch (TokenStream.La(1)) {
			case MINUS:
				EnterOuterAlt(_localctx, 1);
				{
				State = 2384; Match(MINUS);
				State = 2385; digits();
				}
				break;
			case PLUS:
			case D0:
			case D1:
			case D2:
			case D3:
			case D4:
			case D5:
			case D6:
			case D7:
			case D8:
			case D9:
				EnterOuterAlt(_localctx, 2);
				{
				State = 2387;
				_la = TokenStream.La(1);
				if (_la==PLUS) {
					{
					State = 2386; Match(PLUS);
					}
				}

				State = 2389; digits();
				}
				break;
			default:
				throw new NoViableAltException(this);
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			ErrorHandler.ReportError(this, re);
			ErrorHandler.Recover(this, re);
		}
		finally {
			ExitRule();
		}
		return _localctx;
	}
Esempio n. 5
0
 public override object VisitInteger([NotNull] IntegerContext context) => context.GetText();
Esempio n. 6
0
 private HiddenData Create_HiddenData_from_integer_context(IntegerContext context)
 {
     _expectedId = Reflection.GetPropertyName(() => context.Value).ToCamelCase();
     _expectedName = _expectedId;
     _expectedValue = context.Value.ToString();
     return Hidden.For(context, x => x.Value.ToString(), x => x.Value);
 }