calc method

CalcContext calc([
  1. int _p = 0
])

Implementation

CalcContext calc([int _p = 0]) {
  final _parentctx = context;
  final _parentState = state;
  dynamic _localctx = CalcContext(context, _parentState);
  var _prevctx = _localctx;
  var _startState = 10;
  enterRecursionRule(_localctx, 10, RULE_calc, _p);
  int _la;
  try {
    int _alt;
    enterOuterAlt(_localctx, 1);
    state = 71;
    unary();
    context!.stop = tokenStream.LT(-1);
    state = 81;
    errorHandler.sync(this);
    _alt = interpreter!.adaptivePredict(tokenStream, 5, context);
    while (_alt != 2 && _alt != ATN.INVALID_ALT_NUMBER) {
      if (_alt == 1) {
        if (parseListeners != null) triggerExitRuleEvent();
        _prevctx = _localctx;
        state = 79;
        errorHandler.sync(this);
        switch (interpreter!.adaptivePredict(tokenStream, 4, context)) {
          case 1:
            _localctx = CalcContext(_parentctx, _parentState);
            pushNewRecursionContext(_localctx, _startState, RULE_calc);
            state = 73;
            if (!(precpred(context, 2))) {
              throw FailedPredicateException(this, "precpred(context, 2)");
            }
            state = 74;
            _localctx.op = tokenStream.LT(1);
            _la = tokenStream.LA(1)!;
            if (!(((_la) & ~0x3f) == 0 &&
                bitwiseAnd(pow(2, _la), 58720256) != 0)) {
              _localctx.op = errorHandler.recoverInline(this);
            } else {
              if (tokenStream.LA(1)! == IntStream.EOF) matchedEOF = true;
              errorHandler.reportMatch(this);
              consume();
            }
            state = 75;
            calc(3);
            break;
          case 2:
            _localctx = CalcContext(_parentctx, _parentState);
            pushNewRecursionContext(_localctx, _startState, RULE_calc);
            state = 76;
            if (!(precpred(context, 1))) {
              throw FailedPredicateException(this, "precpred(context, 1)");
            }
            state = 77;
            _localctx.op = tokenStream.LT(1);
            _la = tokenStream.LA(1)!;
            if (!(_la == TOKEN_MINUS || _la == TOKEN_PLUS)) {
              _localctx.op = errorHandler.recoverInline(this);
            } else {
              if (tokenStream.LA(1)! == IntStream.EOF) matchedEOF = true;
              errorHandler.reportMatch(this);
              consume();
            }
            state = 78;
            calc(2);
            break;
        }
      }
      state = 83;
      errorHandler.sync(this);
      _alt = interpreter!.adaptivePredict(tokenStream, 5, context);
    }
  } on RecognitionException catch (re) {
    _localctx.exception = re;
    errorHandler.reportError(this, re);
    errorHandler.recover(this, re);
  } finally {
    unrollRecursionContexts(_parentctx);
  }
  return _localctx;
}