
// Generated from Plan.g4 by ANTLR 4.9.2


#include "PlanVisitor.h"

#include "PlanParser.h"


using namespace antlrcpp;
using namespace antlr4;

PlanParser::PlanParser(TokenStream *input) : Parser(input) {
  _interpreter = new atn::ParserATNSimulator(this, _atn, _decisionToDFA, _sharedContextCache);
}

PlanParser::~PlanParser() {
  delete _interpreter;
}

std::string PlanParser::getGrammarFileName() const {
  return "Plan.g4";
}

const std::vector<std::string>& PlanParser::getRuleNames() const {
  return _ruleNames;
}

dfa::Vocabulary& PlanParser::getVocabulary() const {
  return _vocabulary;
}


//----------------- ExprContext ------------------------------------------------------------------

PlanParser::ExprContext::ExprContext(ParserRuleContext *parent, size_t invokingState)
  : ParserRuleContext(parent, invokingState) {
}


size_t PlanParser::ExprContext::getRuleIndex() const {
  return PlanParser::RuleExpr;
}

void PlanParser::ExprContext::copyFrom(ExprContext *ctx) {
  ParserRuleContext::copyFrom(ctx);
}

//----------------- JSONIdentifierContext ------------------------------------------------------------------

tree::TerminalNode* PlanParser::JSONIdentifierContext::JSONIdentifier() {
  return getToken(PlanParser::JSONIdentifier, 0);
}

PlanParser::JSONIdentifierContext::JSONIdentifierContext(ExprContext *ctx) { copyFrom(ctx); }


antlrcpp::Any PlanParser::JSONIdentifierContext::accept(tree::ParseTreeVisitor *visitor) {
  if (auto parserVisitor = dynamic_cast<PlanVisitor*>(visitor))
    return parserVisitor->visitJSONIdentifier(this);
  else
    return visitor->visitChildren(this);
}
//----------------- ParensContext ------------------------------------------------------------------

PlanParser::ExprContext* PlanParser::ParensContext::expr() {
  return getRuleContext<PlanParser::ExprContext>(0);
}

PlanParser::ParensContext::ParensContext(ExprContext *ctx) { copyFrom(ctx); }


antlrcpp::Any PlanParser::ParensContext::accept(tree::ParseTreeVisitor *visitor) {
  if (auto parserVisitor = dynamic_cast<PlanVisitor*>(visitor))
    return parserVisitor->visitParens(this);
  else
    return visitor->visitChildren(this);
}
//----------------- StringContext ------------------------------------------------------------------

tree::TerminalNode* PlanParser::StringContext::StringLiteral() {
  return getToken(PlanParser::StringLiteral, 0);
}

PlanParser::StringContext::StringContext(ExprContext *ctx) { copyFrom(ctx); }


antlrcpp::Any PlanParser::StringContext::accept(tree::ParseTreeVisitor *visitor) {
  if (auto parserVisitor = dynamic_cast<PlanVisitor*>(visitor))
    return parserVisitor->visitString(this);
  else
    return visitor->visitChildren(this);
}
//----------------- FloatingContext ------------------------------------------------------------------

tree::TerminalNode* PlanParser::FloatingContext::FloatingConstant() {
  return getToken(PlanParser::FloatingConstant, 0);
}

PlanParser::FloatingContext::FloatingContext(ExprContext *ctx) { copyFrom(ctx); }


antlrcpp::Any PlanParser::FloatingContext::accept(tree::ParseTreeVisitor *visitor) {
  if (auto parserVisitor = dynamic_cast<PlanVisitor*>(visitor))
    return parserVisitor->visitFloating(this);
  else
    return visitor->visitChildren(this);
}
//----------------- JSONContainsAllContext ------------------------------------------------------------------

std::vector<PlanParser::ExprContext *> PlanParser::JSONContainsAllContext::expr() {
  return getRuleContexts<PlanParser::ExprContext>();
}

PlanParser::ExprContext* PlanParser::JSONContainsAllContext::expr(size_t i) {
  return getRuleContext<PlanParser::ExprContext>(i);
}

tree::TerminalNode* PlanParser::JSONContainsAllContext::JSONContainsAll() {
  return getToken(PlanParser::JSONContainsAll, 0);
}

tree::TerminalNode* PlanParser::JSONContainsAllContext::ArrayContainsAll() {
  return getToken(PlanParser::ArrayContainsAll, 0);
}

PlanParser::JSONContainsAllContext::JSONContainsAllContext(ExprContext *ctx) { copyFrom(ctx); }


antlrcpp::Any PlanParser::JSONContainsAllContext::accept(tree::ParseTreeVisitor *visitor) {
  if (auto parserVisitor = dynamic_cast<PlanVisitor*>(visitor))
    return parserVisitor->visitJSONContainsAll(this);
  else
    return visitor->visitChildren(this);
}
//----------------- LogicalOrContext ------------------------------------------------------------------

std::vector<PlanParser::ExprContext *> PlanParser::LogicalOrContext::expr() {
  return getRuleContexts<PlanParser::ExprContext>();
}

PlanParser::ExprContext* PlanParser::LogicalOrContext::expr(size_t i) {
  return getRuleContext<PlanParser::ExprContext>(i);
}

tree::TerminalNode* PlanParser::LogicalOrContext::OR() {
  return getToken(PlanParser::OR, 0);
}

PlanParser::LogicalOrContext::LogicalOrContext(ExprContext *ctx) { copyFrom(ctx); }


antlrcpp::Any PlanParser::LogicalOrContext::accept(tree::ParseTreeVisitor *visitor) {
  if (auto parserVisitor = dynamic_cast<PlanVisitor*>(visitor))
    return parserVisitor->visitLogicalOr(this);
  else
    return visitor->visitChildren(this);
}
//----------------- MulDivModContext ------------------------------------------------------------------

std::vector<PlanParser::ExprContext *> PlanParser::MulDivModContext::expr() {
  return getRuleContexts<PlanParser::ExprContext>();
}

PlanParser::ExprContext* PlanParser::MulDivModContext::expr(size_t i) {
  return getRuleContext<PlanParser::ExprContext>(i);
}

tree::TerminalNode* PlanParser::MulDivModContext::MUL() {
  return getToken(PlanParser::MUL, 0);
}

tree::TerminalNode* PlanParser::MulDivModContext::DIV() {
  return getToken(PlanParser::DIV, 0);
}

tree::TerminalNode* PlanParser::MulDivModContext::MOD() {
  return getToken(PlanParser::MOD, 0);
}

PlanParser::MulDivModContext::MulDivModContext(ExprContext *ctx) { copyFrom(ctx); }


antlrcpp::Any PlanParser::MulDivModContext::accept(tree::ParseTreeVisitor *visitor) {
  if (auto parserVisitor = dynamic_cast<PlanVisitor*>(visitor))
    return parserVisitor->visitMulDivMod(this);
  else
    return visitor->visitChildren(this);
}
//----------------- IdentifierContext ------------------------------------------------------------------

tree::TerminalNode* PlanParser::IdentifierContext::Identifier() {
  return getToken(PlanParser::Identifier, 0);
}

PlanParser::IdentifierContext::IdentifierContext(ExprContext *ctx) { copyFrom(ctx); }


antlrcpp::Any PlanParser::IdentifierContext::accept(tree::ParseTreeVisitor *visitor) {
  if (auto parserVisitor = dynamic_cast<PlanVisitor*>(visitor))
    return parserVisitor->visitIdentifier(this);
  else
    return visitor->visitChildren(this);
}
//----------------- LikeContext ------------------------------------------------------------------

PlanParser::ExprContext* PlanParser::LikeContext::expr() {
  return getRuleContext<PlanParser::ExprContext>(0);
}

tree::TerminalNode* PlanParser::LikeContext::LIKE() {
  return getToken(PlanParser::LIKE, 0);
}

tree::TerminalNode* PlanParser::LikeContext::StringLiteral() {
  return getToken(PlanParser::StringLiteral, 0);
}

PlanParser::LikeContext::LikeContext(ExprContext *ctx) { copyFrom(ctx); }


antlrcpp::Any PlanParser::LikeContext::accept(tree::ParseTreeVisitor *visitor) {
  if (auto parserVisitor = dynamic_cast<PlanVisitor*>(visitor))
    return parserVisitor->visitLike(this);
  else
    return visitor->visitChildren(this);
}
//----------------- LogicalAndContext ------------------------------------------------------------------

std::vector<PlanParser::ExprContext *> PlanParser::LogicalAndContext::expr() {
  return getRuleContexts<PlanParser::ExprContext>();
}

PlanParser::ExprContext* PlanParser::LogicalAndContext::expr(size_t i) {
  return getRuleContext<PlanParser::ExprContext>(i);
}

