in packages/dmn-feel-antlr4-parser/src/parser/grammar/generated-parser/FEEL_1_1Parser.ts [2409:2523]
public unaryExpression(_p?: number): UnaryExpressionContext {
if (_p === undefined) {
_p = 0;
}
const _parentctx: ParserRuleContext = this._ctx;
const _parentState: number = this.state;
let localctx: UnaryExpressionContext = new UnaryExpressionContext(this, this._ctx, _parentState);
let _prevctx: UnaryExpressionContext = localctx;
const _startState: number = 72;
this.enterRecursionRule(localctx, 72, FEEL_1_1Parser.RULE_unaryExpression, _p);
try {
let _alt: number;
this.enterOuterAlt(localctx, 1);
{
this.state = 471;
this._errHandler.sync(this);
switch (this._input.LA(1)) {
case 44:
{
localctx = new SignedUnaryExpressionMinusContext(this, localctx);
this._ctx = localctx;
_prevctx = localctx;
this.state = 466;
this.match(FEEL_1_1Parser.SUB);
this.state = 467;
this.unaryExpression(3);
}
break;
case 1:
case 2:
case 5:
case 8:
case 9:
case 18:
case 22:
case 23:
case 24:
case 25:
case 27:
case 29:
case 30:
case 34:
case 35:
case 36:
case 37:
case 38:
case 39:
case 48:
case 49:
case 50:
{
localctx = new NonSignedUnaryExpressionContext(this, localctx);
this._ctx = localctx;
_prevctx = localctx;
this.state = 468;
this.unaryExpressionNotPlusMinus();
}
break;
case 43:
{
localctx = new SignedUnaryExpressionPlusContext(this, localctx);
this._ctx = localctx;
_prevctx = localctx;
this.state = 469;
this.match(FEEL_1_1Parser.ADD);
this.state = 470;
this.unaryExpressionNotPlusMinus();
}
break;
default:
throw new NoViableAltException(this);
}
this._ctx.stop = this._input.LT(-1);
this.state = 477;
this._errHandler.sync(this);
_alt = this._interp.adaptivePredict(this._input, 36, this._ctx);
while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) {
if (_alt === 1) {
if (this._parseListeners != null) {
this.triggerExitRuleEvent();
}
_prevctx = localctx;
{
{
localctx = new FnInvocationContext(this, new UnaryExpressionContext(this, _parentctx, _parentState));
this.pushNewRecursionContext(localctx, _startState, FEEL_1_1Parser.RULE_unaryExpression);
this.state = 473;
if (!this.precpred(this._ctx, 4)) {
throw this.createFailedPredicateException("this.precpred(this._ctx, 4)");
}
this.state = 474;
this.parameters();
}
}
}
this.state = 479;
this._errHandler.sync(this);
_alt = this._interp.adaptivePredict(this._input, 36, this._ctx);
}
}
} catch (re) {
if (re instanceof RecognitionException) {
localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
} else {
throw re;
}
} finally {
this.unrollRecursionContexts(_parentctx);
}
return localctx;
}