in nlpcraft/src/main/scala/org/apache/nlpcraft/internal/makro/antlr4/NCMacroDslParser.java [405:495]
private ListContext list(int _p) throws RecognitionException {
ParserRuleContext _parentctx = _ctx;
int _parentState = getState();
ListContext _localctx = new ListContext(_ctx, _parentState);
ListContext _prevctx = _localctx;
int _startState = 10;
enterRecursionRule(_localctx, 10, RULE_list, _p);
try {
int _alt;
enterOuterAlt(_localctx, 1);
{
setState(46);
_errHandler.sync(this);
switch (_input.LA(1)) {
case LCURLY:
case REGEX_TXT:
case IDL_TXT:
case TXT:
{
setState(42);
expr(0);
}
break;
case UNDERSCORE:
{
setState(43);
match(UNDERSCORE);
setState(44);
match(VERT);
setState(45);
list(1);
}
break;
default:
throw new NoViableAltException(this);
}
_ctx.stop = _input.LT(-1);
setState(56);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,5,_ctx);
while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
if ( _alt==1 ) {
if ( _parseListeners!=null ) triggerExitRuleEvent();
_prevctx = _localctx;
{
setState(54);
_errHandler.sync(this);
switch ( getInterpreter().adaptivePredict(_input,4,_ctx) ) {
case 1:
{
_localctx = new ListContext(_parentctx, _parentState);
pushNewRecursionContext(_localctx, _startState, RULE_list);
setState(48);
if (!(precpred(_ctx, 3))) throw new FailedPredicateException(this, "precpred(_ctx, 3)");
setState(49);
match(VERT);
setState(50);
expr(0);
}
break;
case 2:
{
_localctx = new ListContext(_parentctx, _parentState);
pushNewRecursionContext(_localctx, _startState, RULE_list);
setState(51);
if (!(precpred(_ctx, 2))) throw new FailedPredicateException(this, "precpred(_ctx, 2)");
setState(52);
match(VERT);
setState(53);
match(UNDERSCORE);
}
break;
}
}
}
setState(58);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,5,_ctx);
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
unrollRecursionContexts(_parentctx);
}
return _localctx;
}