tree::TerminalNode* PlanParser::LogicalAndContext::AND() {
  return getToken(PlanParser::AND, 0);
}

PlanParser::LogicalAndContext::LogicalAndContext(ExprContext *ctx) { copyFrom(ctx); }


antlrcpp::Any PlanParser::LogicalAndContext::accept(tree::ParseTreeVisitor *visitor) {
  if (auto parserVisitor = dynamic_cast<PlanVisitor*>(visitor))
    return parserVisitor->visitLogicalAnd(this);
  else
    return visitor->visitChildren(this);
}
//----------------- EqualityContext ------------------------------------------------------------------

std::vector<PlanParser::ExprContext *> PlanParser::EqualityContext::expr() {
  return getRuleContexts<PlanParser::ExprContext>();
}

PlanParser::ExprContext* PlanParser::EqualityContext::expr(size_t i) {
  return getRuleContext<PlanParser::ExprContext>(i);
}

tree::TerminalNode* PlanParser::EqualityContext::EQ() {
  return getToken(PlanParser::EQ, 0);
}

tree::TerminalNode* PlanParser::EqualityContext::NE() {
  return getToken(PlanParser::NE, 0);
}

PlanParser::EqualityContext::EqualityContext(ExprContext *ctx) { copyFrom(ctx); }


antlrcpp::Any PlanParser::EqualityContext::accept(tree::ParseTreeVisitor *visitor) {
  if (auto parserVisitor = dynamic_cast<PlanVisitor*>(visitor))
    return parserVisitor->visitEquality(this);
  else
    return visitor->visitChildren(this);
}
//----------------- BooleanContext ------------------------------------------------------------------

tree::TerminalNode* PlanParser::BooleanContext::BooleanConstant() {
  return getToken(PlanParser::BooleanConstant, 0);
}

PlanParser::BooleanContext::BooleanContext(ExprContext *ctx) { copyFrom(ctx); }


antlrcpp::Any PlanParser::BooleanContext::accept(tree::ParseTreeVisitor *visitor) {
  if (auto parserVisitor = dynamic_cast<PlanVisitor*>(visitor))
    return parserVisitor->visitBoolean(this);
  else
    return visitor->visitChildren(this);
}
//----------------- ShiftContext ------------------------------------------------------------------

std::vector<PlanParser::ExprContext *> PlanParser::ShiftContext::expr() {
  return getRuleContexts<PlanParser::ExprContext>();
}

PlanParser::ExprContext* PlanParser::ShiftContext::expr(size_t i) {
  return getRuleContext<PlanParser::ExprContext>(i);
}

tree::TerminalNode* PlanParser::ShiftContext::SHL() {
  return getToken(PlanParser::SHL, 0);
}

tree::TerminalNode* PlanParser::ShiftContext::SHR() {
  return getToken(PlanParser::SHR, 0);
}

PlanParser::ShiftContext::ShiftContext(ExprContext *ctx) { copyFrom(ctx); }


antlrcpp::Any PlanParser::ShiftContext::accept(tree::ParseTreeVisitor *visitor) {
  if (auto parserVisitor = dynamic_cast<PlanVisitor*>(visitor))
    return parserVisitor->visitShift(this);
  else
    return visitor->visitChildren(this);
}
//----------------- ReverseRangeContext ------------------------------------------------------------------

std::vector<PlanParser::ExprContext *> PlanParser::ReverseRangeContext::expr() {
  return getRuleContexts<PlanParser::ExprContext>();
}

PlanParser::ExprContext* PlanParser::ReverseRangeContext::expr(size_t i) {
  return getRuleContext<PlanParser::ExprContext>(i);
}

tree::TerminalNode* PlanParser::ReverseRangeContext::Identifier() {
  return getToken(PlanParser::Identifier, 0);
}

tree::TerminalNode* PlanParser::ReverseRangeContext::JSONIdentifier() {
  return getToken(PlanParser::JSONIdentifier, 0);
}

std::vector<tree::TerminalNode *> PlanParser::ReverseRangeContext::GT() {
  return getTokens(PlanParser::GT);
}

tree::TerminalNode* PlanParser::ReverseRangeContext::GT(size_t i) {
  return getToken(PlanParser::GT, i);
}

std::vector<tree::TerminalNode *> PlanParser::ReverseRangeContext::GE() {
  return getTokens(PlanParser::GE);
}

tree::TerminalNode* PlanParser::ReverseRangeContext::GE(size_t i) {
  return getToken(PlanParser::GE, i);
}

PlanParser::ReverseRangeContext::ReverseRangeContext(ExprContext *ctx) { copyFrom(ctx); }


antlrcpp::Any PlanParser::ReverseRangeContext::accept(tree::ParseTreeVisitor *visitor) {
  if (auto parserVisitor = dynamic_cast<PlanVisitor*>(visitor))
    return parserVisitor->visitReverseRange(this);
  else
    return visitor->visitChildren(this);
}
//----------------- BitOrContext ------------------------------------------------------------------

std::vector<PlanParser::ExprContext *> PlanParser::BitOrContext::expr() {
  return getRuleContexts<PlanParser::ExprContext>();
}

PlanParser::ExprContext* PlanParser::BitOrContext::expr(size_t i) {
  return getRuleContext<PlanParser::ExprContext>(i);
}

tree::TerminalNode* PlanParser::BitOrContext::BOR() {
  return getToken(PlanParser::BOR, 0);
}

PlanParser::BitOrContext::BitOrContext(ExprContext *ctx) { copyFrom(ctx); }


antlrcpp::Any PlanParser::BitOrContext::accept(tree::ParseTreeVisitor *visitor) {
  if (auto parserVisitor = dynamic_cast<PlanVisitor*>(visitor))
    return parserVisitor->visitBitOr(this);
  else
    return visitor->visitChildren(this);
}
//----------------- AddSubContext ------------------------------------------------------------------

std::vector<PlanParser::ExprContext *> PlanParser::AddSubContext::expr() {
  return getRuleContexts<PlanParser::ExprContext>();
}

PlanParser::ExprContext* PlanParser::AddSubContext::expr(size_t i) {
  return getRuleContext<PlanParser::ExprContext>(i);
}

tree::TerminalNode* PlanParser::AddSubContext::ADD() {
  return getToken(PlanParser::ADD, 0);
}

tree::TerminalNode* PlanParser::AddSubContext::SUB() {
  return getToken(PlanParser::SUB, 0);
}

PlanParser::AddSubContext::AddSubContext(ExprContext *ctx) { copyFrom(ctx); }


antlrcpp::Any PlanParser::AddSubContext::accept(tree::ParseTreeVisitor *visitor) {
  if (auto parserVisitor = dynamic_cast<PlanVisitor*>(visitor))
    return parserVisitor->visitAddSub(this);
  else
    return visitor->visitChildren(this);
}
//----------------- RelationalContext ------------------------------------------------------------------

std::vector<PlanParser::ExprContext *> PlanParser::RelationalContext::expr() {
  return getRuleContexts<PlanParser::ExprContext>();
}

PlanParser::ExprContext* PlanParser::RelationalContext::expr(size_t i) {
  return getRuleContext<PlanParser::ExprContext>(i);
}

tree::TerminalNode* PlanParser::RelationalContext::LT() {
  return getToken(PlanParser::LT, 0);
}

tree::TerminalNode* PlanParser::RelationalContext::LE() {
  return getToken(PlanParser::LE, 0);
}

tree::TerminalNode* PlanParser::RelationalContext::GT() {
  return getToken(PlanParser::GT, 0);
}

tree::TerminalNode* PlanParser::RelationalContext::GE() {
  return getToken(PlanParser::GE, 0);
}

PlanParser::RelationalContext::RelationalContext(ExprContext *ctx) { copyFrom(ctx); }


antlrcpp::Any PlanParser::RelationalContext::accept(tree::ParseTreeVisitor *visitor) {
  if (auto parserVisitor = dynamic_cast<PlanVisitor*>(visitor))
    return parserVisitor->visitRelational(this);
  else
    return visitor->visitChildren(this);
}
//----------------- ArrayLengthContext ------------------------------------------------------------------

tree::TerminalNode* PlanParser::ArrayLengthContext::ArrayLength() {
  return getToken(PlanParser::ArrayLength, 0);
}

tree::TerminalNode* PlanParser::ArrayLengthContext::Identifier() {
  return getToken(PlanParser::Identifier, 0);
}

tree::TerminalNode* PlanParser::ArrayLengthContext::JSONIdentifier() {
  return getToken(PlanParser::JSONIdentifier, 0);
}

PlanParser::ArrayLengthContext::ArrayLengthContext(ExprContext *ctx) { copyFrom(ctx); }


