// Code generated from /Users/tswadell/go/src/github.com/google/cel-go/bin/../parser/gen/CEL.g4 by ANTLR 4.9.1. DO NOT EDIT. package gen // CEL import ( "fmt" "reflect" "strconv" "github.com/antlr/antlr4/runtime/Go/antlr" ) // Suppress unused import errors var _ = fmt.Printf var _ = reflect.Copy var _ = strconv.Itoa var parserATN = []uint16{ 3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 38, 211, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 3, 2, 3, 2, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 3, 38, 10, 3, 3, 4, 3, 4, 3, 4, 7, 4, 43, 10, 4, 12, 4, 14, 4, 46, 11, 4, 3, 5, 3, 5, 3, 5, 7, 5, 51, 10, 5, 12, 5, 14, 5, 54, 11, 5, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 7, 6, 62, 10, 6, 12, 6, 14, 6, 65, 11, 6, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 7, 7, 76, 10, 7, 12, 7, 14, 7, 79, 11, 7, 3, 8, 3, 8, 6, 8, 83, 10, 8, 13, 8, 14, 8, 84, 3, 8, 3, 8, 6, 8, 89, 10, 8, 13, 8, 14, 8, 90, 3, 8, 5, 8, 94, 10, 8, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 5, 9, 104, 10, 9, 3, 9, 5, 9, 107, 10, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 5, 9, 117, 10, 9, 3, 9, 5, 9, 120, 10, 9, 3, 9, 7, 9, 123, 10, 9, 12, 9, 14, 9, 126, 11, 9, 3, 10, 5, 10, 129, 10, 10, 3, 10, 3, 10, 3, 10, 5, 10, 134, 10, 10, 3, 10, 5, 10, 137, 10, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 5, 10, 145, 10, 10, 3, 10, 5, 10, 148, 10, 10, 3, 10, 3, 10, 3, 10, 5, 10, 153, 10, 10, 3, 10, 5, 10, 156, 10, 10, 3, 10, 3, 10, 5, 10, 160, 10, 10, 3, 11, 3, 11, 3, 11, 7, 11, 165, 10, 11, 12, 11, 14, 11, 168, 11, 11, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 7, 12, 177, 10, 12, 12, 12, 14, 12, 180, 11, 12, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 7, 13, 190, 10, 13, 12, 13, 14, 13, 193, 11, 13, 3, 14, 5, 14, 196, 10, 14, 3, 14, 3, 14, 3, 14, 5, 14, 201, 10, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 5, 14, 209, 10, 14, 3, 14, 2, 5, 10, 12, 16, 15, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 2, 5, 3, 2, 3, 9, 3, 2, 25, 27, 4, 2, 20, 20, 24, 24, 2, 237, 2, 28, 3, 2, 2, 2, 4, 31, 3, 2, 2, 2, 6, 39, 3, 2, 2, 2, 8, 47, 3, 2, 2, 2, 10, 55, 3, 2, 2, 2, 12, 66, 3, 2, 2, 2, 14, 93, 3, 2, 2, 2, 16, 95, 3, 2, 2, 2, 18, 159, 3, 2, 2, 2, 20, 161, 3, 2, 2, 2, 22, 169, 3, 2, 2, 2, 24, 181, 3, 2, 2, 2, 26, 208, 3, 2, 2, 2, 28, 29, 5, 4, 3, 2, 29, 30, 7, 2, 2, 3, 30, 3, 3, 2, 2, 2, 31, 37, 5, 6, 4, 2, 32, 33, 7, 22, 2, 2, 33, 34, 5, 6, 4, 2, 34, 35, 7, 23, 2, 2, 35, 36, 5, 4, 3, 2, 36, 38, 3, 2, 2, 2, 37, 32, 3, 2, 2, 2, 37, 38, 3, 2, 2, 2, 38, 5, 3, 2, 2, 2, 39, 44, 5, 8, 5, 2, 40, 41, 7, 11, 2, 2, 41, 43, 5, 8, 5, 2, 42, 40, 3, 2, 2, 2, 43, 46, 3, 2, 2, 2, 44, 42, 3, 2, 2, 2, 44, 45, 3, 2, 2, 2, 45, 7, 3, 2, 2, 2, 46, 44, 3, 2, 2, 2, 47, 52, 5, 10, 6, 2, 48, 49, 7, 10, 2, 2, 49, 51, 5, 10, 6, 2, 50, 48, 3, 2, 2, 2, 51, 54, 3, 2, 2, 2, 52, 50, 3, 2, 2, 2, 52, 53, 3, 2, 2, 2, 53, 9, 3, 2, 2, 2, 54, 52, 3, 2, 2, 2, 55, 56, 8, 6, 1, 2, 56, 57, 5, 12, 7, 2, 57, 63, 3, 2, 2, 2, 58, 59, 12, 3, 2, 2, 59, 60, 9, 2, 2, 2, 60, 62, 5, 10, 6, 4, 61, 58, 3, 2, 2, 2, 62, 65, 3, 2, 2, 2, 63, 61, 3, 2, 2, 2, 63, 64, 3, 2, 2, 2, 64, 11, 3, 2, 2, 2, 65, 63, 3, 2, 2, 2, 66, 67, 8, 7, 1, 2, 67, 68, 5, 14, 8, 2, 68, 77, 3, 2, 2, 2, 69, 70, 12, 4, 2, 2, 70, 71, 9, 3, 2, 2, 71, 76, 5, 12, 7, 5, 72, 73, 12, 3, 2, 2, 73, 74, 9, 4, 2, 2, 74, 76, 5, 12, 7, 4, 75, 69, 3, 2, 2, 2, 75, 72, 3, 2, 2, 2, 76, 79, 3, 2, 2, 2, 77, 75, 3, 2, 2, 2, 77, 78, 3, 2, 2, 2, 78, 13, 3, 2, 2, 2, 79, 77, 3, 2, 2, 2, 80, 94, 5, 16, 9, 2, 81, 83, 7, 21, 2, 2, 82, 81, 3, 2, 2, 2, 83, 84, 3, 2, 2, 2, 84, 82, 3, 2, 2, 2, 84, 85, 3, 2, 2, 2, 85, 86, 3, 2, 2, 2, 86, 94, 5, 16, 9, 2, 87, 89, 7, 20, 2, 2, 88, 87, 3, 2, 2, 2, 89, 90, 3, 2, 2, 2, 90, 88, 3, 2, 2, 2, 90, 91, 3, 2, 2, 2, 91, 92, 3, 2, 2, 2, 92, 94, 5, 16, 9, 2, 93, 80, 3, 2, 2, 2, 93, 82, 3, 2, 2, 2, 93, 88, 3, 2, 2, 2, 94, 15, 3, 2, 2, 2, 95, 96, 8, 9, 1, 2, 96, 97, 5, 18, 10, 2, 97, 124, 3, 2, 2, 2, 98, 99, 12, 5, 2, 2, 99, 100, 7, 18, 2, 2, 100, 106, 7, 38, 2, 2, 101, 103, 7, 16, 2, 2, 102, 104, 5, 20, 11, 2, 103, 102, 3, 2, 2, 2, 103, 104, 3, 2, 2, 2, 104, 105, 3, 2, 2, 2, 105, 107, 7, 17, 2, 2, 106, 101, 3, 2, 2, 2, 106, 107, 3, 2, 2, 2, 107, 123, 3, 2, 2, 2, 108, 109, 12, 4, 2, 2, 109, 110, 7, 12, 2, 2, 110, 111, 5, 4, 3, 2, 111, 112, 7, 13, 2, 2, 112, 123, 3, 2, 2, 2, 113, 114, 12, 3, 2, 2, 114, 116, 7, 14, 2, 2, 115, 117, 5, 22, 12, 2, 116, 115, 3, 2, 2, 2, 116, 117, 3, 2, 2, 2, 117, 119, 3, 2, 2, 2, 118, 120, 7, 19, 2, 2, 119, 118, 3, 2, 2, 2, 119, 120, 3, 2, 2, 2, 120, 121, 3, 2, 2, 2, 121, 123, 7, 15, 2, 2, 122, 98, 3, 2, 2, 2, 122, 108, 3, 2, 2, 2, 122, 113, 3, 2, 2, 2, 123, 126, 3, 2, 2, 2, 124, 122, 3, 2, 2, 2, 124, 125, 3, 2, 2, 2, 125, 17, 3, 2, 2, 2, 126, 124, 3, 2, 2, 2, 127, 129, 7, 18, 2, 2, 128, 127, 3, 2, 2, 2, 128, 129, 3, 2, 2, 2, 129, 130, 3, 2, 2, 2, 130, 136, 7, 38, 2, 2, 131, 133, 7, 16, 2, 2, 132, 134, 5, 20, 11, 2, 133, 132, 3, 2, 2, 2, 133, 134, 3, 2, 2, 2, 134, 135, 3, 2, 2, 2, 135, 137, 7, 17, 2, 2, 136, 131, 3, 2, 2, 2, 136, 137, 3, 2, 2, 2, 137, 160, 3, 2, 2, 2, 138, 139, 7, 16, 2, 2, 139, 140, 5, 4, 3, 2, 140, 141, 7, 17, 2, 2, 141, 160, 3, 2, 2, 2, 142, 144, 7, 12, 2, 2, 143, 145, 5, 20, 11, 2, 144, 143, 3, 2, 2, 2, 144, 145, 3, 2, 2, 2, 145, 147, 3, 2, 2, 2, 146, 148, 7, 19, 2, 2, 147, 146, 3, 2, 2, 2, 147, 148, 3, 2, 2, 2, 148, 149, 3, 2, 2, 2, 149, 160, 7, 13, 2, 2, 150, 152, 7, 14, 2, 2, 151, 153, 5, 24, 13, 2, 152, 151, 3, 2, 2, 2, 152, 153, 3, 2, 2, 2, 153, 155, 3, 2, 2, 2, 154, 156, 7, 19, 2, 2, 155, 154, 3, 2, 2, 2, 155, 156, 3, 2, 2, 2, 156, 157, 3, 2, 2, 2, 157, 160, 7, 15, 2, 2, 158, 160, 5, 26, 14, 2, 159, 128, 3, 2, 2, 2, 159, 138, 3, 2, 2, 2, 159, 142, 3, 2, 2, 2, 159, 150, 3, 2, 2, 2, 159, 158, 3, 2, 2, 2, 160, 19, 3, 2, 2, 2, 161, 166, 5, 4, 3, 2, 162, 163, 7, 19, 2, 2, 163, 165, 5, 4, 3, 2, 164, 162, 3, 2, 2, 2, 165, 168, 3, 2, 2, 2, 166, 164, 3, 2, 2, 2, 166, 167, 3, 2, 2, 2, 167, 21, 3, 2, 2, 2, 168, 166, 3, 2, 2, 2, 169, 170, 7, 38, 2, 2, 170, 171, 7, 23, 2, 2, 171, 178, 5, 4, 3, 2, 172, 173, 7, 19, 2, 2, 173, 174, 7, 38, 2, 2, 174, 175, 7, 23, 2, 2, 175, 177, 5, 4, 3, 2, 176, 172, 3, 2, 2, 2, 177, 180, 3, 2, 2, 2, 178, 176, 3, 2, 2, 2, 178, 179, 3, 2, 2, 2, 179, 23, 3, 2, 2, 2, 180, 178, 3, 2, 2, 2, 181, 182, 5, 4, 3, 2, 182, 183, 7, 23, 2, 2, 183, 191, 5, 4, 3, 2, 184, 185, 7, 19, 2, 2, 185, 186, 5, 4, 3, 2, 186, 187, 7, 23, 2, 2, 187, 188, 5, 4, 3, 2, 188, 190, 3, 2, 2, 2, 189, 184, 3, 2, 2, 2, 190, 193, 3, 2, 2, 2, 191, 189, 3, 2, 2, 2, 191, 192, 3, 2, 2, 2, 192, 25, 3, 2, 2, 2, 193, 191, 3, 2, 2, 2, 194, 196, 7, 20, 2, 2, 195, 194, 3, 2, 2, 2, 195, 196, 3, 2, 2, 2, 196, 197, 3, 2, 2, 2, 197, 209, 7, 34, 2, 2, 198, 209, 7, 35, 2, 2, 199, 201, 7, 20, 2, 2, 200, 199, 3, 2, 2, 2, 200, 201, 3, 2, 2, 2, 201, 202, 3, 2, 2, 2, 202, 209, 7, 33, 2, 2, 203, 209, 7, 36, 2, 2, 204, 209, 7, 37, 2, 2, 205, 209, 7, 28, 2, 2, 206, 209, 7, 29, 2, 2, 207, 209, 7, 30, 2, 2, 208, 195, 3, 2, 2, 2, 208, 198, 3, 2, 2, 2, 208, 200, 3, 2, 2, 2, 208, 203, 3, 2, 2, 2, 208, 204, 3, 2, 2, 2, 208, 205, 3, 2, 2, 2, 208, 206, 3, 2, 2, 2, 208, 207, 3, 2, 2, 2, 209, 27, 3, 2, 2, 2, 31, 37, 44, 52, 63, 75, 77, 84, 90, 93, 103, 106, 116, 119, 122, 124, 128, 133, 136, 144, 147, 152, 155, 159, 166, 178, 191, 195, 200, 208, } var literalNames = []string{ "", "'=='", "'!='", "'in'", "'<'", "'<='", "'>='", "'>'", "'&&'", "'||'", "'['", "']'", "'{'", "'}'", "'('", "')'", "'.'", "','", "'-'", "'!'", "'?'", "':'", "'+'", "'*'", "'/'", "'%'", "'true'", "'false'", "'null'", } var 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", } var ruleNames = []string{ "start", "expr", "conditionalOr", "conditionalAnd", "relation", "calc", "unary", "member", "primary", "exprList", "fieldInitializerList", "mapInitializerList", "literal", } type CELParser struct { *antlr.BaseParser } // NewCELParser produces a new parser instance for the optional input antlr.TokenStream. // // The *CELParser instance produced may be reused by calling the SetInputStream method. // The initial parser configuration is expensive to construct, and the object is not thread-safe; // however, if used within a Golang sync.Pool, the construction cost amortizes well and the // objects can be used in a thread-safe manner. func NewCELParser(input antlr.TokenStream) *CELParser { this := new(CELParser) deserializer := antlr.NewATNDeserializer(nil) deserializedATN := deserializer.DeserializeFromUInt16(parserATN) decisionToDFA := make([]*antlr.DFA, len(deserializedATN.DecisionToState)) for index, ds := range deserializedATN.DecisionToState { decisionToDFA[index] = antlr.NewDFA(ds, index) } this.BaseParser = antlr.NewBaseParser(input) this.Interpreter = antlr.NewParserATNSimulator(this, deserializedATN, decisionToDFA, antlr.NewPredictionContextCache()) this.RuleNames = ruleNames this.LiteralNames = literalNames this.SymbolicNames = 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 = s.GetTypedRuleContext(reflect.TypeOf((*IExprContext)(nil)).Elem(), 0) 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) { 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 { var ts = s.GetTypedRuleContexts(reflect.TypeOf((*IConditionalOrContext)(nil)).Elem()) var tst = make([]IConditionalOrContext, len(ts)) for i, t := range ts { if t != nil { tst[i] = t.(IConditionalOrContext) } } return tst } func (s *ExprContext) ConditionalOr(i int) IConditionalOrContext { var t = s.GetTypedRuleContext(reflect.TypeOf((*IConditionalOrContext)(nil)).Elem(), i) 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 = s.GetTypedRuleContext(reflect.TypeOf((*IExprContext)(nil)).Elem(), 0) 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) { 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 { var ts = s.GetTypedRuleContexts(reflect.TypeOf((*IConditionalAndContext)(nil)).Elem()) var tst = make([]IConditionalAndContext, len(ts)) for i, t := range ts { if t != nil { tst[i] = t.(IConditionalAndContext) } } return tst } func (s *ConditionalOrContext) ConditionalAnd(i int) IConditionalAndContext { var t = s.GetTypedRuleContext(reflect.TypeOf((*IConditionalAndContext)(nil)).Elem(), i) 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) { 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 { var ts = s.GetTypedRuleContexts(reflect.TypeOf((*IRelationContext)(nil)).Elem()) var tst = make([]IRelationContext, len(ts)) for i, t := range ts { if t != nil { tst[i] = t.(IRelationContext) } } return tst } func (s *ConditionalAndContext) Relation(i int) IRelationContext { var t = s.GetTypedRuleContext(reflect.TypeOf((*IRelationContext)(nil)).Elem(), i) 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) { 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 = s.GetTypedRuleContext(reflect.TypeOf((*ICalcContext)(nil)).Elem(), 0) if t == nil { return nil } return t.(ICalcContext) } func (s *RelationContext) AllRelation() []IRelationContext { var ts = s.GetTypedRuleContexts(reflect.TypeOf((*IRelationContext)(nil)).Elem()) var tst = make([]IRelationContext, len(ts)) for i, t := range ts { if t != nil { tst[i] = t.(IRelationContext) } } return tst } func (s *RelationContext) Relation(i int) IRelationContext { var t = s.GetTypedRuleContext(reflect.TypeOf((*IRelationContext)(nil)).Elem(), i) 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) { 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<