예제 #1
0
  public final StatContext stat() throws RecognitionException {
    StatContext _localctx = new StatContext(_ctx, getState());
    enterRule(_localctx, 2, RULE_stat);
    try {
      setState(20);
      switch (getInterpreter().adaptivePredict(_input, 1, _ctx)) {
        case 1:
          enterOuterAlt(_localctx, 1);
          {
            setState(11);
            expr(0);
            setState(12);
            match(NEWLINE);
          }
          break;

        case 2:
          enterOuterAlt(_localctx, 2);
          {
            setState(14);
            match(ID);
            setState(15);
            match(7);
            setState(16);
            expr(0);
            setState(17);
            match(NEWLINE);
          }
          break;

        case 3:
          enterOuterAlt(_localctx, 3);
          {
            setState(19);
            match(NEWLINE);
          }
          break;
      }
    } catch (RecognitionException re) {
      _localctx.exception = re;
      _errHandler.reportError(this, re);
      _errHandler.recover(this, re);
    } finally {
      exitRule();
    }
    return _localctx;
  }
예제 #2
0
  public final StatContext stat() throws RecognitionException {
    StatContext _localctx = new StatContext(_ctx, getState());
    enterRule(_localctx, 14, RULE_stat);
    int _la;
    try {
      setState(88);
      switch (getInterpreter().adaptivePredict(_input, 8, _ctx)) {
        case 1:
          enterOuterAlt(_localctx, 1);
          {
            setState(65);
            block();
          }
          break;
        case 2:
          enterOuterAlt(_localctx, 2);
          {
            setState(66);
            varDecl();
          }
          break;
        case 3:
          enterOuterAlt(_localctx, 3);
          {
            setState(67);
            match(T__7);
            setState(68);
            expr(0);
            setState(69);
            match(T__8);
            setState(70);
            stat();
            setState(73);
            switch (getInterpreter().adaptivePredict(_input, 6, _ctx)) {
              case 1:
                {
                  setState(71);
                  match(T__9);
                  setState(72);
                  stat();
                }
                break;
            }
          }
          break;
        case 4:
          enterOuterAlt(_localctx, 4);
          {
            setState(75);
            match(T__10);
            setState(77);
            _la = _input.LA(1);
            if ((((_la) & ~0x3f) == 0
                && ((1L << _la)
                        & ((1L << T__2) | (1L << T__13) | (1L << T__14) | (1L << ID) | (1L << INT)))
                    != 0)) {
              {
                setState(76);
                expr(0);
              }
            }

            setState(79);
            match(T__1);
          }
          break;
        case 5:
          enterOuterAlt(_localctx, 5);
          {
            setState(80);
            expr(0);
            setState(81);
            match(T__0);
            setState(82);
            expr(0);
            setState(83);
            match(T__1);
          }
          break;
        case 6:
          enterOuterAlt(_localctx, 6);
          {
            setState(85);
            expr(0);
            setState(86);
            match(T__1);
          }
          break;
      }
    } catch (RecognitionException re) {
      _localctx.exception = re;
      _errHandler.reportError(this, re);
      _errHandler.recover(this, re);
    } finally {
      exitRule();
    }
    return _localctx;
  }