antlrcpp::Any PlanParser::ArrayLengthContext::accept(tree::ParseTreeVisitor *visitor) {
  if (auto parserVisitor = dynamic_cast<PlanVisitor*>(visitor))
    return parserVisitor->visitArrayLength(this);
  else
    return visitor->visitChildren(this);
}
//----------------- TermContext ------------------------------------------------------------------

std::vector<PlanParser::ExprContext *> PlanParser::TermContext::expr() {
  return getRuleContexts<PlanParser::ExprContext>();
}

PlanParser::ExprContext* PlanParser::TermContext::expr(size_t i) {
  return getRuleContext<PlanParser::ExprContext>(i);
}

tree::TerminalNode* PlanParser::TermContext::IN() {
  return getToken(PlanParser::IN, 0);
}

tree::TerminalNode* PlanParser::TermContext::NIN() {
  return getToken(PlanParser::NIN, 0);
}

PlanParser::TermContext::TermContext(ExprContext *ctx) { copyFrom(ctx); }


antlrcpp::Any PlanParser::TermContext::accept(tree::ParseTreeVisitor *visitor) {
  if (auto parserVisitor = dynamic_cast<PlanVisitor*>(visitor))
    return parserVisitor->visitTerm(this);
  else
    return visitor->visitChildren(this);
}
//----------------- JSONContainsContext ------------------------------------------------------------------

std::vector<PlanParser::ExprContext *> PlanParser::JSONContainsContext::expr() {
  return getRuleContexts<PlanParser::ExprContext>();
}

PlanParser::ExprContext* PlanParser::JSONContainsContext::expr(size_t i) {
  return getRuleContext<PlanParser::ExprContext>(i);
}

tree::TerminalNode* PlanParser::JSONContainsContext::JSONContains() {
  return getToken(PlanParser::JSONContains, 0);
}

tree::TerminalNode* PlanParser::JSONContainsContext::ArrayContains() {
  return getToken(PlanParser::ArrayContains, 0);
}

PlanParser::JSONContainsContext::JSONContainsContext(ExprContext *ctx) { copyFrom(ctx); }


antlrcpp::Any PlanParser::JSONContainsContext::accept(tree::ParseTreeVisitor *visitor) {
  if (auto parserVisitor = dynamic_cast<PlanVisitor*>(visitor))
    return parserVisitor->visitJSONContains(this);
  else
    return visitor->visitChildren(this);
}
//----------------- RangeContext ------------------------------------------------------------------

std::vector<PlanParser::ExprContext *> PlanParser::RangeContext::expr() {
  return getRuleContexts<PlanParser::ExprContext>();
}

PlanParser::ExprContext* PlanParser::RangeContext::expr(size_t i) {
  return getRuleContext<PlanParser::ExprContext>(i);
}

tree::TerminalNode* PlanParser::RangeContext::Identifier() {
  return getToken(PlanParser::Identifier, 0);
}

tree::TerminalNode* PlanParser::RangeContext::JSONIdentifier() {
  return getToken(PlanParser::JSONIdentifier, 0);
}

std::vector<tree::TerminalNode *> PlanParser::RangeContext::LT() {
  return getTokens(PlanParser::LT);
}

tree::TerminalNode* PlanParser::RangeContext::LT(size_t i) {
  return getToken(PlanParser::LT, i);
}

std::vector<tree::TerminalNode *> PlanParser::RangeContext::LE() {
  return getTokens(PlanParser::LE);
}

tree::TerminalNode* PlanParser::RangeContext::LE(size_t i) {
  return getToken(PlanParser::LE, i);
}

PlanParser::RangeContext::RangeContext(ExprContext *ctx) { copyFrom(ctx); }


antlrcpp::Any PlanParser::RangeContext::accept(tree::ParseTreeVisitor *visitor) {
  if (auto parserVisitor = dynamic_cast<PlanVisitor*>(visitor))
    return parserVisitor->visitRange(this);
  else
    return visitor->visitChildren(this);
}
//----------------- UnaryContext ------------------------------------------------------------------

PlanParser::ExprContext* PlanParser::UnaryContext::expr() {
  return getRuleContext<PlanParser::ExprContext>(0);
}

tree::TerminalNode* PlanParser::UnaryContext::ADD() {
  return getToken(PlanParser::ADD, 0);
}

tree::TerminalNode* PlanParser::UnaryContext::SUB() {
  return getToken(PlanParser::SUB, 0);
}

tree::TerminalNode* PlanParser::UnaryContext::BNOT() {
  return getToken(PlanParser::BNOT, 0);
}

tree::TerminalNode* PlanParser::UnaryContext::NOT() {
  return getToken(PlanParser::NOT, 0);
}

PlanParser::UnaryContext::UnaryContext(ExprContext *ctx) { copyFrom(ctx); }


antlrcpp::Any PlanParser::UnaryContext::accept(tree::ParseTreeVisitor *visitor) {
  if (auto parserVisitor = dynamic_cast<PlanVisitor*>(visitor))
    return parserVisitor->visitUnary(this);
  else
    return visitor->visitChildren(this);
}
//----------------- IntegerContext ------------------------------------------------------------------

tree::TerminalNode* PlanParser::IntegerContext::IntegerConstant() {
  return getToken(PlanParser::IntegerConstant, 0);
}

PlanParser::IntegerContext::IntegerContext(ExprContext *ctx) { copyFrom(ctx); }


antlrcpp::Any PlanParser::IntegerContext::accept(tree::ParseTreeVisitor *visitor) {
  if (auto parserVisitor = dynamic_cast<PlanVisitor*>(visitor))
    return parserVisitor->visitInteger(this);
  else
    return visitor->visitChildren(this);
}
//----------------- ArrayContext ------------------------------------------------------------------

std::vector<PlanParser::ExprContext *> PlanParser::ArrayContext::expr() {
  return getRuleContexts<PlanParser::ExprContext>();
}

PlanParser::ExprContext* PlanParser::ArrayContext::expr(size_t i) {
  return getRuleContext<PlanParser::ExprContext>(i);
}

PlanParser::ArrayContext::ArrayContext(ExprContext *ctx) { copyFrom(ctx); }


antlrcpp::Any PlanParser::ArrayContext::accept(tree::ParseTreeVisitor *visitor) {
  if (auto parserVisitor = dynamic_cast<PlanVisitor*>(visitor))
    return parserVisitor->visitArray(this);
  else
    return visitor->visitChildren(this);
}
//----------------- JSONContainsAnyContext ------------------------------------------------------------------

std::vector<PlanParser::ExprContext *> PlanParser::JSONContainsAnyContext::expr() {
  return getRuleContexts<PlanParser::ExprContext>();
}

PlanParser::ExprContext* PlanParser::JSONContainsAnyContext::expr(size_t i) {
  return getRuleContext<PlanParser::ExprContext>(i);
}

tree::TerminalNode* PlanParser::JSONContainsAnyContext::JSONContainsAny() {
  return getToken(PlanParser::JSONContainsAny, 0);
}

tree::TerminalNode* PlanParser::JSONContainsAnyContext::ArrayContainsAny() {
  return getToken(PlanParser::ArrayContainsAny, 0);
}

PlanParser::JSONContainsAnyContext::JSONContainsAnyContext(ExprContext *ctx) { copyFrom(ctx); }


antlrcpp::Any PlanParser::JSONContainsAnyContext::accept(tree::ParseTreeVisitor *visitor) {
  if (auto parserVisitor = dynamic_cast<PlanVisitor*>(visitor))
    return parserVisitor->visitJSONContainsAny(this);
  else
    return visitor->visitChildren(this);
}
//----------------- BitXorContext ------------------------------------------------------------------

std::vector<PlanParser::ExprContext *> PlanParser::BitXorContext::expr() {
  return getRuleContexts<PlanParser::ExprContext>();
}

PlanParser::ExprContext* PlanParser::BitXorContext::expr(size_t i) {
  return getRuleContext<PlanParser::ExprContext>(i);
}

tree::TerminalNode* PlanParser::BitXorContext::BXOR() {
  return getToken(PlanParser::BXOR, 0);
}

PlanParser::BitXorContext::BitXorContext(ExprContext *ctx) { copyFrom(ctx); }


antlrcpp::Any PlanParser::BitXorContext::accept(tree::ParseTreeVisitor *visitor) {
  if (auto parserVisitor = dynamic_cast<PlanVisitor*>(visitor))
    return parserVisitor->visitBitXor(this);
  else
    return visitor->visitChildren(this);
}
//----------------- ExistsContext ------------------------------------------------------------------

tree::TerminalNode* PlanParser::ExistsContext::EXISTS() {
  return getToken(PlanParser::EXISTS, 0);
}

PlanParser::ExprContext* PlanParser::ExistsContext::expr() {
  return getRuleContext<PlanParser::ExprContext>(0);
}

