// Code generated from /Users/tswadell/go/src/github.com/google/cel-go/parser/gen/CEL.g4 by ANTLR 4.10.1. DO NOT EDIT. package gen // CEL import ( "fmt" "strconv" "sync" "github.com/antlr/antlr4/runtime/Go/antlr" ) // Suppress unused import errors var _ = fmt.Printf var _ = strconv.Itoa var _ = sync.Once{} type CELParser struct { *antlr.BaseParser } var celParserStaticData struct { once sync.Once serializedATN []int32 literalNames []string symbolicNames []string ruleNames []string predictionContextCache *antlr.PredictionContextCache atn *antlr.ATN decisionToDFA []*antlr.DFA } func celParserInit() { staticData := &celParserStaticData staticData.literalNames = []string{ "", "'=='", "'!='", "'in'", "'<'", "'<='", "'>='", "'>'", "'&&'", "'||'", "'['", "']'", "'{'", "'}'", "'('", "')'", "'.'", "','", "'-'", "'!'", "'?'", "':'", "'+'", "'*'", "'/'", "'%'", "'true'", "'false'", "'null'", } staticData.symbolicNames = []string{ "", "EQUALS", "NOT_EQUALS", "IN", "LESS", "LESS_EQUALS", "GREATER_EQUALS", "GREATER", "LOGICAL_AND", "LOGICAL_OR", "LBRACKET", "RPRACKET", "LBRACE", "RBRACE", "LPAREN", "RPAREN", "DOT", "COMMA", "MINUS", "EXCLAM", "QUESTIONMARK", "COLON", "PLUS", "STAR", "SLASH", "PERCENT", "CEL_TRUE", "CEL_FALSE", "NUL", "WHITESPACE", "COMMENT", "NUM_FLOAT", "NUM_INT", "NUM_UINT", "STRING", "BYTES", "IDENTIFIER", } staticData.ruleNames = []string{ "start", "expr", "conditionalOr", "conditionalAnd", "relation", "calc", "unary", "member", "primary", "exprList", "fieldInitializerList", "mapInitializerList", "literal", } staticData.predictionContextCache = antlr.NewPredictionContextCache() staticData.serializedATN = []int32{ 4, 1, 36, 209, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 36, 8, 1, 1, 2, 1, 2, 1, 2, 5, 2, 41, 8, 2, 10, 2, 12, 2, 44, 9, 2, 1, 3, 1, 3, 1, 3, 5, 3, 49, 8, 3, 10, 3, 12, 3, 52, 9, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 5, 4, 60, 8, 4, 10, 4, 12, 4, 63, 9, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 5, 5, 74, 8, 5, 10, 5, 12, 5, 77, 9, 5, 1, 6, 1, 6, 4, 6, 81, 8, 6, 11, 6, 12, 6, 82, 1, 6, 1, 6, 4, 6, 87, 8, 6, 11, 6, 12, 6, 88, 1, 6, 3, 6, 92, 8, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 3, 7, 102, 8, 7, 1, 7, 3, 7, 105, 8, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 3, 7, 115, 8, 7, 1, 7, 3, 7, 118, 8, 7, 1, 7, 5, 7, 121, 8, 7, 10, 7, 12, 7, 124, 9, 7, 1, 8, 3, 8, 127, 8, 8, 1, 8, 1, 8, 1, 8, 3, 8, 132, 8, 8, 1, 8, 3, 8, 135, 8, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 3, 8, 143, 8, 8, 1, 8, 3, 8, 146, 8, 8, 1, 8, 1, 8, 1, 8, 3, 8, 151, 8, 8, 1, 8, 3, 8, 154, 8, 8, 1, 8, 1, 8, 3, 8, 158, 8, 8, 1, 9, 1, 9, 1, 9, 5, 9, 163, 8, 9, 10, 9, 12, 9, 166, 9, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 5, 10, 175, 8, 10, 10, 10, 12, 10, 178, 9, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 5, 11, 188, 8, 11, 10, 11, 12, 11, 191, 9, 11, 1, 12, 3, 12, 194, 8, 12, 1, 12, 1, 12, 1, 12, 3, 12, 199, 8, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 3, 12, 207, 8, 12, 1, 12, 0, 3, 8, 10, 14, 13, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 0, 3, 1, 0, 1, 7, 1, 0, 23, 25, 2, 0, 18, 18, 22, 22, 235, 0, 26, 1, 0, 0, 0, 2, 29, 1, 0, 0, 0, 4, 37, 1, 0, 0, 0, 6, 45, 1, 0, 0, 0, 8, 53, 1, 0, 0, 0, 10, 64, 1, 0, 0, 0, 12, 91, 1, 0, 0, 0, 14, 93, 1, 0, 0, 0, 16, 157, 1, 0, 0, 0, 18, 159, 1, 0, 0, 0, 20, 167, 1, 0, 0, 0, 22, 179, 1, 0, 0, 0, 24, 206, 1, 0, 0, 0, 26, 27, 3, 2, 1, 0, 27, 28, 5, 0, 0, 1, 28, 1, 1, 0, 0, 0, 29, 35, 3, 4, 2, 0, 30, 31, 5, 20, 0, 0, 31, 32, 3, 4, 2, 0, 32, 33, 5, 21, 0, 0, 33, 34, 3, 2, 1, 0, 34, 36, 1, 0, 0, 0, 35, 30, 1, 0, 0, 0, 35, 36, 1, 0, 0, 0, 36, 3, 1, 0, 0, 0, 37, 42, 3, 6, 3, 0, 38, 39, 5, 9, 0, 0, 39, 41, 3, 6, 3, 0, 40, 38, 1, 0, 0, 0, 41, 44, 1, 0, 0, 0, 42, 40, 1, 0, 0, 0, 42, 43, 1, 0, 0, 0, 43, 5, 1, 0, 0, 0, 44, 42, 1, 0, 0, 0, 45, 50, 3, 8, 4, 0, 46, 47, 5, 8, 0, 0, 47, 49, 3, 8, 4, 0, 48, 46, 1, 0, 0, 0, 49, 52, 1, 0, 0, 0, 50, 48, 1, 0, 0, 0, 50, 51, 1, 0, 0, 0, 51, 7, 1, 0, 0, 0, 52, 50, 1, 0, 0, 0, 53, 54, 6, 4, -1, 0, 54, 55, 3, 10, 5, 0, 55, 61, 1, 0, 0, 0, 56, 57, 10, 1, 0, 0, 57, 58, 7, 0, 0, 0, 58, 60, 3, 8, 4, 2, 59, 56, 1, 0, 0, 0, 60, 63, 1, 0, 0, 0, 61, 59, 1, 0, 0, 0, 61, 62, 1, 0, 0, 0, 62, 9, 1, 0, 0, 0, 63, 61, 1, 0, 0, 0, 64, 65, 6, 5, -1, 0, 65, 66, 3, 12, 6, 0, 66, 75, 1, 0, 0, 0, 67, 68, 10, 2, 0, 0, 68, 69, 7, 1, 0, 0, 69, 74, 3, 10, 5, 3, 70, 71, 10, 1, 0, 0, 71, 72, 7, 2, 0, 0, 72, 74, 3, 10, 5, 2, 73, 67, 1, 0, 0, 0, 73, 70, 1, 0, 0, 0, 74, 77, 1, 0, 0, 0, 75, 73, 1, 0, 0, 0, 75, 76, 1, 0, 0, 0, 76, 11, 1, 0, 0, 0, 77, 75, 1, 0, 0, 0, 78, 92, 3, 14, 7, 0, 79, 81, 5, 19, 0, 0, 80, 79, 1, 0, 0, 0, 81, 82, 1, 0, 0, 0, 82, 80, 1, 0, 0, 0, 82, 83, 1, 0, 0, 0, 83, 84, 1, 0, 0, 0, 84, 92, 3, 14, 7, 0, 85, 87, 5, 18, 0, 0, 86, 85, 1, 0, 0, 0, 87, 88, 1, 0, 0, 0, 88, 86, 1, 0, 0, 0, 88, 89, 1, 0, 0, 0, 89, 90, 1, 0, 0, 0, 90, 92, 3, 14, 7, 0, 91, 78, 1, 0, 0, 0, 91, 80, 1, 0, 0, 0, 91, 86, 1, 0, 0, 0, 92, 13, 1, 0, 0, 0, 93, 94, 6, 7, -1, 0, 94, 95, 3, 16, 8, 0, 95, 122, 1, 0, 0, 0, 96, 97, 10, 3, 0, 0, 97, 98, 5, 16, 0, 0, 98, 104, 5, 36, 0, 0, 99, 101, 5, 14, 0, 0, 100, 102, 3, 18, 9, 0, 101, 100, 1, 0, 0, 0, 101, 102, 1, 0, 0, 0, 102, 103, 1, 0, 0, 0, 103, 105, 5, 15, 0, 0, 104, 99, 1, 0, 0, 0, 104, 105, 1, 0, 0, 0, 105, 121, 1, 0, 0, 0, 106, 107, 10, 2, 0, 0, 107, 108, 5, 10, 0, 0, 108, 109, 3, 2, 1, 0, 109, 110, 5, 11, 0, 0, 110, 121, 1, 0, 0, 0, 111, 112, 10, 1, 0, 0, 112, 114, 5, 12, 0, 0, 113, 115, 3, 20, 10, 0, 114, 113, 1, 0, 0, 0, 114, 115, 1, 0, 0, 0, 115, 117, 1, 0, 0, 0, 116, 118, 5, 17, 0, 0, 117, 116, 1, 0, 0, 0, 117, 118, 1, 0, 0, 0, 118, 119, 1, 0, 0, 0, 119, 121, 5, 13, 0, 0, 120, 96, 1, 0, 0, 0, 120, 106, 1, 0, 0, 0, 120, 111, 1, 0, 0, 0, 121, 124, 1, 0, 0, 0, 122, 120, 1, 0, 0, 0, 122, 123, 1, 0, 0, 0, 123, 15, 1, 0, 0, 0, 124, 122, 1, 0, 0, 0, 125, 127, 5, 16, 0, 0, 126, 125, 1, 0, 0, 0, 126, 127, 1, 0, 0, 0, 127, 128, 1, 0, 0, 0, 128, 134, 5, 36, 0, 0, 129, 131, 5, 14, 0, 0, 130, 132, 3, 18, 9, 0, 131, 130, 1, 0, 0, 0, 131, 132, 1, 0, 0, 0, 132, 133, 1, 0, 0, 0, 133, 135, 5, 15, 0, 0, 134, 129, 1, 0, 0, 0, 134, 135, 1, 0, 0, 0, 135, 158, 1, 0, 0, 0, 136, 137, 5, 14, 0, 0, 137, 138, 3, 2, 1, 0, 138, 139, 5, 15, 0, 0, 139, 158, 1, 0, 0, 0, 140, 142, 5, 10, 0, 0, 141, 143, 3, 18, 9, 0, 142, 141, 1, 0, 0, 0, 142, 143, 1, 0, 0, 0, 143, 145, 1, 0, 0, 0, 144, 146, 5, 17, 0, 0, 145, 144, 1, 0, 0, 0, 145, 146, 1, 0, 0, 0, 146, 147, 1, 0, 0, 0, 147, 158, 5, 11, 0, 0, 148, 150, 5, 12, 0, 0, 149, 151, 3, 22, 11, 0, 150, 149, 1, 0, 0, 0, 150, 151, 1, 0, 0, 0, 151, 153, 1, 0, 0, 0, 152, 154, 5, 17, 0, 0, 153, 152, 1, 0, 0, 0, 153, 154, 1, 0, 0, 0, 154, 155, 1, 0, 0, 0, 155, 158, 5, 13, 0, 0, 156, 158, 3, 24, 12, 0, 157, 126, 1, 0, 0, 0, 157, 136, 1, 0, 0, 0, 157, 140, 1, 0, 0, 0, 157, 148, 1, 0, 0, 0, 157, 156, 1, 0, 0, 0, 158, 17, 1, 0, 0, 0, 159, 164, 3, 2, 1, 0, 160, 161, 5, 17, 0, 0, 161, 163, 3, 2, 1, 0, 162, 160, 1, 0, 0, 0, 163, 166, 1, 0, 0, 0, 164, 162, 1, 0, 0, 0, 164, 165, 1, 0, 0, 0, 165, 19, 1, 0, 0, 0, 166, 164, 1, 0, 0, 0, 167, 168, 5, 36, 0, 0, 168, 169, 5, 21, 0, 0, 169, 176, 3, 2, 1, 0, 170, 171, 5, 17, 0, 0, 171, 172, 5, 36, 0, 0, 172, 173, 5, 21, 0, 0, 173, 175, 3, 2, 1, 0, 174, 170, 1, 0, 0, 0, 175, 178, 1, 0, 0, 0, 176, 174, 1, 0, 0, 0, 176, 177, 1, 0, 0, 0, 177, 21, 1, 0, 0, 0, 178, 176, 1, 0, 0, 0, 179, 180, 3, 2, 1, 0, 180, 181, 5, 21, 0, 0, 181, 189, 3, 2, 1, 0, 182, 183, 5, 17, 0, 0, 183, 184, 3, 2, 1, 0, 184, 185, 5, 21, 0, 0, 185, 186, 3, 2, 1, 0, 186, 188, 1, 0, 0, 0, 187, 182, 1, 0, 0, 0, 188, 191, 1, 0, 0, 0, 189, 187, 1, 0, 0, 0, 189, 190, 1, 0, 0, 0, 190, 23, 1, 0, 0, 0, 191, 189, 1, 0, 0, 0, 192, 194, 5, 18, 0, 0, 193, 192, 1, 0, 0, 0, 193, 194, 1, 0, 0, 0, 194, 195, 1, 0, 0, 0, 195, 207, 5, 32, 0, 0, 196, 207, 5, 33, 0, 0, 197, 199, 5, 18, 0, 0, 198, 197, 1, 0, 0, 0, 198, 199, 1, 0, 0, 0, 199, 200, 1, 0, 0, 0, 200, 207, 5, 31, 0, 0, 201, 207, 5, 34, 0, 0, 202, 207, 5, 35, 0, 0, 203, 207, 5, 26, 0, 0, 204, 207, 5, 27, 0, 0, 205, 207, 5, 28, 0, 0, 206, 193, 1, 0, 0, 0, 206, 196, 1, 0, 0, 0, 206, 198, 1, 0, 0, 0, 206, 201, 1, 0, 0, 0, 206, 202, 1, 0, 0, 0, 206, 203, 1, 0, 0, 0, 206, 204, 1, 0, 0, 0, 206, 205, 1, 0, 0, 0, 207, 25, 1, 0, 0, 0, 29, 35, 42, 50, 61, 73, 75, 82, 88, 91, 101, 104, 114, 117, 120, 122, 126, 131, 134, 142, 145, 150, 153, 157, 164, 176, 189, 193, 198, 206, } deserializer := antlr.NewATNDeserializer(nil) staticData.atn = deserializer.Deserialize(staticData.serializedATN) atn := staticData.atn staticData.decisionToDFA = make([]*antlr.DFA, len(atn.DecisionToState)) decisionToDFA := staticData.decisionToDFA for index, state := range atn.DecisionToState { decisionToDFA[index] = antlr.NewDFA(state, index) } } // CELParserInit initializes any static state used to implement CELParser. By default the // static state used to implement the parser is lazily initialized during the first call to // NewCELParser(). You can call this function if you wish to initialize the static state ahead // of time. func CELParserInit() { staticData := &celParserStaticData staticData.once.Do(celParserInit) } // NewCELParser produces a new parser instance for the optional input antlr.TokenStream. func NewCELParser(input antlr.TokenStream) *CELParser { CELParserInit() this := new(CELParser) this.BaseParser = antlr.NewBaseParser(input) staticData := &celParserStaticData this.Interpreter = antlr.NewParserATNSimulator(this, staticData.atn, staticData.decisionToDFA, staticData.predictionContextCache) this.RuleNames = staticData.ruleNames this.LiteralNames = staticData.literalNames this.SymbolicNames = staticData.symbolicNames this.GrammarFileName = "CEL.g4" return this } // CELParser tokens. const ( CELParserEOF = antlr.TokenEOF CELParserEQUALS = 1 CELParserNOT_EQUALS = 2 CELParserIN = 3 CELParserLESS = 4 CELParserLESS_EQUALS = 5 CELParserGREATER_EQUALS = 6 CELParserGREATER = 7 CELParserLOGICAL_AND = 8 CELParserLOGICAL_OR = 9 CELParserLBRACKET = 10 CELParserRPRACKET = 11 CELParserLBRACE = 12 CELParserRBRACE = 13 CELParserLPAREN = 14 CELParserRPAREN = 15 CELParserDOT = 16 CELParserCOMMA = 17 CELParserMINUS = 18 CELParserEXCLAM = 19 CELParserQUESTIONMARK = 20 CELParserCOLON = 21 CELParserPLUS = 22 CELParserSTAR = 23 CELParserSLASH = 24 CELParserPERCENT = 25 CELParserCEL_TRUE = 26 CELParserCEL_FALSE = 27 CELParserNUL = 28 CELParserWHITESPACE = 29 CELParserCOMMENT = 30 CELParserNUM_FLOAT = 31 CELParserNUM_INT = 32 CELParserNUM_UINT = 33 CELParserSTRING = 34 CELParserBYTES = 35 CELParserIDENTIFIER = 36 ) // CELParser rules. const ( CELParserRULE_start = 0 CELParserRULE_expr = 1 CELParserRULE_conditionalOr = 2 CELParserRULE_conditionalAnd = 3 CELParserRULE_relation = 4 CELParserRULE_calc = 5 CELParserRULE_unary = 6 CELParserRULE_member = 7 CELParserRULE_primary = 8 CELParserRULE_exprList = 9 CELParserRULE_fieldInitializerList = 10 CELParserRULE_mapInitializerList = 11 CELParserRULE_literal = 12 ) // IStartContext is an interface to support dynamic dispatch. type IStartContext interface { antlr.ParserRuleContext // GetParser returns the parser. GetParser() antlr.Parser // GetE returns the e rule contexts. GetE() IExprContext // SetE sets the e rule contexts. SetE(IExprContext) // IsStartContext differentiates from other interfaces. IsStartContext() } type StartContext struct { *antlr.BaseParserRuleContext parser antlr.Parser e IExprContext } func NewEmptyStartContext() *StartContext { var p = new(StartContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) p.RuleIndex = CELParserRULE_start return p } func (*StartContext) IsStartContext() {} func NewStartContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *StartContext { var p = new(StartContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) p.parser = parser p.RuleIndex = CELParserRULE_start return p } func (s *StartContext) GetParser() antlr.Parser { return s.parser } func (s *StartContext) GetE() IExprContext { return s.e } func (s *StartContext) SetE(v IExprContext) { s.e = v } func (s *StartContext) EOF() antlr.TerminalNode { return s.GetToken(CELParserEOF, 0) } func (s *StartContext) Expr() IExprContext { var t antlr.RuleContext for _, ctx := range s.GetChildren() { if _, ok := ctx.(IExprContext); ok { t = ctx.(antlr.RuleContext) break } } if t == nil { return nil } return t.(IExprContext) } func (s *StartContext) GetRuleContext() antlr.RuleContext { return s } func (s *StartContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { return antlr.TreesStringTree(s, ruleNames, recog) } func (s *StartContext) EnterRule(listener antlr.ParseTreeListener) { if listenerT, ok := listener.(CELListener); ok { listenerT.EnterStart(s) } } func (s *StartContext) ExitRule(listener antlr.ParseTreeListener) { if listenerT, ok := listener.(CELListener); ok { listenerT.ExitStart(s) } } func (s *StartContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case CELVisitor: return t.VisitStart(s) default: return t.VisitChildren(s) } } func (p *CELParser) Start() (localctx IStartContext) { this := p _ = this localctx = NewStartContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 0, CELParserRULE_start) defer func() { p.ExitRule() }() defer func() { if err := recover(); err != nil { if v, ok := err.(antlr.RecognitionException); ok { localctx.SetException(v) p.GetErrorHandler().ReportError(p, v) p.GetErrorHandler().Recover(p, v) } else { panic(err) } } }() p.EnterOuterAlt(localctx, 1) { p.SetState(26) var _x = p.Expr() localctx.(*StartContext).e = _x } { p.SetState(27) p.Match(CELParserEOF) } return localctx } // IExprContext is an interface to support dynamic dispatch. type IExprContext interface { antlr.ParserRuleContext // GetParser returns the parser. GetParser() antlr.Parser // GetOp returns the op token. GetOp() antlr.Token // SetOp sets the op token. SetOp(antlr.Token) // GetE returns the e rule contexts. GetE() IConditionalOrContext // GetE1 returns the e1 rule contexts. GetE1() IConditionalOrContext // GetE2 returns the e2 rule contexts. GetE2() IExprContext // SetE sets the e rule contexts. SetE(IConditionalOrContext) // SetE1 sets the e1 rule contexts. SetE1(IConditionalOrContext) // SetE2 sets the e2 rule contexts. SetE2(IExprContext) // IsExprContext differentiates from other interfaces. IsExprContext() } type ExprContext struct { *antlr.BaseParserRuleContext parser antlr.Parser e IConditionalOrContext op antlr.Token e1 IConditionalOrContext e2 IExprContext } func NewEmptyExprContext() *ExprContext { var p = new(ExprContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) p.RuleIndex = CELParserRULE_expr return p } func (*ExprContext) IsExprContext() {} func NewExprContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ExprContext { var p = new(ExprContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) p.parser = parser p.RuleIndex = CELParserRULE_expr return p } func (s *ExprContext) GetParser() antlr.Parser { return s.parser } func (s *ExprContext) GetOp() antlr.Token { return s.op } func (s *ExprContext) SetOp(v antlr.Token) { s.op = v } func (s *ExprContext) GetE() IConditionalOrContext { return s.e } func (s *ExprContext) GetE1() IConditionalOrContext { return s.e1 } func (s *ExprContext) GetE2() IExprContext { return s.e2 } func (s *ExprContext) SetE(v IConditionalOrContext) { s.e = v } func (s *ExprContext) SetE1(v IConditionalOrContext) { s.e1 = v } func (s *ExprContext) SetE2(v IExprContext) { s.e2 = v } func (s *ExprContext) AllConditionalOr() []IConditionalOrContext { children := s.GetChildren() len := 0 for _, ctx := range children { if _, ok := ctx.(IConditionalOrContext); ok { len++ } } tst := make([]IConditionalOrContext, len) i := 0 for _, ctx := range children { if t, ok := ctx.(IConditionalOrContext); ok { tst[i] = t.(IConditionalOrContext) i++ } } return tst } func (s *ExprContext) ConditionalOr(i int) IConditionalOrContext { var t antlr.RuleContext j := 0 for _, ctx := range s.GetChildren() { if _, ok := ctx.(IConditionalOrContext); ok { if j == i { t = ctx.(antlr.RuleContext) break } j++ } } if t == nil { return nil } return t.(IConditionalOrContext) } func (s *ExprContext) COLON() antlr.TerminalNode { return s.GetToken(CELParserCOLON, 0) } func (s *ExprContext) QUESTIONMARK() antlr.TerminalNode { return s.GetToken(CELParserQUESTIONMARK, 0) } func (s *ExprContext) Expr() IExprContext { var t antlr.RuleContext for _, ctx := range s.GetChildren() { if _, ok := ctx.(IExprContext); ok { t = ctx.(antlr.RuleContext) break } } if t == nil { return nil } return t.(IExprContext) } func (s *ExprContext) GetRuleContext() antlr.RuleContext { return s } func (s *ExprContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { return antlr.TreesStringTree(s, ruleNames, recog) } func (s *ExprContext) EnterRule(listener antlr.ParseTreeListener) { if listenerT, ok := listener.(CELListener); ok { listenerT.EnterExpr(s) } } func (s *ExprContext) ExitRule(listener antlr.ParseTreeListener) { if listenerT, ok := listener.(CELListener); ok { listenerT.ExitExpr(s) } } func (s *ExprContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case CELVisitor: return t.VisitExpr(s) default: return t.VisitChildren(s) } } func (p *CELParser) Expr() (localctx IExprContext) { this := p _ = this localctx = NewExprContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 2, CELParserRULE_expr) var _la int defer func() { p.ExitRule() }() defer func() { if err := recover(); err != nil { if v, ok := err.(antlr.RecognitionException); ok { localctx.SetException(v) p.GetErrorHandler().ReportError(p, v) p.GetErrorHandler().Recover(p, v) } else { panic(err) } } }() p.EnterOuterAlt(localctx, 1) { p.SetState(29) var _x = p.ConditionalOr() localctx.(*ExprContext).e = _x } p.SetState(35) p.GetErrorHandler().Sync(p) _la = p.GetTokenStream().LA(1) if _la == CELParserQUESTIONMARK { { p.SetState(30) var _m = p.Match(CELParserQUESTIONMARK) localctx.(*ExprContext).op = _m } { p.SetState(31) var _x = p.ConditionalOr() localctx.(*ExprContext).e1 = _x } { p.SetState(32) p.Match(CELParserCOLON) } { p.SetState(33) var _x = p.Expr() localctx.(*ExprContext).e2 = _x } } return localctx } // IConditionalOrContext is an interface to support dynamic dispatch. type IConditionalOrContext interface { antlr.ParserRuleContext // GetParser returns the parser. GetParser() antlr.Parser // GetS9 returns the s9 token. GetS9() antlr.Token // SetS9 sets the s9 token. SetS9(antlr.Token) // GetOps returns the ops token list. GetOps() []antlr.Token // SetOps sets the ops token list. SetOps([]antlr.Token) // GetE returns the e rule contexts. GetE() IConditionalAndContext // Get_conditionalAnd returns the _conditionalAnd rule contexts. Get_conditionalAnd() IConditionalAndContext // SetE sets the e rule contexts. SetE(IConditionalAndContext) // Set_conditionalAnd sets the _conditionalAnd rule contexts. Set_conditionalAnd(IConditionalAndContext) // GetE1 returns the e1 rule context list. GetE1() []IConditionalAndContext // SetE1 sets the e1 rule context list. SetE1([]IConditionalAndContext) // IsConditionalOrContext differentiates from other interfaces. IsConditionalOrContext() } type ConditionalOrContext struct { *antlr.BaseParserRuleContext parser antlr.Parser e IConditionalAndContext s9 antlr.Token ops []antlr.Token _conditionalAnd IConditionalAndContext e1 []IConditionalAndContext } func NewEmptyConditionalOrContext() *ConditionalOrContext { var p = new(ConditionalOrContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) p.RuleIndex = CELParserRULE_conditionalOr return p } func (*ConditionalOrContext) IsConditionalOrContext() {} func NewConditionalOrContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ConditionalOrContext { var p = new(ConditionalOrContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) p.parser = parser p.RuleIndex = CELParserRULE_conditionalOr return p } func (s *ConditionalOrContext) GetParser() antlr.Parser { return s.parser } func (s *ConditionalOrContext) GetS9() antlr.Token { return s.s9 } func (s *ConditionalOrContext) SetS9(v antlr.Token) { s.s9 = v } func (s *ConditionalOrContext) GetOps() []antlr.Token { return s.ops } func (s *ConditionalOrContext) SetOps(v []antlr.Token) { s.ops = v } func (s *ConditionalOrContext) GetE() IConditionalAndContext { return s.e } func (s *ConditionalOrContext) Get_conditionalAnd() IConditionalAndContext { return s._conditionalAnd } func (s *ConditionalOrContext) SetE(v IConditionalAndContext) { s.e = v } func (s *ConditionalOrContext) Set_conditionalAnd(v IConditionalAndContext) { s._conditionalAnd = v } func (s *ConditionalOrContext) GetE1() []IConditionalAndContext { return s.e1 } func (s *ConditionalOrContext) SetE1(v []IConditionalAndContext) { s.e1 = v } func (s *ConditionalOrContext) AllConditionalAnd() []IConditionalAndContext { children := s.GetChildren() len := 0 for _, ctx := range children { if _, ok := ctx.(IConditionalAndContext); ok { len++ } } tst := make([]IConditionalAndContext, len) i := 0 for _, ctx := range children { if t, ok := ctx.(IConditionalAndContext); ok { tst[i] = t.(IConditionalAndContext) i++ } } return tst } func (s *ConditionalOrContext) ConditionalAnd(i int) IConditionalAndContext { var t antlr.RuleContext j := 0 for _, ctx := range s.GetChildren() { if _, ok := ctx.(IConditionalAndContext); ok { if j == i { t = ctx.(antlr.RuleContext) break } j++ } } if t == nil { return nil } return t.(IConditionalAndContext) } func (s *ConditionalOrContext) AllLOGICAL_OR() []antlr.TerminalNode { return s.GetTokens(CELParserLOGICAL_OR) } func (s *ConditionalOrContext) LOGICAL_OR(i int) antlr.TerminalNode { return s.GetToken(CELParserLOGICAL_OR, i) } func (s *ConditionalOrContext) GetRuleContext() antlr.RuleContext { return s } func (s *ConditionalOrContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { return antlr.TreesStringTree(s, ruleNames, recog) } func (s *ConditionalOrContext) EnterRule(listener antlr.ParseTreeListener) { if listenerT, ok := listener.(CELListener); ok { listenerT.EnterConditionalOr(s) } } func (s *ConditionalOrContext) ExitRule(listener antlr.ParseTreeListener) { if listenerT, ok := listener.(CELListener); ok { listenerT.ExitConditionalOr(s) } } func (s *ConditionalOrContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case CELVisitor: return t.VisitConditionalOr(s) default: return t.VisitChildren(s) } } func (p *CELParser) ConditionalOr() (localctx IConditionalOrContext) { this := p _ = this localctx = NewConditionalOrContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 4, CELParserRULE_conditionalOr) var _la int defer func() { p.ExitRule() }() defer func() { if err := recover(); err != nil { if v, ok := err.(antlr.RecognitionException); ok { localctx.SetException(v) p.GetErrorHandler().ReportError(p, v) p.GetErrorHandler().Recover(p, v) } else { panic(err) } } }() p.EnterOuterAlt(localctx, 1) { p.SetState(37) var _x = p.ConditionalAnd() localctx.(*ConditionalOrContext).e = _x } p.SetState(42) p.GetErrorHandler().Sync(p) _la = p.GetTokenStream().LA(1) for _la == CELParserLOGICAL_OR { { p.SetState(38) var _m = p.Match(CELParserLOGICAL_OR) localctx.(*ConditionalOrContext).s9 = _m } localctx.(*ConditionalOrContext).ops = append(localctx.(*ConditionalOrContext).ops, localctx.(*ConditionalOrContext).s9) { p.SetState(39) var _x = p.ConditionalAnd() localctx.(*ConditionalOrContext)._conditionalAnd = _x } localctx.(*ConditionalOrContext).e1 = append(localctx.(*ConditionalOrContext).e1, localctx.(*ConditionalOrContext)._conditionalAnd) p.SetState(44) p.GetErrorHandler().Sync(p) _la = p.GetTokenStream().LA(1) } return localctx } // IConditionalAndContext is an interface to support dynamic dispatch. type IConditionalAndContext interface { antlr.ParserRuleContext // GetParser returns the parser. GetParser() antlr.Parser // GetS8 returns the s8 token. GetS8() antlr.Token // SetS8 sets the s8 token. SetS8(antlr.Token) // GetOps returns the ops token list. GetOps() []antlr.Token // SetOps sets the ops token list. SetOps([]antlr.Token) // GetE returns the e rule contexts. GetE() IRelationContext // Get_relation returns the _relation rule contexts. Get_relation() IRelationContext // SetE sets the e rule contexts. SetE(IRelationContext) // Set_relation sets the _relation rule contexts. Set_relation(IRelationContext) // GetE1 returns the e1 rule context list. GetE1() []IRelationContext // SetE1 sets the e1 rule context list. SetE1([]IRelationContext) // IsConditionalAndContext differentiates from other interfaces. IsConditionalAndContext() } type ConditionalAndContext struct { *antlr.BaseParserRuleContext parser antlr.Parser e IRelationContext s8 antlr.Token ops []antlr.Token _relation IRelationContext e1 []IRelationContext } func NewEmptyConditionalAndContext() *ConditionalAndContext { var p = new(ConditionalAndContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) p.RuleIndex = CELParserRULE_conditionalAnd return p } func (*ConditionalAndContext) IsConditionalAndContext() {} func NewConditionalAndContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ConditionalAndContext { var p = new(ConditionalAndContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) p.parser = parser p.RuleIndex = CELParserRULE_conditionalAnd return p } func (s *ConditionalAndContext) GetParser() antlr.Parser { return s.parser } func (s *ConditionalAndContext) GetS8() antlr.Token { return s.s8 } func (s *ConditionalAndContext) SetS8(v antlr.Token) { s.s8 = v } func (s *ConditionalAndContext) GetOps() []antlr.Token { return s.ops } func (s *ConditionalAndContext) SetOps(v []antlr.Token) { s.ops = v } func (s *ConditionalAndContext) GetE() IRelationContext { return s.e } func (s *ConditionalAndContext) Get_relation() IRelationContext { return s._relation } func (s *ConditionalAndContext) SetE(v IRelationContext) { s.e = v } func (s *ConditionalAndContext) Set_relation(v IRelationContext) { s._relation = v } func (s *ConditionalAndContext) GetE1() []IRelationContext { return s.e1 } func (s *ConditionalAndContext) SetE1(v []IRelationContext) { s.e1 = v } func (s *ConditionalAndContext) AllRelation() []IRelationContext { children := s.GetChildren() len := 0 for _, ctx := range children { if _, ok := ctx.(IRelationContext); ok { len++ } } tst := make([]IRelationContext, len) i := 0 for _, ctx := range children { if t, ok := ctx.(IRelationContext); ok { tst[i] = t.(IRelationContext) i++ } } return tst } func (s *ConditionalAndContext) Relation(i int) IRelationContext { var t antlr.RuleContext j := 0 for _, ctx := range s.GetChildren() { if _, ok := ctx.(IRelationContext); ok { if j == i { t = ctx.(antlr.RuleContext) break } j++ } } if t == nil { return nil } return t.(IRelationContext) } func (s *ConditionalAndContext) AllLOGICAL_AND() []antlr.TerminalNode { return s.GetTokens(CELParserLOGICAL_AND) } func (s *ConditionalAndContext) LOGICAL_AND(i int) antlr.TerminalNode { return s.GetToken(CELParserLOGICAL_AND, i) } func (s *ConditionalAndContext) GetRuleContext() antlr.RuleContext { return s } func (s *ConditionalAndContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { return antlr.TreesStringTree(s, ruleNames, recog) } func (s *ConditionalAndContext) EnterRule(listener antlr.ParseTreeListener) { if listenerT, ok := listener.(CELListener); ok { listenerT.EnterConditionalAnd(s) } } func (s *ConditionalAndContext) ExitRule(listener antlr.ParseTreeListener) { if listenerT, ok := listener.(CELListener); ok { listenerT.ExitConditionalAnd(s) } } func (s *ConditionalAndContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case CELVisitor: return t.VisitConditionalAnd(s) default: return t.VisitChildren(s) } } func (p *CELParser) ConditionalAnd() (localctx IConditionalAndContext) { this := p _ = this localctx = NewConditionalAndContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 6, CELParserRULE_conditionalAnd) var _la int defer func() { p.ExitRule() }() defer func() { if err := recover(); err != nil { if v, ok := err.(antlr.RecognitionException); ok { localctx.SetException(v) p.GetErrorHandler().ReportError(p, v) p.GetErrorHandler().Recover(p, v) } else { panic(err) } } }() p.EnterOuterAlt(localctx, 1) { p.SetState(45) var _x = p.relation(0) localctx.(*ConditionalAndContext).e = _x } p.SetState(50) p.GetErrorHandler().Sync(p) _la = p.GetTokenStream().LA(1) for _la == CELParserLOGICAL_AND { { p.SetState(46) var _m = p.Match(CELParserLOGICAL_AND) localctx.(*ConditionalAndContext).s8 = _m } localctx.(*ConditionalAndContext).ops = append(localctx.(*ConditionalAndContext).ops, localctx.(*ConditionalAndContext).s8) { p.SetState(47) var _x = p.relation(0) localctx.(*ConditionalAndContext)._relation = _x } localctx.(*ConditionalAndContext).e1 = append(localctx.(*ConditionalAndContext).e1, localctx.(*ConditionalAndContext)._relation) p.SetState(52) p.GetErrorHandler().Sync(p) _la = p.GetTokenStream().LA(1) } return localctx } // IRelationContext is an interface to support dynamic dispatch. type IRelationContext interface { antlr.ParserRuleContext // GetParser returns the parser. GetParser() antlr.Parser // GetOp returns the op token. GetOp() antlr.Token // SetOp sets the op token. SetOp(antlr.Token) // IsRelationContext differentiates from other interfaces. IsRelationContext() } type RelationContext struct { *antlr.BaseParserRuleContext parser antlr.Parser op antlr.Token } func NewEmptyRelationContext() *RelationContext { var p = new(RelationContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) p.RuleIndex = CELParserRULE_relation return p } func (*RelationContext) IsRelationContext() {} func NewRelationContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RelationContext { var p = new(RelationContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) p.parser = parser p.RuleIndex = CELParserRULE_relation return p } func (s *RelationContext) GetParser() antlr.Parser { return s.parser } func (s *RelationContext) GetOp() antlr.Token { return s.op } func (s *RelationContext) SetOp(v antlr.Token) { s.op = v } func (s *RelationContext) Calc() ICalcContext { var t antlr.RuleContext for _, ctx := range s.GetChildren() { if _, ok := ctx.(ICalcContext); ok { t = ctx.(antlr.RuleContext) break } } if t == nil { return nil } return t.(ICalcContext) } func (s *RelationContext) AllRelation() []IRelationContext { children := s.GetChildren() len := 0 for _, ctx := range children { if _, ok := ctx.(IRelationContext); ok { len++ } } tst := make([]IRelationContext, len) i := 0 for _, ctx := range children { if t, ok := ctx.(IRelationContext); ok { tst[i] = t.(IRelationContext) i++ } } return tst } func (s *RelationContext) Relation(i int) IRelationContext { var t antlr.RuleContext j := 0 for _, ctx := range s.GetChildren() { if _, ok := ctx.(IRelationContext); ok { if j == i { t = ctx.(antlr.RuleContext) break } j++ } } if t == nil { return nil } return t.(IRelationContext) } func (s *RelationContext) LESS() antlr.TerminalNode { return s.GetToken(CELParserLESS, 0) } func (s *RelationContext) LESS_EQUALS() antlr.TerminalNode { return s.GetToken(CELParserLESS_EQUALS, 0) } func (s *RelationContext) GREATER_EQUALS() antlr.TerminalNode { return s.GetToken(CELParserGREATER_EQUALS, 0) } func (s *RelationContext) GREATER() antlr.TerminalNode { return s.GetToken(CELParserGREATER, 0) } func (s *RelationContext) EQUALS() antlr.TerminalNode { return s.GetToken(CELParserEQUALS, 0) } func (s *RelationContext) NOT_EQUALS() antlr.TerminalNode { return s.GetToken(CELParserNOT_EQUALS, 0) } func (s *RelationContext) IN() antlr.TerminalNode { return s.GetToken(CELParserIN, 0) } func (s *RelationContext) GetRuleContext() antlr.RuleContext { return s } func (s *RelationContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { return antlr.TreesStringTree(s, ruleNames, recog) } func (s *RelationContext) EnterRule(listener antlr.ParseTreeListener) { if listenerT, ok := listener.(CELListener); ok { listenerT.EnterRelation(s) } } func (s *RelationContext) ExitRule(listener antlr.ParseTreeListener) { if listenerT, ok := listener.(CELListener); ok { listenerT.ExitRelation(s) } } func (s *RelationContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case CELVisitor: return t.VisitRelation(s) default: return t.VisitChildren(s) } } func (p *CELParser) Relation() (localctx IRelationContext) { return p.relation(0) } func (p *CELParser) relation(_p int) (localctx IRelationContext) { this := p _ = this var _parentctx antlr.ParserRuleContext = p.GetParserRuleContext() _parentState := p.GetState() localctx = NewRelationContext(p, p.GetParserRuleContext(), _parentState) var _prevctx IRelationContext = localctx var _ antlr.ParserRuleContext = _prevctx // TODO: To prevent unused variable warning. _startState := 8 p.EnterRecursionRule(localctx, 8, CELParserRULE_relation, _p) var _la int defer func() { p.UnrollRecursionContexts(_parentctx) }() defer func() { if err := recover(); err != nil { if v, ok := err.(antlr.RecognitionException); ok { localctx.SetException(v) p.GetErrorHandler().ReportError(p, v) p.GetErrorHandler().Recover(p, v) } else { panic(err) } } }() var _alt int p.EnterOuterAlt(localctx, 1) { p.SetState(54) p.calc(0) } p.GetParserRuleContext().SetStop(p.GetTokenStream().LT(-1)) p.SetState(61) p.GetErrorHandler().Sync(p) _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 3, p.GetParserRuleContext()) for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { if _alt == 1 { if p.GetParseListeners() != nil { p.TriggerExitRuleEvent() } _prevctx = localctx localctx = NewRelationContext(p, _parentctx, _parentState) p.PushNewRecursionContext(localctx, _startState, CELParserRULE_relation) p.SetState(56) if !(p.Precpred(p.GetParserRuleContext(), 1)) { panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 1)", "")) } { p.SetState(57) var _lt = p.GetTokenStream().LT(1) localctx.(*RelationContext).op = _lt _la = p.GetTokenStream().LA(1) if !(((_la)&-(0x1f+1)) == 0 && ((1<