Пример #1
0
 public final FunctionDeclContext functionDecl() throws RecognitionException {
   FunctionDeclContext _localctx = new FunctionDeclContext(_ctx, getState());
   enterRule(_localctx, 6, RULE_functionDecl);
   try {
     enterOuterAlt(_localctx, 1);
     {
       setState(36);
       type();
       setState(37);
       match(ID);
       setState(38);
       match(8);
       setState(39);
       formalParameters();
       setState(40);
       match(2);
       setState(41);
       block();
     }
   } catch (RecognitionException re) {
     _localctx.exception = re;
     _errHandler.reportError(this, re);
     _errHandler.recover(this, re);
   } finally {
     exitRule();
   }
   return _localctx;
 }
Пример #2
0
  public final FunctionDeclContext functionDecl() throws RecognitionException {
    FunctionDeclContext _localctx = new FunctionDeclContext(_ctx, getState());
    enterRule(_localctx, 6, RULE_functionDecl);
    int _la;
    try {
      enterOuterAlt(_localctx, 1);
      {
        setState(36);
        type();
        setState(37);
        match(ID);
        setState(38);
        match(T__2);
        setState(40);
        _la = _input.LA(1);
        if ((((_la) & ~0x3f) == 0
            && ((1L << _la) & ((1L << K_FLOAT) | (1L << K_INT) | (1L << K_VOID))) != 0)) {
          {
            setState(39);
            formalParameters();
          }
        }

        setState(42);
        match(T__3);
        setState(43);
        block();
      }
    } catch (RecognitionException re) {
      _localctx.exception = re;
      _errHandler.reportError(this, re);
      _errHandler.recover(this, re);
    } finally {
      exitRule();
    }
    return _localctx;
  }