PlanParser::ExistsContext::ExistsContext(ExprContext *ctx) { copyFrom(ctx); }


antlrcpp::Any PlanParser::ExistsContext::accept(tree::ParseTreeVisitor *visitor) {
  if (auto parserVisitor = dynamic_cast<PlanVisitor*>(visitor))
    return parserVisitor->visitExists(this);
  else
    return visitor->visitChildren(this);
}
//----------------- BitAndContext ------------------------------------------------------------------

std::vector<PlanParser::ExprContext *> PlanParser::BitAndContext::expr() {
  return getRuleContexts<PlanParser::ExprContext>();
}

PlanParser::ExprContext* PlanParser::BitAndContext::expr(size_t i) {
  return getRuleContext<PlanParser::ExprContext>(i);
}

tree::TerminalNode* PlanParser::BitAndContext::BAND() {
  return getToken(PlanParser::BAND, 0);
}

PlanParser::BitAndContext::BitAndContext(ExprContext *ctx) { copyFrom(ctx); }


antlrcpp::Any PlanParser::BitAndContext::accept(tree::ParseTreeVisitor *visitor) {
  if (auto parserVisitor = dynamic_cast<PlanVisitor*>(visitor))
    return parserVisitor->visitBitAnd(this);
  else
    return visitor->visitChildren(this);
}
//----------------- EmptyTermContext ------------------------------------------------------------------

PlanParser::ExprContext* PlanParser::EmptyTermContext::expr() {
  return getRuleContext<PlanParser::ExprContext>(0);
}

tree::TerminalNode* PlanParser::EmptyTermContext::EmptyTerm() {
  return getToken(PlanParser::EmptyTerm, 0);
}

tree::TerminalNode* PlanParser::EmptyTermContext::IN() {
  return getToken(PlanParser::IN, 0);
}

tree::TerminalNode* PlanParser::EmptyTermContext::NIN() {
  return getToken(PlanParser::NIN, 0);
}

PlanParser::EmptyTermContext::EmptyTermContext(ExprContext *ctx) { copyFrom(ctx); }


antlrcpp::Any PlanParser::EmptyTermContext::accept(tree::ParseTreeVisitor *visitor) {
  if (auto parserVisitor = dynamic_cast<PlanVisitor*>(visitor))
    return parserVisitor->visitEmptyTerm(this);
  else
    return visitor->visitChildren(this);
}
//----------------- PowerContext ------------------------------------------------------------------

std::vector<PlanParser::ExprContext *> PlanParser::PowerContext::expr() {
  return getRuleContexts<PlanParser::ExprContext>();
}

PlanParser::ExprContext* PlanParser::PowerContext::expr(size_t i) {
  return getRuleContext<PlanParser::ExprContext>(i);
}

tree::TerminalNode* PlanParser::PowerContext::POW() {
  return getToken(PlanParser::POW, 0);
}

PlanParser::PowerContext::PowerContext(ExprContext *ctx) { copyFrom(ctx); }


antlrcpp::Any PlanParser::PowerContext::accept(tree::ParseTreeVisitor *visitor) {
  if (auto parserVisitor = dynamic_cast<PlanVisitor*>(visitor))
    return parserVisitor->visitPower(this);
  else
    return visitor->visitChildren(this);
}

PlanParser::ExprContext* PlanParser::expr() {
   return expr(0);
}

