in src/mongo/grammar/mongoParser.ts [726:784]
public literal(): LiteralContext {
const _localctx: LiteralContext = new LiteralContext(this._ctx, this.state);
this.enterRule(_localctx, 28, mongoParser.RULE_literal);
let _la: number;
try {
this.state = 134;
this._errHandler.sync(this);
switch (this._input.LA(1)) {
case mongoParser.StringLiteral:
case mongoParser.NullLiteral:
case mongoParser.BooleanLiteral:
this.enterOuterAlt(_localctx, 1);
{
this.state = 131;
_la = this._input.LA(1);
if (!((((_la) & ~0x1F) === 0 && ((1 << _la) & ((1 << mongoParser.StringLiteral) | (1 << mongoParser.NullLiteral) | (1 << mongoParser.BooleanLiteral))) !== 0))) {
this._errHandler.recoverInline(this);
} else {
if (this._input.LA(1) === Token.EOF) {
this.matchedEOF = true;
}
this._errHandler.reportMatch(this);
this.consume();
}
}
break;
case mongoParser.RegexLiteral:
this.enterOuterAlt(_localctx, 2);
{
this.state = 132;
this.match(mongoParser.RegexLiteral);
}
break;
case mongoParser.NumericLiteral:
this.enterOuterAlt(_localctx, 3);
{
this.state = 133;
this.match(mongoParser.NumericLiteral);
}
break;
default:
throw new NoViableAltException(this);
}
}
catch (re) {
if (re instanceof RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
} else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}