primary method
Implementation
PrimaryContext primary() {
dynamic _localctx = PrimaryContext(context, state);
enterRule(_localctx, 16, RULE_primary);
int _la;
try {
state = 180;
errorHandler.sync(this);
switch (interpreter!.adaptivePredict(tokenStream, 25, context)) {
case 1:
_localctx = IdentOrGlobalCallContext(_localctx);
enterOuterAlt(_localctx, 1);
state = 130;
errorHandler.sync(this);
_la = tokenStream.LA(1)!;
if (_la == TOKEN_DOT) {
state = 129;
_localctx.leadingDot = match(TOKEN_DOT);
}
state = 132;
_localctx.id = match(TOKEN_IDENTIFIER);
state = 138;
errorHandler.sync(this);
switch (interpreter!.adaptivePredict(tokenStream, 16, context)) {
case 1:
state = 133;
_localctx.op = match(TOKEN_LPAREN);
state = 135;
errorHandler.sync(this);
_la = tokenStream.LA(1)!;
if (((_la) & ~0x3f) == 0 &&
bitwiseAnd(pow(2, _la), 135762105344) != 0) {
state = 134;
_localctx.args = exprList();
}
state = 137;
match(TOKEN_RPAREN);
break;
}
break;
case 2:
_localctx = NestedContext(_localctx);
enterOuterAlt(_localctx, 2);
state = 140;
match(TOKEN_LPAREN);
state = 141;
_localctx.e = expr();
state = 142;
match(TOKEN_RPAREN);
break;
case 3:
_localctx = CreateListContext(_localctx);
enterOuterAlt(_localctx, 3);
state = 144;
_localctx.op = match(TOKEN_LBRACKET);
state = 146;
errorHandler.sync(this);
_la = tokenStream.LA(1)!;
if (((_la) & ~0x3f) == 0 &&
bitwiseAnd(pow(2, _la), 135763153920) != 0) {
state = 145;
_localctx.elems = listInit();
}
state = 149;
errorHandler.sync(this);
_la = tokenStream.LA(1)!;
if (_la == TOKEN_COMMA) {
state = 148;
match(TOKEN_COMMA);
}
state = 151;
match(TOKEN_RPRACKET);
break;
case 4:
_localctx = CreateStructContext(_localctx);
enterOuterAlt(_localctx, 4);
state = 152;
_localctx.op = match(TOKEN_LBRACE);
state = 154;
errorHandler.sync(this);
_la = tokenStream.LA(1)!;
if (((_la) & ~0x3f) == 0 &&
bitwiseAnd(pow(2, _la), 135763153920) != 0) {
state = 153;
_localctx.entries = mapInitializerList();
}
state = 157;
errorHandler.sync(this);
_la = tokenStream.LA(1)!;
if (_la == TOKEN_COMMA) {
state = 156;
match(TOKEN_COMMA);
}
state = 159;
match(TOKEN_RBRACE);
break;
case 5:
_localctx = CreateMessageContext(_localctx);
enterOuterAlt(_localctx, 5);
state = 161;
errorHandler.sync(this);
_la = tokenStream.LA(1)!;
if (_la == TOKEN_DOT) {
state = 160;
_localctx.leadingDot = match(TOKEN_DOT);
}
state = 163;
_localctx._IDENTIFIER = match(TOKEN_IDENTIFIER);
_localctx.ids.add(_localctx._IDENTIFIER);
state = 168;
errorHandler.sync(this);
_la = tokenStream.LA(1)!;
while (_la == TOKEN_DOT) {
state = 164;
_localctx.s16 = match(TOKEN_DOT);
_localctx.ops.add(_localctx.s16);
state = 165;
_localctx._IDENTIFIER = match(TOKEN_IDENTIFIER);
_localctx.ids.add(_localctx._IDENTIFIER);
state = 170;
errorHandler.sync(this);
_la = tokenStream.LA(1)!;
}
state = 171;
_localctx.op = match(TOKEN_LBRACE);
state = 173;
errorHandler.sync(this);
_la = tokenStream.LA(1)!;
if (_la == TOKEN_QUESTIONMARK || _la == TOKEN_IDENTIFIER) {
state = 172;
_localctx.entries = fieldInitializerList();
}
state = 176;
errorHandler.sync(this);
_la = tokenStream.LA(1)!;
if (_la == TOKEN_COMMA) {
state = 175;
match(TOKEN_COMMA);
}
state = 178;
match(TOKEN_RBRACE);
break;
case 6:
_localctx = ConstantLiteralContext(_localctx);
enterOuterAlt(_localctx, 6);
state = 179;
literal();
break;
}
} on RecognitionException catch (re) {
_localctx.exception = re;
errorHandler.reportError(this, re);
errorHandler.recover(this, re);
} finally {
exitRule();
}
return _localctx;
}