PlanParser::ExprContext* PlanParser::expr(int precedence) {
  ParserRuleContext *parentContext = _ctx;
  size_t parentState = getState();
  PlanParser::ExprContext *_localctx = _tracker.createInstance<ExprContext>(_ctx, parentState);
  PlanParser::ExprContext *previousContext = _localctx;
  (void)previousContext; // Silence compiler, in case the context is not used by generated code.
  size_t startState = 0;
  enterRecursionRule(_localctx, 0, PlanParser::RuleExpr, precedence);

    size_t _la = 0;

#if __cplusplus > 201703L
  auto onExit = finally([=, this] {
#else
  auto onExit = finally([=] {
#endif
    unrollRecursionContexts(parentContext);
  });
  try {
    size_t alt;
    enterOuterAlt(_localctx, 1);
    setState(56);
    _errHandler->sync(this);
    switch (_input->LA(1)) {
      case PlanParser::IntegerConstant: {
        _localctx = _tracker.createInstance<IntegerContext>(_localctx);
        _ctx = _localctx;
        previousContext = _localctx;

        setState(3);
        match(PlanParser::IntegerConstant);
        break;
      }

      case PlanParser::FloatingConstant: {
        _localctx = _tracker.createInstance<FloatingContext>(_localctx);
        _ctx = _localctx;
        previousContext = _localctx;
        setState(4);
        match(PlanParser::FloatingConstant);
        break;
      }

      case PlanParser::BooleanConstant: {
        _localctx = _tracker.createInstance<BooleanContext>(_localctx);
        _ctx = _localctx;
        previousContext = _localctx;
        setState(5);
        match(PlanParser::BooleanConstant);
        break;
      }

      case PlanParser::StringLiteral: {
        _localctx = _tracker.createInstance<StringContext>(_localctx);
        _ctx = _localctx;
        previousContext = _localctx;
        setState(6);
        match(PlanParser::StringLiteral);
        break;
      }

      case PlanParser::Identifier: {
        _localctx = _tracker.createInstance<IdentifierContext>(_localctx);
        _ctx = _localctx;
        previousContext = _localctx;
        setState(7);
        match(PlanParser::Identifier);
        break;
      }

      case PlanParser::JSONIdentifier: {
        _localctx = _tracker.createInstance<JSONIdentifierContext>(_localctx);
        _ctx = _localctx;
        previousContext = _localctx;
        setState(8);
        match(PlanParser::JSONIdentifier);
        break;
      }

      case PlanParser::T__0: {
        _localctx = _tracker.createInstance<ParensContext>(_localctx);
        _ctx = _localctx;
        previousContext = _localctx;
        setState(9);
        match(PlanParser::T__0);
        setState(10);
        expr(0);
        setState(11);
        match(PlanParser::T__1);
        break;
      }

      case PlanParser::T__2: {
        _localctx = _tracker.createInstance<ArrayContext>(_localctx);
        _ctx = _localctx;
        previousContext = _localctx;
        setState(13);
        match(PlanParser::T__2);
        setState(14);
        expr(0);
        setState(19);
        _errHandler->sync(this);
        alt = getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 0, _ctx);
        while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) {
          if (alt == 1) {
            setState(15);
            match(PlanParser::T__3);
            setState(16);
            expr(0); 
          }
          setState(21);
          _errHandler->sync(this);
          alt = getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 0, _ctx);
        }
        setState(23);
        _errHandler->sync(this);

        _la = _input->LA(1);
        if (_la == PlanParser::T__3) {
          setState(22);
          match(PlanParser::T__3);
        }
        setState(25);
        match(PlanParser::T__4);
        break;
      }

      case PlanParser::ADD:
      case PlanParser::SUB:
      case PlanParser::BNOT:
      case PlanParser::NOT: {
        _localctx = _tracker.createInstance<UnaryContext>(_localctx);
        _ctx = _localctx;
        previousContext = _localctx;
        setState(27);
        dynamic_cast<UnaryContext *>(_localctx)->op = _input->LT(1);
        _la = _input->LA(1);
        if (!((((_la & ~ 0x3fULL) == 0) &&
          ((1ULL << _la) & ((1ULL << PlanParser::ADD)
          | (1ULL << PlanParser::SUB)
          | (1ULL << PlanParser::BNOT)
          | (1ULL << PlanParser::NOT))) != 0))) {
          dynamic_cast<UnaryContext *>(_localctx)->op = _errHandler->recoverInline(this);
        }
        else {
          _errHandler->reportMatch(this);
          consume();
        }
        setState(28);
        expr(20);
        break;
      }

      case PlanParser::JSONContains:
      case PlanParser::ArrayContains: {
        _localctx = _tracker.createInstance<JSONContainsContext>(_localctx);
        _ctx = _localctx;
        previousContext = _localctx;
        setState(29);
        _la = _input->LA(1);
        if (!(_la == PlanParser::JSONContains

        || _la == PlanParser::ArrayContains)) {
        _errHandler->recoverInline(this);
        }
        else {
          _errHandler->reportMatch(this);
          consume();
        }
        setState(30);
        match(PlanParser::T__0);
        setState(31);
        expr(0);
        setState(32);
        match(PlanParser::T__3);
        setState(33);
        expr(0);
        setState(34);
        match(PlanParser::T__1);
        break;
      }

      case PlanParser::JSONContainsAll:
      case PlanParser::ArrayContainsAll: {
        _localctx = _tracker.createInstance<JSONContainsAllContext>(_localctx);
        _ctx = _localctx;
        previousContext = _localctx;
        setState(36);
        _la = _input->LA(1);
        if (!(_la == PlanParser::JSONContainsAll

        || _la == PlanParser::ArrayContainsAll)) {
        _errHandler->recoverInline(this);
        }
        else {
          _errHandler->reportMatch(this);
          consume();
        }
        setState(37);
        match(PlanParser::T__0);
        setState(38);
        expr(0);
        setState(39);
        match(PlanParser::T__3);
        setState(40);
        expr(0);
        setState(41);
        match(PlanParser::T__1);
        break;
      }

      case PlanParser::JSONContainsAny:
      case PlanParser::ArrayContainsAny: {
        _localctx = _tracker.createInstance<JSONContainsAnyContext>(_localctx);
        _ctx = _localctx;
        previousContext = _localctx;
        setState(43);
        _la = _input->LA(1);
        if (!(_la == PlanParser::JSONContainsAny

        || _la == PlanParser::ArrayContainsAny)) {
        _errHandler->recoverInline(this);
        }
        else {
          _errHandler->reportMatch(this);
          consume();
        }
        setState(44);
        match(PlanParser::T__0);
        setState(45);
        expr(0);
        setState(46);
        match(PlanParser::T__3);
        setState(47);
        expr(0);
        setState(48);
        match(PlanParser::T__1);
        break;
      }

      case PlanParser::ArrayLength: {
        _localctx = _tracker.createInstance<ArrayLengthContext>(_localctx);
        _ctx = _localctx;
        previousContext = _localctx;
        setState(50);
        match(PlanParser::ArrayLength);
        setState(51);
        match(PlanParser::T__0);
        setState(52);
        _la = _input->LA(1);
        if (!(_la == PlanParser::Identifier

        || _la == PlanParser::JSONIdentifier)) {
        _errHandler->recoverInline(this);
        }
        else {
          _errHandler->reportMatch(this);
          consume();
        }
        setState(53);
        match(PlanParser::T__1);
        break;
      }

      case PlanParser::EXISTS: {
        _localctx = _tracker.createInstance<ExistsContext>(_localctx);
        _ctx = _localctx;
        previousContext = _localctx;
        setState(54);
        match(PlanParser::EXISTS);
        setState(55);
        expr(1);
        break;
      }

    default:
      throw NoViableAltException(this);
    }
    _ctx->stop = _input->LT(-1);
    setState(125);
    _errHandler->sync(this);
    alt = getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 6, _ctx);
    while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) {
      if (alt == 1) {
        if (!_parseListeners.empty())
          triggerExitRuleEvent();
        previousContext = _localctx;
        setState(123);
        _errHandler->sync(this);
        switch (getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 5, _ctx)) {
        case 1: {
          auto newContext = _tracker.createInstance<PowerContext>(_tracker.createInstance<ExprContext>(parentContext, parentState));
          _localctx = newContext;
          pushNewRecursionContext(newContext, startState, RuleExpr);
          setState(58);

          if (!(precpred(_ctx, 21))) throw FailedPredicateException(this, "precpred(_ctx, 21)");
          setState(59);
          match(PlanParser::POW);
          setState(60);
          expr(22);
          break;
        }

        case 2: {
          auto newContext = _tracker.createInstance<MulDivModContext>(_tracker.createInstance<ExprContext>(parentContext, parentState));
          _localctx = newContext;
          pushNewRecursionContext(newContext, startState, RuleExpr);
          setState(61);

          if (!(precpred(_ctx, 19))) throw FailedPredicateException(this, "precpred(_ctx, 19)");
          setState(62);
          dynamic_cast<MulDivModContext *>(_localctx)->op = _input->LT(1);
          _la = _input->LA(1);
          if (!((((_la & ~ 0x3fULL) == 0) &&
            ((1ULL << _la) & ((1ULL << PlanParser::MUL)
            | (1ULL << PlanParser::DIV)
            | (1ULL << PlanParser::MOD))) != 0))) {
            dynamic_cast<MulDivModContext *>(_localctx)->op = _errHandler->recoverInline(this);
          }
          else {
            _errHandler->reportMatch(this);
            consume();
          }
          setState(63);
          expr(20);
          break;
        }

        case 3: {
          auto newContext = _tracker.createInstance<AddSubContext>(_tracker.createInstance<ExprContext>(parentContext, parentState));
          _localctx = newContext;
          pushNewRecursionContext(newContext, startState, RuleExpr);
          setState(64);

          if (!(precpred(_ctx, 18))) throw FailedPredicateException(this, "precpred(_ctx, 18)");
          setState(65);
          dynamic_cast<AddSubContext *>(_localctx)->op = _input->LT(1);
          _la = _input->LA(1);
          if (!(_la == PlanParser::ADD

          || _la == PlanParser::SUB)) {
            dynamic_cast<AddSubContext *>(_localctx)->op = _errHandler->recoverInline(this);
          }
          else {
            _errHandler->reportMatch(this);
            consume();
          }
          setState(66);
          expr(19);
          break;
        }

        case 4: {
          auto newContext = _tracker.createInstance<ShiftContext>(_tracker.createInstance<ExprContext>(parentContext, parentState));
          _localctx = newContext;
          pushNewRecursionContext(newContext, startState, RuleExpr);
          setState(67);

          if (!(precpred(_ctx, 17))) throw FailedPredicateException(this, "precpred(_ctx, 17)");
          setState(68);
          dynamic_cast<ShiftContext *>(_localctx)->op = _input->LT(1);
          _la = _input->LA(1);
          if (!(_la == PlanParser::SHL

          || _la == PlanParser::SHR)) {
            dynamic_cast<ShiftContext *>(_localctx)->op = _errHandler->recoverInline(this);
          }
          else {
            _errHandler->reportMatch(this);
            consume();
          }
          setState(69);
          expr(18);
          break;
        }

        case 5: {
          auto newContext = _tracker.createInstance<RangeContext>(_tracker.createInstance<ExprContext>(parentContext, parentState));
          _localctx = newContext;
          pushNewRecursionContext(newContext, startState, RuleExpr);
          setState(70);

          if (!(precpred(_ctx, 10))) throw FailedPredicateException(this, "precpred(_ctx, 10)");
          setState(71);
          dynamic_cast<RangeContext *>(_localctx)->op1 = _input->LT(1);
          _la = _input->LA(1);
          if (!(_la == PlanParser::LT

          || _la == PlanParser::LE)) {
            dynamic_cast<RangeContext *>(_localctx)->op1 = _errHandler->recoverInline(this);
          }
          else {
            _errHandler->reportMatch(this);
            consume();
          }
          setState(72);
          _la = _input->LA(1);
          if (!(_la == PlanParser::Identifier

          || _la == PlanParser::JSONIdentifier)) {
          _errHandler->recoverInline(this);
          }
          else {
            _errHandler->reportMatch(this);
            consume();
          }
          setState(73);
          dynamic_cast<RangeContext *>(_localctx)->op2 = _input->LT(1);
          _la = _input->LA(1);
          if (!(_la == PlanParser::LT

          || _la == PlanParser::LE)) {
            dynamic_cast<RangeContext *>(_localctx)->op2 = _errHandler->recoverInline(this);
          }
          else {
            _errHandler->reportMatch(this);
            consume();
          }
          setState(74);
          expr(11);
          break;
        }

        case 6: {
          auto newContext = _tracker.createInstance<ReverseRangeContext>(_tracker.createInstance<ExprContext>(parentContext, parentState));
          _localctx = newContext;
          pushNewRecursionContext(newContext, startState, RuleExpr);
          setState(75);

          if (!(precpred(_ctx, 9))) throw FailedPredicateException(this, "precpred(_ctx, 9)");
          setState(76);
          dynamic_cast<ReverseRangeContext *>(_localctx)->op1 = _input->LT(1);
          _la = _input->LA(1);
          if (!(_la == PlanParser::GT

          || _la == PlanParser::GE)) {
            dynamic_cast<ReverseRangeContext *>(_localctx)->op1 = _errHandler->recoverInline(this);
          }
          else {
            _errHandler->reportMatch(this);
            consume();
          }
          setState(77);
          _la = _input->LA(1);
          if (!(_la == PlanParser::Identifier

          || _la == PlanParser::JSONIdentifier)) {
          _errHandler->recoverInline(this);
          }
          else {
            _errHandler->reportMatch(this);
            consume();
          }
          setState(78);
          dynamic_cast<ReverseRangeContext *>(_localctx)->op2 = _input->LT(1);
          _la = _input->LA(1);
          if (!(_la == PlanParser::GT

          || _la == PlanParser::GE)) {
            dynamic_cast<ReverseRangeContext *>(_localctx)->op2 = _errHandler->recoverInline(this);
          }
          else {
            _errHandler->reportMatch(this);
            consume();
          }
          setState(79);
          expr(10);
          break;
        }

        case 7: {
          auto newContext = _tracker.createInstance<RelationalContext>(_tracker.createInstance<ExprContext>(parentContext, parentState));
          _localctx = newContext;
          pushNewRecursionContext(newContext, startState, RuleExpr);
          setState(80);

          if (!(precpred(_ctx, 8))) throw FailedPredicateException(this, "precpred(_ctx, 8)");
          setState(81);
          dynamic_cast<RelationalContext *>(_localctx)->op = _input->LT(1);
          _la = _input->LA(1);
          if (!((((_la & ~ 0x3fULL) == 0) &&
            ((1ULL << _la) & ((1ULL << PlanParser::LT)
            | (1ULL << PlanParser::LE)
            | (1ULL << PlanParser::GT)
            | (1ULL << PlanParser::GE))) != 0))) {
            dynamic_cast<RelationalContext *>(_localctx)->op = _errHandler->recoverInline(this);
          }
          else {
            _errHandler->reportMatch(this);
            consume();
          }
          setState(82);
          expr(9);
          break;
        }

        case 8: {
          auto newContext = _tracker.createInstance<EqualityContext>(_tracker.createInstance<ExprContext>(parentContext, parentState));
          _localctx = newContext;
          pushNewRecursionContext(newContext, startState, RuleExpr);
          setState(83);

          if (!(precpred(_ctx, 7))) throw FailedPredicateException(this, "precpred(_ctx, 7)");
          setState(84);
          dynamic_cast<EqualityContext *>(_localctx)->op = _input->LT(1);
          _la = _input->LA(1);
          if (!(_la == PlanParser::EQ

          || _la == PlanParser::NE)) {
            dynamic_cast<EqualityContext *>(_localctx)->op = _errHandler->recoverInline(this);
          }
          else {
            _errHandler->reportMatch(this);
            consume();
          }
          setState(85);
          expr(8);
          break;
        }

        case 9: {
          auto newContext = _tracker.createInstance<BitAndContext>(_tracker.createInstance<ExprContext>(parentContext, parentState));
          _localctx = newContext;
          pushNewRecursionContext(newContext, startState, RuleExpr);
          setState(86);

          if (!(precpred(_ctx, 6))) throw FailedPredicateException(this, "precpred(_ctx, 6)");
          setState(87);
          match(PlanParser::BAND);
          setState(88);
          expr(7);
          break;
        }

        case 10: {
          auto newContext = _tracker.createInstance<BitXorContext>(_tracker.createInstance<ExprContext>(parentContext, parentState));
          _localctx = newContext;
          pushNewRecursionContext(newContext, startState, RuleExpr);
          setState(89);

          if (!(precpred(_ctx, 5))) throw FailedPredicateException(this, "precpred(_ctx, 5)");
          setState(90);
          match(PlanParser::BXOR);
          setState(91);
          expr(6);
          break;
        }

        case 11: {
          auto newContext = _tracker.createInstance<BitOrContext>(_tracker.createInstance<ExprContext>(parentContext, parentState));
          _localctx = newContext;
          pushNewRecursionContext(newContext, startState, RuleExpr);
          setState(92);

          if (!(precpred(_ctx, 4))) throw FailedPredicateException(this, "precpred(_ctx, 4)");
          setState(93);
          match(PlanParser::BOR);
          setState(94);
          expr(5);
          break;
        }

        case 12: {
          auto newContext = _tracker.createInstance<LogicalAndContext>(_tracker.createInstance<ExprContext>(parentContext, parentState));
          _localctx = newContext;
          pushNewRecursionContext(newContext, startState, RuleExpr);
          setState(95);

          if (!(precpred(_ctx, 3))) throw FailedPredicateException(this, "precpred(_ctx, 3)");
          setState(96);
          match(PlanParser::AND);
          setState(97);
          expr(4);
          break;
        }

        case 13: {
          auto newContext = _tracker.createInstance<LogicalOrContext>(_tracker.createInstance<ExprContext>(parentContext, parentState));
          _localctx = newContext;
          pushNewRecursionContext(newContext, startState, RuleExpr);
          setState(98);

          if (!(precpred(_ctx, 2))) throw FailedPredicateException(this, "precpred(_ctx, 2)");
          setState(99);
          match(PlanParser::OR);
          setState(100);
          expr(3);
          break;
        }

        case 14: {
          auto newContext = _tracker.createInstance<LikeContext>(_tracker.createInstance<ExprContext>(parentContext, parentState));
          _localctx = newContext;
          pushNewRecursionContext(newContext, startState, RuleExpr);
          setState(101);

          if (!(precpred(_ctx, 22))) throw FailedPredicateException(this, "precpred(_ctx, 22)");
          setState(102);
          match(PlanParser::LIKE);
          setState(103);
          match(PlanParser::StringLiteral);
          break;
        }

        case 15: {
          auto newContext = _tracker.createInstance<TermContext>(_tracker.createInstance<ExprContext>(parentContext, parentState));
          _localctx = newContext;
          pushNewRecursionContext(newContext, startState, RuleExpr);
          setState(104);

          if (!(precpred(_ctx, 16))) throw FailedPredicateException(this, "precpred(_ctx, 16)");
          setState(105);
          dynamic_cast<TermContext *>(_localctx)->op = _input->LT(1);
          _la = _input->LA(1);
          if (!(_la == PlanParser::IN

          || _la == PlanParser::NIN)) {
            dynamic_cast<TermContext *>(_localctx)->op = _errHandler->recoverInline(this);
          }
          else {
            _errHandler->reportMatch(this);
            consume();
          }

          setState(106);
          match(PlanParser::T__2);
          setState(107);
          expr(0);
          setState(112);
          _errHandler->sync(this);
          alt = getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 3, _ctx);
          while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) {
            if (alt == 1) {
              setState(108);
              match(PlanParser::T__3);
              setState(109);
              expr(0); 
            }
            setState(114);
            _errHandler->sync(this);
            alt = getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 3, _ctx);
          }
          setState(116);
          _errHandler->sync(this);

          _la = _input->LA(1);
          if (_la == PlanParser::T__3) {
            setState(115);
            match(PlanParser::T__3);
          }
          setState(118);
          match(PlanParser::T__4);
          break;
        }

        case 16: {
          auto newContext = _tracker.createInstance<EmptyTermContext>(_tracker.createInstance<ExprContext>(parentContext, parentState));
          _localctx = newContext;
          pushNewRecursionContext(newContext, startState, RuleExpr);
          setState(120);

          if (!(precpred(_ctx, 15))) throw FailedPredicateException(this, "precpred(_ctx, 15)");
          setState(121);
          dynamic_cast<EmptyTermContext *>(_localctx)->op = _input->LT(1);
          _la = _input->LA(1);
          if (!(_la == PlanParser::IN

          || _la == PlanParser::NIN)) {
            dynamic_cast<EmptyTermContext *>(_localctx)->op = _errHandler->recoverInline(this);
          }
          else {
            _errHandler->reportMatch(this);
            consume();
          }
          setState(122);
          match(PlanParser::EmptyTerm);
          break;
        }

        default:
          break;
        } 
      }
      setState(127);
      _errHandler->sync(this);
      alt = getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 6, _ctx);
    }
  }
  catch (RecognitionException &e) {
    _errHandler->reportError(this, e);
    _localctx->exception = std::current_exception();
    _errHandler->recover(this, _localctx->exception);
  }
  return _localctx;
}

bool PlanParser::sempred(RuleContext *context, size_t ruleIndex, size_t predicateIndex) {
  switch (ruleIndex) {
    case 0: return exprSempred(dynamic_cast<ExprContext *>(context), predicateIndex);

  default:
    break;
  }
  return true;
}

bool PlanParser::exprSempred(ExprContext *_localctx, size_t predicateIndex) {
  switch (predicateIndex) {
    case 0: return precpred(_ctx, 21);
    case 1: return precpred(_ctx, 19);
    case 2: return precpred(_ctx, 18);
    case 3: return precpred(_ctx, 17);
    case 4: return precpred(_ctx, 10);
    case 5: return precpred(_ctx, 9);
    case 6: return precpred(_ctx, 8);
    case 7: return precpred(_ctx, 7);
    case 8: return precpred(_ctx, 6);
    case 9: return precpred(_ctx, 5);
    case 10: return precpred(_ctx, 4);
    case 11: return precpred(_ctx, 3);
    case 12: return precpred(_ctx, 2);
    case 13: return precpred(_ctx, 22);
    case 14: return precpred(_ctx, 16);
    case 15: return precpred(_ctx, 15);

  default:
    break;
  }
  return true;
}

// Static vars and initialization.
std::vector<dfa::DFA> PlanParser::_decisionToDFA;
atn::PredictionContextCache PlanParser::_sharedContextCache;

// We own the ATN which in turn owns the ATN states.
atn::ATN PlanParser::_atn;
std::vector<uint16_t> PlanParser::_serializedATN;

std::vector<std::string> PlanParser::_ruleNames = {
  "expr"
};

std::vector<std::string> PlanParser::_literalNames = {
  "", "'('", "')'", "'['", "','", "']'", "'<'", "'<='", "'>'", "'>='", "'=='", 
  "'!='", "", "", "'+'", "'-'", "'*'", "'/'", "'%'", "'**'", "'<<'", "'>>'", 
  "'&'", "'|'", "'^'", "", "", "'~'", "", "'in'", "'not in'"
};

std::vector<std::string> PlanParser::_symbolicNames = {
  "", "", "", "", "", "", "LT", "LE", "GT", "GE", "EQ", "NE", "LIKE", "EXISTS", 
  "ADD", "SUB", "MUL", "DIV", "MOD", "POW", "SHL", "SHR", "BAND", "BOR", 
  "BXOR", "AND", "OR", "BNOT", "NOT", "IN", "NIN", "EmptyTerm", "JSONContains", 
  "JSONContainsAll", "JSONContainsAny", "ArrayContains", "ArrayContainsAll", 
  "ArrayContainsAny", "ArrayLength", "BooleanConstant", "IntegerConstant", 
  "FloatingConstant", "Identifier", "StringLiteral", "JSONIdentifier", "Whitespace", 
  "Newline"
};

dfa::Vocabulary PlanParser::_vocabulary(_literalNames, _symbolicNames);

std::vector<std::string> PlanParser::_tokenNames;

PlanParser::Initializer::Initializer() {
	for (size_t i = 0; i < _symbolicNames.size(); ++i) {
		std::string name = _vocabulary.getLiteralName(i);
		if (name.empty()) {
			name = _vocabulary.getSymbolicName(i);
		}

		if (name.empty()) {
			_tokenNames.push_back("<INVALID>");
		} else {
      _tokenNames.push_back(name);
    }
	}

  static const uint16_t serializedATNSegment0[] = {
    0x3, 0x608b, 0xa72a, 0x8133, 0xb9ed, 0x417c, 0x3be7, 0x7786, 0x5964, 
       0x3, 0x30, 0x83, 0x4, 0x2, 0x9, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 
       0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 
       0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x7, 0x2, 
       0x14, 0xa, 0x2, 0xc, 0x2, 0xe, 0x2, 0x17, 0xb, 0x2, 0x3, 0x2, 0x5, 
       0x2, 0x1a, 0xa, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 
       0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 
       0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 
       0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 
       0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 
       0x2, 0x5, 0x2, 0x3b, 0xa, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 
       0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 
       0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 
       0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 
       0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 
       0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 
       0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 
       0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 
       0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x7, 0x2, 0x71, 0xa, 0x2, 0xc, 0x2, 
       0xe, 0x2, 0x74, 0xb, 0x2, 0x3, 0x2, 0x5, 0x2, 0x77, 0xa, 0x2, 0x3, 
       0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x7, 0x2, 0x7e, 0xa, 
       0x2, 0xc, 0x2, 0xe, 0x2, 0x81, 0xb, 0x2, 0x3, 0x2, 0x2, 0x3, 0x2, 
       0x3, 0x2, 0x2, 0xf, 0x4, 0x2, 0x10, 0x11, 0x1d, 0x1e, 0x4, 0x2, 0x22, 
       0x22, 0x25, 0x25, 0x4, 0x2, 0x23, 0x23, 0x26, 0x26, 0x4, 0x2, 0x24, 
       0x24, 0x27, 0x27, 0x4, 0x2, 0x2c, 0x2c, 0x2e, 0x2e, 0x3, 0x2, 0x12, 
       0x14, 0x3, 0x2, 0x10, 0x11, 0x3, 0x2, 0x16, 0x17, 0x3, 0x2, 0x8, 
       0x9, 0x3, 0x2, 0xa, 0xb, 0x3, 0x2, 0x8, 0xb, 0x3, 0x2, 0xc, 0xd, 
       0x3, 0x2, 0x1f, 0x20, 0x2, 0xa2, 0x2, 0x3a, 0x3, 0x2, 0x2, 0x2, 0x4, 
       0x5, 0x8, 0x2, 0x1, 0x2, 0x5, 0x3b, 0x7, 0x2a, 0x2, 0x2, 0x6, 0x3b, 
       0x7, 0x2b, 0x2, 0x2, 0x7, 0x3b, 0x7, 0x29, 0x2, 0x2, 0x8, 0x3b, 0x7, 
       0x2d, 0x2, 0x2, 0x9, 0x3b, 0x7, 0x2c, 0x2, 0x2, 0xa, 0x3b, 0x7, 0x2e, 
       0x2, 0x2, 0xb, 0xc, 0x7, 0x3, 0x2, 0x2, 0xc, 0xd, 0x5, 0x2, 0x2, 
       0x2, 0xd, 0xe, 0x7, 0x4, 0x2, 0x2, 0xe, 0x3b, 0x3, 0x2, 0x2, 0x2, 
       0xf, 0x10, 0x7, 0x5, 0x2, 0x2, 0x10, 0x15, 0x5, 0x2, 0x2, 0x2, 0x11, 
       0x12, 0x7, 0x6, 0x2, 0x2, 0x12, 0x14, 0x5, 0x2, 0x2, 0x2, 0x13, 0x11, 
       0x3, 0x2, 0x2, 0x2, 0x14, 0x17, 0x3, 0x2, 0x2, 0x2, 0x15, 0x13, 0x3, 
       0x2, 0x2, 0x2, 0x15, 0x16, 0x3, 0x2, 0x2, 0x2, 0x16, 0x19, 0x3, 0x2, 
       0x2, 0x2, 0x17, 0x15, 0x3, 0x2, 0x2, 0x2, 0x18, 0x1a, 0x7, 0x6, 0x2, 
       0x2, 0x19, 0x18, 0x3, 0x2, 0x2, 0x2, 0x19, 0x1a, 0x3, 0x2, 0x2, 0x2, 
       0x1a, 0x1b, 0x3, 0x2, 0x2, 0x2, 0x1b, 0x1c, 0x7, 0x7, 0x2, 0x2, 0x1c, 
       0x3b, 0x3, 0x2, 0x2, 0x2, 0x1d, 0x1e, 0x9, 0x2, 0x2, 0x2, 0x1e, 0x3b, 
       0x5, 0x2, 0x2, 0x16, 0x1f, 0x20, 0x9, 0x3, 0x2, 0x2, 0x20, 0x21, 
       0x7, 0x3, 0x2, 0x2, 0x21, 0x22, 0x5, 0x2, 0x2, 0x2, 0x22, 0x23, 0x7, 
       0x6, 0x2, 0x2, 0x23, 0x24, 0x5, 0x2, 0x2, 0x2, 0x24, 0x25, 0x7, 0x4, 
       0x2, 0x2, 0x25, 0x3b, 0x3, 0x2, 0x2, 0x2, 0x26, 0x27, 0x9, 0x4, 0x2, 
       0x2, 0x27, 0x28, 0x7, 0x3, 0x2, 0x2, 0x28, 0x29, 0x5, 0x2, 0x2, 0x2, 
       0x29, 0x2a, 0x7, 0x6, 0x2, 0x2, 0x2a, 0x2b, 0x5, 0x2, 0x2, 0x2, 0x2b, 
       0x2c, 0x7, 0x4, 0x2, 0x2, 0x2c, 0x3b, 0x3, 0x2, 0x2, 0x2, 0x2d, 0x2e, 
       0x9, 0x5, 0x2, 0x2, 0x2e, 0x2f, 0x7, 0x3, 0x2, 0x2, 0x2f, 0x30, 0x5, 
       0x2, 0x2, 0x2, 0x30, 0x31, 0x7, 0x6, 0x2, 0x2, 0x31, 0x32, 0x5, 0x2, 
       0x2, 0x2, 0x32, 0x33, 0x7, 0x4, 0x2, 0x2, 0x33, 0x3b, 0x3, 0x2, 0x2, 
       0x2, 0x34, 0x35, 0x7, 0x28, 0x2, 0x2, 0x35, 0x36, 0x7, 0x3, 0x2, 
       0x2, 0x36, 0x37, 0x9, 0x6, 0x2, 0x2, 0x37, 0x3b, 0x7, 0x4, 0x2, 0x2, 
       0x38, 0x39, 0x7, 0xf, 0x2, 0x2, 0x39, 0x3b, 0x5, 0x2, 0x2, 0x3, 0x3a, 
       0x4, 0x3, 0x2, 0x2, 0x2, 0x3a, 0x6, 0x3, 0x2, 0x2, 0x2, 0x3a, 0x7, 
       0x3, 0x2, 0x2, 0x2, 0x3a, 0x8, 0x3, 0x2, 0x2, 0x2, 0x3a, 0x9, 0x3, 
       0x2, 0x2, 0x2, 0x3a, 0xa, 0x3, 0x2, 0x2, 0x2, 0x3a, 0xb, 0x3, 0x2, 
       0x2, 0x2, 0x3a, 0xf, 0x3, 0x2, 0x2, 0x2, 0x3a, 0x1d, 0x3, 0x2, 0x2, 
       0x2, 0x3a, 0x1f, 0x3, 0x2, 0x2, 0x2, 0x3a, 0x26, 0x3, 0x2, 0x2, 0x2, 
       0x3a, 0x2d, 0x3, 0x2, 0x2, 0x2, 0x3a, 0x34, 0x3, 0x2, 0x2, 0x2, 0x3a, 
       0x38, 0x3, 0x2, 0x2, 0x2, 0x3b, 0x7f, 0x3, 0x2, 0x2, 0x2, 0x3c, 0x3d, 
       0xc, 0x17, 0x2, 0x2, 0x3d, 0x3e, 0x7, 0x15, 0x2, 0x2, 0x3e, 0x7e, 
       0x5, 0x2, 0x2, 0x18, 0x3f, 0x40, 0xc, 0x15, 0x2, 0x2, 0x40, 0x41, 
       0x9, 0x7, 0x2, 0x2, 0x41, 0x7e, 0x5, 0x2, 0x2, 0x16, 0x42, 0x43, 
       0xc, 0x14, 0x2, 0x2, 0x43, 0x44, 0x9, 0x8, 0x2, 0x2, 0x44, 0x7e, 
       0x5, 0x2, 0x2, 0x15, 0x45, 0x46, 0xc, 0x13, 0x2, 0x2, 0x46, 0x47, 
       0x9, 0x9, 0x2, 0x2, 0x47, 0x7e, 0x5, 0x2, 0x2, 0x14, 0x48, 0x49, 
       0xc, 0xc, 0x2, 0x2, 0x49, 0x4a, 0x9, 0xa, 0x2, 0x2, 0x4a, 0x4b, 0x9, 
       0x6, 0x2, 0x2, 0x4b, 0x4c, 0x9, 0xa, 0x2, 0x2, 0x4c, 0x7e, 0x5, 0x2, 
       0x2, 0xd, 0x4d, 0x4e, 0xc, 0xb, 0x2, 0x2, 0x4e, 0x4f, 0x9, 0xb, 0x2, 
       0x2, 0x4f, 0x50, 0x9, 0x6, 0x2, 0x2, 0x50, 0x51, 0x9, 0xb, 0x2, 0x2, 
       0x51, 0x7e, 0x5, 0x2, 0x2, 0xc, 0x52, 0x53, 0xc, 0xa, 0x2, 0x2, 0x53, 
       0x54, 0x9, 0xc, 0x2, 0x2, 0x54, 0x7e, 0x5, 0x2, 0x2, 0xb, 0x55, 0x56, 
       0xc, 0x9, 0x2, 0x2, 0x56, 0x57, 0x9, 0xd, 0x2, 0x2, 0x57, 0x7e, 0x5, 
       0x2, 0x2, 0xa, 0x58, 0x59, 0xc, 0x8, 0x2, 0x2, 0x59, 0x5a, 0x7, 0x18, 
       0x2, 0x2, 0x5a, 0x7e, 0x5, 0x2, 0x2, 0x9, 0x5b, 0x5c, 0xc, 0x7, 0x2, 
       0x2, 0x5c, 0x5d, 0x7, 0x1a, 0x2, 0x2, 0x5d, 0x7e, 0x5, 0x2, 0x2, 
       0x8, 0x5e, 0x5f, 0xc, 0x6, 0x2, 0x2, 0x5f, 0x60, 0x7, 0x19, 0x2, 
       0x2, 0x60, 0x7e, 0x5, 0x2, 0x2, 0x7, 0x61, 0x62, 0xc, 0x5, 0x2, 0x2, 
       0x62, 0x63, 0x7, 0x1b, 0x2, 0x2, 0x63, 0x7e, 0x5, 0x2, 0x2, 0x6, 
       0x64, 0x65, 0xc, 0x4, 0x2, 0x2, 0x65, 0x66, 0x7, 0x1c, 0x2, 0x2, 
       0x66, 0x7e, 0x5, 0x2, 0x2, 0x5, 0x67, 0x68, 0xc, 0x18, 0x2, 0x2, 
       0x68, 0x69, 0x7, 0xe, 0x2, 0x2, 0x69, 0x7e, 0x7, 0x2d, 0x2, 0x2, 
       0x6a, 0x6b, 0xc, 0x12, 0x2, 0x2, 0x6b, 0x6c, 0x9, 0xe, 0x2, 0x2, 
       0x6c, 0x6d, 0x7, 0x5, 0x2, 0x2, 0x6d, 0x72, 0x5, 0x2, 0x2, 0x2, 0x6e, 
       0x6f, 0x7, 0x6, 0x2, 0x2, 0x6f, 0x71, 0x5, 0x2, 0x2, 0x2, 0x70, 0x6e, 
       0x3, 0x2, 0x2, 0x2, 0x71, 0x74, 0x3, 0x2, 0x2, 0x2, 0x72, 0x70, 0x3, 
       0x2, 0x2, 0x2, 0x72, 0x73, 0x3, 0x2, 0x2, 0x2, 0x73, 0x76, 0x3, 0x2, 
       0x2, 0x2, 0x74, 0x72, 0x3, 0x2, 0x2, 0x2, 0x75, 0x77, 0x7, 0x6, 0x2, 
       0x2, 0x76, 0x75, 0x3, 0x2, 0x2, 0x2, 0x76, 0x77, 0x3, 0x2, 0x2, 0x2, 
       0x77, 0x78, 0x3, 0x2, 0x2, 0x2, 0x78, 0x79, 0x7, 0x7, 0x2, 0x2, 0x79, 
       0x7e, 0x3, 0x2, 0x2, 0x2, 0x7a, 0x7b, 0xc, 0x11, 0x2, 0x2, 0x7b, 
       0x7c, 0x9, 0xe, 0x2, 0x2, 0x7c, 0x7e, 0x7, 0x21, 0x2, 0x2, 0x7d, 
       0x3c, 0x3, 0x2, 0x2, 0x2, 0x7d, 0x3f, 0x3, 0x2, 0x2, 0x2, 0x7d, 0x42, 
       0x3, 0x2, 0x2, 0x2, 0x7d, 0x45, 0x3, 0x2, 0x2, 0x2, 0x7d, 0x48, 0x3, 
       0x2, 0x2, 0x2, 0x7d, 0x4d, 0x3, 0x2, 0x2, 0x2, 0x7d, 0x52, 0x3, 0x2, 
       0x2, 0x2, 0x7d, 0x55, 0x3, 0x2, 0x2, 0x2, 0x7d, 0x58, 0x3, 0x2, 0x2, 
       0x2, 0x7d, 0x5b, 0x3, 0x2, 0x2, 0x2, 0x7d, 0x5e, 0x3, 0x2, 0x2, 0x2, 
       0x7d, 0x61, 0x3, 0x2, 0x2, 0x2, 0x7d, 0x64, 0x3, 0x2, 0x2, 0x2, 0x7d, 
       0x67, 0x3, 0x2, 0x2, 0x2, 0x7d, 0x6a, 0x3, 0x2, 0x2, 0x2, 0x7d, 0x7a, 
       0x3, 0x2, 0x2, 0x2, 0x7e, 0x81, 0x3, 0x2, 0x2, 0x2, 0x7f, 0x7d, 0x3, 
       0x2, 0x2, 0x2, 0x7f, 0x80, 0x3, 0x2, 0x2, 0x2, 0x80, 0x3, 0x3, 0x2, 
       0x2, 0x2, 0x81, 0x7f, 0x3, 0x2, 0x2, 0x2, 0x9, 0x15, 0x19, 0x3a, 
       0x72, 0x76, 0x7d, 0x7f, 
  };

  _serializedATN.insert(_serializedATN.end(), serializedATNSegment0,
    serializedATNSegment0 + sizeof(serializedATNSegment0) / sizeof(serializedATNSegment0[0]));


  atn::ATNDeserializer deserializer;
  _atn = deserializer.deserialize(_serializedATN);

  size_t count = _atn.getNumberOfDecisions();
  _decisionToDFA.reserve(count);
  for (size_t i = 0; i < count; i++) { 
    _decisionToDFA.emplace_back(_atn.getDecisionState(i), i);
  }
}

PlanParser::Initializer PlanParser::_init;
