kubernetes/vendor/github.com/google/cel-go/parser/gen/cel_parser.go
2022-07-11 08:40:34 -07:00

4651 lines
112 KiB
Go

// 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<<uint(_la))&((1<<CELParserEQUALS)|(1<<CELParserNOT_EQUALS)|(1<<CELParserIN)|(1<<CELParserLESS)|(1<<CELParserLESS_EQUALS)|(1<<CELParserGREATER_EQUALS)|(1<<CELParserGREATER))) != 0) {
var _ri = p.GetErrorHandler().RecoverInline(p)
localctx.(*RelationContext).op = _ri
} else {
p.GetErrorHandler().ReportMatch(p)
p.Consume()
}
}
{
p.SetState(58)
p.relation(2)
}
}
p.SetState(63)
p.GetErrorHandler().Sync(p)
_alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 3, p.GetParserRuleContext())
}
return localctx
}
// ICalcContext is an interface to support dynamic dispatch.
type ICalcContext 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)
// IsCalcContext differentiates from other interfaces.
IsCalcContext()
}
type CalcContext struct {
*antlr.BaseParserRuleContext
parser antlr.Parser
op antlr.Token
}
func NewEmptyCalcContext() *CalcContext {
var p = new(CalcContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
p.RuleIndex = CELParserRULE_calc
return p
}
func (*CalcContext) IsCalcContext() {}
func NewCalcContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CalcContext {
var p = new(CalcContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
p.parser = parser
p.RuleIndex = CELParserRULE_calc
return p
}
func (s *CalcContext) GetParser() antlr.Parser { return s.parser }
func (s *CalcContext) GetOp() antlr.Token { return s.op }
func (s *CalcContext) SetOp(v antlr.Token) { s.op = v }
func (s *CalcContext) Unary() IUnaryContext {
var t antlr.RuleContext
for _, ctx := range s.GetChildren() {
if _, ok := ctx.(IUnaryContext); ok {
t = ctx.(antlr.RuleContext)
break
}
}
if t == nil {
return nil
}
return t.(IUnaryContext)
}
func (s *CalcContext) AllCalc() []ICalcContext {
children := s.GetChildren()
len := 0
for _, ctx := range children {
if _, ok := ctx.(ICalcContext); ok {
len++
}
}
tst := make([]ICalcContext, len)
i := 0
for _, ctx := range children {
if t, ok := ctx.(ICalcContext); ok {
tst[i] = t.(ICalcContext)
i++
}
}
return tst
}
func (s *CalcContext) Calc(i int) ICalcContext {
var t antlr.RuleContext
j := 0
for _, ctx := range s.GetChildren() {
if _, ok := ctx.(ICalcContext); ok {
if j == i {
t = ctx.(antlr.RuleContext)
break
}
j++
}
}
if t == nil {
return nil
}
return t.(ICalcContext)
}
func (s *CalcContext) STAR() antlr.TerminalNode {
return s.GetToken(CELParserSTAR, 0)
}
func (s *CalcContext) SLASH() antlr.TerminalNode {
return s.GetToken(CELParserSLASH, 0)
}
func (s *CalcContext) PERCENT() antlr.TerminalNode {
return s.GetToken(CELParserPERCENT, 0)
}
func (s *CalcContext) PLUS() antlr.TerminalNode {
return s.GetToken(CELParserPLUS, 0)
}
func (s *CalcContext) MINUS() antlr.TerminalNode {
return s.GetToken(CELParserMINUS, 0)
}
func (s *CalcContext) GetRuleContext() antlr.RuleContext {
return s
}
func (s *CalcContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
return antlr.TreesStringTree(s, ruleNames, recog)
}
func (s *CalcContext) EnterRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.EnterCalc(s)
}
}
func (s *CalcContext) ExitRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.ExitCalc(s)
}
}
func (s *CalcContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
switch t := visitor.(type) {
case CELVisitor:
return t.VisitCalc(s)
default:
return t.VisitChildren(s)
}
}
func (p *CELParser) Calc() (localctx ICalcContext) {
return p.calc(0)
}
func (p *CELParser) calc(_p int) (localctx ICalcContext) {
this := p
_ = this
var _parentctx antlr.ParserRuleContext = p.GetParserRuleContext()
_parentState := p.GetState()
localctx = NewCalcContext(p, p.GetParserRuleContext(), _parentState)
var _prevctx ICalcContext = localctx
var _ antlr.ParserRuleContext = _prevctx // TODO: To prevent unused variable warning.
_startState := 10
p.EnterRecursionRule(localctx, 10, CELParserRULE_calc, _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(65)
p.Unary()
}
p.GetParserRuleContext().SetStop(p.GetTokenStream().LT(-1))
p.SetState(75)
p.GetErrorHandler().Sync(p)
_alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 5, p.GetParserRuleContext())
for _alt != 2 && _alt != antlr.ATNInvalidAltNumber {
if _alt == 1 {
if p.GetParseListeners() != nil {
p.TriggerExitRuleEvent()
}
_prevctx = localctx
p.SetState(73)
p.GetErrorHandler().Sync(p)
switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 4, p.GetParserRuleContext()) {
case 1:
localctx = NewCalcContext(p, _parentctx, _parentState)
p.PushNewRecursionContext(localctx, _startState, CELParserRULE_calc)
p.SetState(67)
if !(p.Precpred(p.GetParserRuleContext(), 2)) {
panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 2)", ""))
}
{
p.SetState(68)
var _lt = p.GetTokenStream().LT(1)
localctx.(*CalcContext).op = _lt
_la = p.GetTokenStream().LA(1)
if !(((_la)&-(0x1f+1)) == 0 && ((1<<uint(_la))&((1<<CELParserSTAR)|(1<<CELParserSLASH)|(1<<CELParserPERCENT))) != 0) {
var _ri = p.GetErrorHandler().RecoverInline(p)
localctx.(*CalcContext).op = _ri
} else {
p.GetErrorHandler().ReportMatch(p)
p.Consume()
}
}
{
p.SetState(69)
p.calc(3)
}
case 2:
localctx = NewCalcContext(p, _parentctx, _parentState)
p.PushNewRecursionContext(localctx, _startState, CELParserRULE_calc)
p.SetState(70)
if !(p.Precpred(p.GetParserRuleContext(), 1)) {
panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 1)", ""))
}
{
p.SetState(71)
var _lt = p.GetTokenStream().LT(1)
localctx.(*CalcContext).op = _lt
_la = p.GetTokenStream().LA(1)
if !(_la == CELParserMINUS || _la == CELParserPLUS) {
var _ri = p.GetErrorHandler().RecoverInline(p)
localctx.(*CalcContext).op = _ri
} else {
p.GetErrorHandler().ReportMatch(p)
p.Consume()
}
}
{
p.SetState(72)
p.calc(2)
}
}
}
p.SetState(77)
p.GetErrorHandler().Sync(p)
_alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 5, p.GetParserRuleContext())
}
return localctx
}
// IUnaryContext is an interface to support dynamic dispatch.
type IUnaryContext interface {
antlr.ParserRuleContext
// GetParser returns the parser.
GetParser() antlr.Parser
// IsUnaryContext differentiates from other interfaces.
IsUnaryContext()
}
type UnaryContext struct {
*antlr.BaseParserRuleContext
parser antlr.Parser
}
func NewEmptyUnaryContext() *UnaryContext {
var p = new(UnaryContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
p.RuleIndex = CELParserRULE_unary
return p
}
func (*UnaryContext) IsUnaryContext() {}
func NewUnaryContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *UnaryContext {
var p = new(UnaryContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
p.parser = parser
p.RuleIndex = CELParserRULE_unary
return p
}
func (s *UnaryContext) GetParser() antlr.Parser { return s.parser }
func (s *UnaryContext) CopyFrom(ctx *UnaryContext) {
s.BaseParserRuleContext.CopyFrom(ctx.BaseParserRuleContext)
}
func (s *UnaryContext) GetRuleContext() antlr.RuleContext {
return s
}
func (s *UnaryContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
return antlr.TreesStringTree(s, ruleNames, recog)
}
type LogicalNotContext struct {
*UnaryContext
s19 antlr.Token
ops []antlr.Token
}
func NewLogicalNotContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *LogicalNotContext {
var p = new(LogicalNotContext)
p.UnaryContext = NewEmptyUnaryContext()
p.parser = parser
p.CopyFrom(ctx.(*UnaryContext))
return p
}
func (s *LogicalNotContext) GetS19() antlr.Token { return s.s19 }
func (s *LogicalNotContext) SetS19(v antlr.Token) { s.s19 = v }
func (s *LogicalNotContext) GetOps() []antlr.Token { return s.ops }
func (s *LogicalNotContext) SetOps(v []antlr.Token) { s.ops = v }
func (s *LogicalNotContext) GetRuleContext() antlr.RuleContext {
return s
}
func (s *LogicalNotContext) Member() IMemberContext {
var t antlr.RuleContext
for _, ctx := range s.GetChildren() {
if _, ok := ctx.(IMemberContext); ok {
t = ctx.(antlr.RuleContext)
break
}
}
if t == nil {
return nil
}
return t.(IMemberContext)
}
func (s *LogicalNotContext) AllEXCLAM() []antlr.TerminalNode {
return s.GetTokens(CELParserEXCLAM)
}
func (s *LogicalNotContext) EXCLAM(i int) antlr.TerminalNode {
return s.GetToken(CELParserEXCLAM, i)
}
func (s *LogicalNotContext) EnterRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.EnterLogicalNot(s)
}
}
func (s *LogicalNotContext) ExitRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.ExitLogicalNot(s)
}
}
func (s *LogicalNotContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
switch t := visitor.(type) {
case CELVisitor:
return t.VisitLogicalNot(s)
default:
return t.VisitChildren(s)
}
}
type MemberExprContext struct {
*UnaryContext
}
func NewMemberExprContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *MemberExprContext {
var p = new(MemberExprContext)
p.UnaryContext = NewEmptyUnaryContext()
p.parser = parser
p.CopyFrom(ctx.(*UnaryContext))
return p
}
func (s *MemberExprContext) GetRuleContext() antlr.RuleContext {
return s
}
func (s *MemberExprContext) Member() IMemberContext {
var t antlr.RuleContext
for _, ctx := range s.GetChildren() {
if _, ok := ctx.(IMemberContext); ok {
t = ctx.(antlr.RuleContext)
break
}
}
if t == nil {
return nil
}
return t.(IMemberContext)
}
func (s *MemberExprContext) EnterRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.EnterMemberExpr(s)
}
}
func (s *MemberExprContext) ExitRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.ExitMemberExpr(s)
}
}
func (s *MemberExprContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
switch t := visitor.(type) {
case CELVisitor:
return t.VisitMemberExpr(s)
default:
return t.VisitChildren(s)
}
}
type NegateContext struct {
*UnaryContext
s18 antlr.Token
ops []antlr.Token
}
func NewNegateContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *NegateContext {
var p = new(NegateContext)
p.UnaryContext = NewEmptyUnaryContext()
p.parser = parser
p.CopyFrom(ctx.(*UnaryContext))
return p
}
func (s *NegateContext) GetS18() antlr.Token { return s.s18 }
func (s *NegateContext) SetS18(v antlr.Token) { s.s18 = v }
func (s *NegateContext) GetOps() []antlr.Token { return s.ops }
func (s *NegateContext) SetOps(v []antlr.Token) { s.ops = v }
func (s *NegateContext) GetRuleContext() antlr.RuleContext {
return s
}
func (s *NegateContext) Member() IMemberContext {
var t antlr.RuleContext
for _, ctx := range s.GetChildren() {
if _, ok := ctx.(IMemberContext); ok {
t = ctx.(antlr.RuleContext)
break
}
}
if t == nil {
return nil
}
return t.(IMemberContext)
}
func (s *NegateContext) AllMINUS() []antlr.TerminalNode {
return s.GetTokens(CELParserMINUS)
}
func (s *NegateContext) MINUS(i int) antlr.TerminalNode {
return s.GetToken(CELParserMINUS, i)
}
func (s *NegateContext) EnterRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.EnterNegate(s)
}
}
func (s *NegateContext) ExitRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.ExitNegate(s)
}
}
func (s *NegateContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
switch t := visitor.(type) {
case CELVisitor:
return t.VisitNegate(s)
default:
return t.VisitChildren(s)
}
}
func (p *CELParser) Unary() (localctx IUnaryContext) {
this := p
_ = this
localctx = NewUnaryContext(p, p.GetParserRuleContext(), p.GetState())
p.EnterRule(localctx, 12, CELParserRULE_unary)
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)
}
}
}()
var _alt int
p.SetState(91)
p.GetErrorHandler().Sync(p)
switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 8, p.GetParserRuleContext()) {
case 1:
localctx = NewMemberExprContext(p, localctx)
p.EnterOuterAlt(localctx, 1)
{
p.SetState(78)
p.member(0)
}
case 2:
localctx = NewLogicalNotContext(p, localctx)
p.EnterOuterAlt(localctx, 2)
p.SetState(80)
p.GetErrorHandler().Sync(p)
_la = p.GetTokenStream().LA(1)
for ok := true; ok; ok = _la == CELParserEXCLAM {
{
p.SetState(79)
var _m = p.Match(CELParserEXCLAM)
localctx.(*LogicalNotContext).s19 = _m
}
localctx.(*LogicalNotContext).ops = append(localctx.(*LogicalNotContext).ops, localctx.(*LogicalNotContext).s19)
p.SetState(82)
p.GetErrorHandler().Sync(p)
_la = p.GetTokenStream().LA(1)
}
{
p.SetState(84)
p.member(0)
}
case 3:
localctx = NewNegateContext(p, localctx)
p.EnterOuterAlt(localctx, 3)
p.SetState(86)
p.GetErrorHandler().Sync(p)
_alt = 1
for ok := true; ok; ok = _alt != 2 && _alt != antlr.ATNInvalidAltNumber {
switch _alt {
case 1:
{
p.SetState(85)
var _m = p.Match(CELParserMINUS)
localctx.(*NegateContext).s18 = _m
}
localctx.(*NegateContext).ops = append(localctx.(*NegateContext).ops, localctx.(*NegateContext).s18)
default:
panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil))
}
p.SetState(88)
p.GetErrorHandler().Sync(p)
_alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 7, p.GetParserRuleContext())
}
{
p.SetState(90)
p.member(0)
}
}
return localctx
}
// IMemberContext is an interface to support dynamic dispatch.
type IMemberContext interface {
antlr.ParserRuleContext
// GetParser returns the parser.
GetParser() antlr.Parser
// IsMemberContext differentiates from other interfaces.
IsMemberContext()
}
type MemberContext struct {
*antlr.BaseParserRuleContext
parser antlr.Parser
}
func NewEmptyMemberContext() *MemberContext {
var p = new(MemberContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
p.RuleIndex = CELParserRULE_member
return p
}
func (*MemberContext) IsMemberContext() {}
func NewMemberContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *MemberContext {
var p = new(MemberContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
p.parser = parser
p.RuleIndex = CELParserRULE_member
return p
}
func (s *MemberContext) GetParser() antlr.Parser { return s.parser }
func (s *MemberContext) CopyFrom(ctx *MemberContext) {
s.BaseParserRuleContext.CopyFrom(ctx.BaseParserRuleContext)
}
func (s *MemberContext) GetRuleContext() antlr.RuleContext {
return s
}
func (s *MemberContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
return antlr.TreesStringTree(s, ruleNames, recog)
}
type SelectOrCallContext struct {
*MemberContext
op antlr.Token
id antlr.Token
open antlr.Token
args IExprListContext
}
func NewSelectOrCallContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *SelectOrCallContext {
var p = new(SelectOrCallContext)
p.MemberContext = NewEmptyMemberContext()
p.parser = parser
p.CopyFrom(ctx.(*MemberContext))
return p
}
func (s *SelectOrCallContext) GetOp() antlr.Token { return s.op }
func (s *SelectOrCallContext) GetId() antlr.Token { return s.id }
func (s *SelectOrCallContext) GetOpen() antlr.Token { return s.open }
func (s *SelectOrCallContext) SetOp(v antlr.Token) { s.op = v }
func (s *SelectOrCallContext) SetId(v antlr.Token) { s.id = v }
func (s *SelectOrCallContext) SetOpen(v antlr.Token) { s.open = v }
func (s *SelectOrCallContext) GetArgs() IExprListContext { return s.args }
func (s *SelectOrCallContext) SetArgs(v IExprListContext) { s.args = v }
func (s *SelectOrCallContext) GetRuleContext() antlr.RuleContext {
return s
}
func (s *SelectOrCallContext) Member() IMemberContext {
var t antlr.RuleContext
for _, ctx := range s.GetChildren() {
if _, ok := ctx.(IMemberContext); ok {
t = ctx.(antlr.RuleContext)
break
}
}
if t == nil {
return nil
}
return t.(IMemberContext)
}
func (s *SelectOrCallContext) DOT() antlr.TerminalNode {
return s.GetToken(CELParserDOT, 0)
}
func (s *SelectOrCallContext) IDENTIFIER() antlr.TerminalNode {
return s.GetToken(CELParserIDENTIFIER, 0)
}
func (s *SelectOrCallContext) RPAREN() antlr.TerminalNode {
return s.GetToken(CELParserRPAREN, 0)
}
func (s *SelectOrCallContext) LPAREN() antlr.TerminalNode {
return s.GetToken(CELParserLPAREN, 0)
}
func (s *SelectOrCallContext) ExprList() IExprListContext {
var t antlr.RuleContext
for _, ctx := range s.GetChildren() {
if _, ok := ctx.(IExprListContext); ok {
t = ctx.(antlr.RuleContext)
break
}
}
if t == nil {
return nil
}
return t.(IExprListContext)
}
func (s *SelectOrCallContext) EnterRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.EnterSelectOrCall(s)
}
}
func (s *SelectOrCallContext) ExitRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.ExitSelectOrCall(s)
}
}
func (s *SelectOrCallContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
switch t := visitor.(type) {
case CELVisitor:
return t.VisitSelectOrCall(s)
default:
return t.VisitChildren(s)
}
}
type PrimaryExprContext struct {
*MemberContext
}
func NewPrimaryExprContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *PrimaryExprContext {
var p = new(PrimaryExprContext)
p.MemberContext = NewEmptyMemberContext()
p.parser = parser
p.CopyFrom(ctx.(*MemberContext))
return p
}
func (s *PrimaryExprContext) GetRuleContext() antlr.RuleContext {
return s
}
func (s *PrimaryExprContext) Primary() IPrimaryContext {
var t antlr.RuleContext
for _, ctx := range s.GetChildren() {
if _, ok := ctx.(IPrimaryContext); ok {
t = ctx.(antlr.RuleContext)
break
}
}
if t == nil {
return nil
}
return t.(IPrimaryContext)
}
func (s *PrimaryExprContext) EnterRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.EnterPrimaryExpr(s)
}
}
func (s *PrimaryExprContext) ExitRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.ExitPrimaryExpr(s)
}
}
func (s *PrimaryExprContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
switch t := visitor.(type) {
case CELVisitor:
return t.VisitPrimaryExpr(s)
default:
return t.VisitChildren(s)
}
}
type IndexContext struct {
*MemberContext
op antlr.Token
index IExprContext
}
func NewIndexContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *IndexContext {
var p = new(IndexContext)
p.MemberContext = NewEmptyMemberContext()
p.parser = parser
p.CopyFrom(ctx.(*MemberContext))
return p
}
func (s *IndexContext) GetOp() antlr.Token { return s.op }
func (s *IndexContext) SetOp(v antlr.Token) { s.op = v }
func (s *IndexContext) GetIndex() IExprContext { return s.index }
func (s *IndexContext) SetIndex(v IExprContext) { s.index = v }
func (s *IndexContext) GetRuleContext() antlr.RuleContext {
return s
}
func (s *IndexContext) Member() IMemberContext {
var t antlr.RuleContext
for _, ctx := range s.GetChildren() {
if _, ok := ctx.(IMemberContext); ok {
t = ctx.(antlr.RuleContext)
break
}
}
if t == nil {
return nil
}
return t.(IMemberContext)
}
func (s *IndexContext) RPRACKET() antlr.TerminalNode {
return s.GetToken(CELParserRPRACKET, 0)
}
func (s *IndexContext) LBRACKET() antlr.TerminalNode {
return s.GetToken(CELParserLBRACKET, 0)
}
func (s *IndexContext) 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 *IndexContext) EnterRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.EnterIndex(s)
}
}
func (s *IndexContext) ExitRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.ExitIndex(s)
}
}
func (s *IndexContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
switch t := visitor.(type) {
case CELVisitor:
return t.VisitIndex(s)
default:
return t.VisitChildren(s)
}
}
type CreateMessageContext struct {
*MemberContext
op antlr.Token
entries IFieldInitializerListContext
}
func NewCreateMessageContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *CreateMessageContext {
var p = new(CreateMessageContext)
p.MemberContext = NewEmptyMemberContext()
p.parser = parser
p.CopyFrom(ctx.(*MemberContext))
return p
}
func (s *CreateMessageContext) GetOp() antlr.Token { return s.op }
func (s *CreateMessageContext) SetOp(v antlr.Token) { s.op = v }
func (s *CreateMessageContext) GetEntries() IFieldInitializerListContext { return s.entries }
func (s *CreateMessageContext) SetEntries(v IFieldInitializerListContext) { s.entries = v }
func (s *CreateMessageContext) GetRuleContext() antlr.RuleContext {
return s
}
func (s *CreateMessageContext) Member() IMemberContext {
var t antlr.RuleContext
for _, ctx := range s.GetChildren() {
if _, ok := ctx.(IMemberContext); ok {
t = ctx.(antlr.RuleContext)
break
}
}
if t == nil {
return nil
}
return t.(IMemberContext)
}
func (s *CreateMessageContext) RBRACE() antlr.TerminalNode {
return s.GetToken(CELParserRBRACE, 0)
}
func (s *CreateMessageContext) LBRACE() antlr.TerminalNode {
return s.GetToken(CELParserLBRACE, 0)
}
func (s *CreateMessageContext) COMMA() antlr.TerminalNode {
return s.GetToken(CELParserCOMMA, 0)
}
func (s *CreateMessageContext) FieldInitializerList() IFieldInitializerListContext {
var t antlr.RuleContext
for _, ctx := range s.GetChildren() {
if _, ok := ctx.(IFieldInitializerListContext); ok {
t = ctx.(antlr.RuleContext)
break
}
}
if t == nil {
return nil
}
return t.(IFieldInitializerListContext)
}
func (s *CreateMessageContext) EnterRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.EnterCreateMessage(s)
}
}
func (s *CreateMessageContext) ExitRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.ExitCreateMessage(s)
}
}
func (s *CreateMessageContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
switch t := visitor.(type) {
case CELVisitor:
return t.VisitCreateMessage(s)
default:
return t.VisitChildren(s)
}
}
func (p *CELParser) Member() (localctx IMemberContext) {
return p.member(0)
}
func (p *CELParser) member(_p int) (localctx IMemberContext) {
this := p
_ = this
var _parentctx antlr.ParserRuleContext = p.GetParserRuleContext()
_parentState := p.GetState()
localctx = NewMemberContext(p, p.GetParserRuleContext(), _parentState)
var _prevctx IMemberContext = localctx
var _ antlr.ParserRuleContext = _prevctx // TODO: To prevent unused variable warning.
_startState := 14
p.EnterRecursionRule(localctx, 14, CELParserRULE_member, _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)
localctx = NewPrimaryExprContext(p, localctx)
p.SetParserRuleContext(localctx)
_prevctx = localctx
{
p.SetState(94)
p.Primary()
}
p.GetParserRuleContext().SetStop(p.GetTokenStream().LT(-1))
p.SetState(122)
p.GetErrorHandler().Sync(p)
_alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 14, p.GetParserRuleContext())
for _alt != 2 && _alt != antlr.ATNInvalidAltNumber {
if _alt == 1 {
if p.GetParseListeners() != nil {
p.TriggerExitRuleEvent()
}
_prevctx = localctx
p.SetState(120)
p.GetErrorHandler().Sync(p)
switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 13, p.GetParserRuleContext()) {
case 1:
localctx = NewSelectOrCallContext(p, NewMemberContext(p, _parentctx, _parentState))
p.PushNewRecursionContext(localctx, _startState, CELParserRULE_member)
p.SetState(96)
if !(p.Precpred(p.GetParserRuleContext(), 3)) {
panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 3)", ""))
}
{
p.SetState(97)
var _m = p.Match(CELParserDOT)
localctx.(*SelectOrCallContext).op = _m
}
{
p.SetState(98)
var _m = p.Match(CELParserIDENTIFIER)
localctx.(*SelectOrCallContext).id = _m
}
p.SetState(104)
p.GetErrorHandler().Sync(p)
if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 10, p.GetParserRuleContext()) == 1 {
{
p.SetState(99)
var _m = p.Match(CELParserLPAREN)
localctx.(*SelectOrCallContext).open = _m
}
p.SetState(101)
p.GetErrorHandler().Sync(p)
_la = p.GetTokenStream().LA(1)
if ((_la-10)&-(0x1f+1)) == 0 && ((1<<uint((_la-10)))&((1<<(CELParserLBRACKET-10))|(1<<(CELParserLBRACE-10))|(1<<(CELParserLPAREN-10))|(1<<(CELParserDOT-10))|(1<<(CELParserMINUS-10))|(1<<(CELParserEXCLAM-10))|(1<<(CELParserCEL_TRUE-10))|(1<<(CELParserCEL_FALSE-10))|(1<<(CELParserNUL-10))|(1<<(CELParserNUM_FLOAT-10))|(1<<(CELParserNUM_INT-10))|(1<<(CELParserNUM_UINT-10))|(1<<(CELParserSTRING-10))|(1<<(CELParserBYTES-10))|(1<<(CELParserIDENTIFIER-10)))) != 0 {
{
p.SetState(100)
var _x = p.ExprList()
localctx.(*SelectOrCallContext).args = _x
}
}
{
p.SetState(103)
p.Match(CELParserRPAREN)
}
}
case 2:
localctx = NewIndexContext(p, NewMemberContext(p, _parentctx, _parentState))
p.PushNewRecursionContext(localctx, _startState, CELParserRULE_member)
p.SetState(106)
if !(p.Precpred(p.GetParserRuleContext(), 2)) {
panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 2)", ""))
}
{
p.SetState(107)
var _m = p.Match(CELParserLBRACKET)
localctx.(*IndexContext).op = _m
}
{
p.SetState(108)
var _x = p.Expr()
localctx.(*IndexContext).index = _x
}
{
p.SetState(109)
p.Match(CELParserRPRACKET)
}
case 3:
localctx = NewCreateMessageContext(p, NewMemberContext(p, _parentctx, _parentState))
p.PushNewRecursionContext(localctx, _startState, CELParserRULE_member)
p.SetState(111)
if !(p.Precpred(p.GetParserRuleContext(), 1)) {
panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 1)", ""))
}
{
p.SetState(112)
var _m = p.Match(CELParserLBRACE)
localctx.(*CreateMessageContext).op = _m
}
p.SetState(114)
p.GetErrorHandler().Sync(p)
_la = p.GetTokenStream().LA(1)
if _la == CELParserIDENTIFIER {
{
p.SetState(113)
var _x = p.FieldInitializerList()
localctx.(*CreateMessageContext).entries = _x
}
}
p.SetState(117)
p.GetErrorHandler().Sync(p)
_la = p.GetTokenStream().LA(1)
if _la == CELParserCOMMA {
{
p.SetState(116)
p.Match(CELParserCOMMA)
}
}
{
p.SetState(119)
p.Match(CELParserRBRACE)
}
}
}
p.SetState(124)
p.GetErrorHandler().Sync(p)
_alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 14, p.GetParserRuleContext())
}
return localctx
}
// IPrimaryContext is an interface to support dynamic dispatch.
type IPrimaryContext interface {
antlr.ParserRuleContext
// GetParser returns the parser.
GetParser() antlr.Parser
// IsPrimaryContext differentiates from other interfaces.
IsPrimaryContext()
}
type PrimaryContext struct {
*antlr.BaseParserRuleContext
parser antlr.Parser
}
func NewEmptyPrimaryContext() *PrimaryContext {
var p = new(PrimaryContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
p.RuleIndex = CELParserRULE_primary
return p
}
func (*PrimaryContext) IsPrimaryContext() {}
func NewPrimaryContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *PrimaryContext {
var p = new(PrimaryContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
p.parser = parser
p.RuleIndex = CELParserRULE_primary
return p
}
func (s *PrimaryContext) GetParser() antlr.Parser { return s.parser }
func (s *PrimaryContext) CopyFrom(ctx *PrimaryContext) {
s.BaseParserRuleContext.CopyFrom(ctx.BaseParserRuleContext)
}
func (s *PrimaryContext) GetRuleContext() antlr.RuleContext {
return s
}
func (s *PrimaryContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
return antlr.TreesStringTree(s, ruleNames, recog)
}
type CreateListContext struct {
*PrimaryContext
op antlr.Token
elems IExprListContext
}
func NewCreateListContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *CreateListContext {
var p = new(CreateListContext)
p.PrimaryContext = NewEmptyPrimaryContext()
p.parser = parser
p.CopyFrom(ctx.(*PrimaryContext))
return p
}
func (s *CreateListContext) GetOp() antlr.Token { return s.op }
func (s *CreateListContext) SetOp(v antlr.Token) { s.op = v }
func (s *CreateListContext) GetElems() IExprListContext { return s.elems }
func (s *CreateListContext) SetElems(v IExprListContext) { s.elems = v }
func (s *CreateListContext) GetRuleContext() antlr.RuleContext {
return s
}
func (s *CreateListContext) RPRACKET() antlr.TerminalNode {
return s.GetToken(CELParserRPRACKET, 0)
}
func (s *CreateListContext) LBRACKET() antlr.TerminalNode {
return s.GetToken(CELParserLBRACKET, 0)
}
func (s *CreateListContext) COMMA() antlr.TerminalNode {
return s.GetToken(CELParserCOMMA, 0)
}
func (s *CreateListContext) ExprList() IExprListContext {
var t antlr.RuleContext
for _, ctx := range s.GetChildren() {
if _, ok := ctx.(IExprListContext); ok {
t = ctx.(antlr.RuleContext)
break
}
}
if t == nil {
return nil
}
return t.(IExprListContext)
}
func (s *CreateListContext) EnterRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.EnterCreateList(s)
}
}
func (s *CreateListContext) ExitRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.ExitCreateList(s)
}
}
func (s *CreateListContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
switch t := visitor.(type) {
case CELVisitor:
return t.VisitCreateList(s)
default:
return t.VisitChildren(s)
}
}
type CreateStructContext struct {
*PrimaryContext
op antlr.Token
entries IMapInitializerListContext
}
func NewCreateStructContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *CreateStructContext {
var p = new(CreateStructContext)
p.PrimaryContext = NewEmptyPrimaryContext()
p.parser = parser
p.CopyFrom(ctx.(*PrimaryContext))
return p
}
func (s *CreateStructContext) GetOp() antlr.Token { return s.op }
func (s *CreateStructContext) SetOp(v antlr.Token) { s.op = v }
func (s *CreateStructContext) GetEntries() IMapInitializerListContext { return s.entries }
func (s *CreateStructContext) SetEntries(v IMapInitializerListContext) { s.entries = v }
func (s *CreateStructContext) GetRuleContext() antlr.RuleContext {
return s
}
func (s *CreateStructContext) RBRACE() antlr.TerminalNode {
return s.GetToken(CELParserRBRACE, 0)
}
func (s *CreateStructContext) LBRACE() antlr.TerminalNode {
return s.GetToken(CELParserLBRACE, 0)
}
func (s *CreateStructContext) COMMA() antlr.TerminalNode {
return s.GetToken(CELParserCOMMA, 0)
}
func (s *CreateStructContext) MapInitializerList() IMapInitializerListContext {
var t antlr.RuleContext
for _, ctx := range s.GetChildren() {
if _, ok := ctx.(IMapInitializerListContext); ok {
t = ctx.(antlr.RuleContext)
break
}
}
if t == nil {
return nil
}
return t.(IMapInitializerListContext)
}
func (s *CreateStructContext) EnterRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.EnterCreateStruct(s)
}
}
func (s *CreateStructContext) ExitRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.ExitCreateStruct(s)
}
}
func (s *CreateStructContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
switch t := visitor.(type) {
case CELVisitor:
return t.VisitCreateStruct(s)
default:
return t.VisitChildren(s)
}
}
type ConstantLiteralContext struct {
*PrimaryContext
}
func NewConstantLiteralContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *ConstantLiteralContext {
var p = new(ConstantLiteralContext)
p.PrimaryContext = NewEmptyPrimaryContext()
p.parser = parser
p.CopyFrom(ctx.(*PrimaryContext))
return p
}
func (s *ConstantLiteralContext) GetRuleContext() antlr.RuleContext {
return s
}
func (s *ConstantLiteralContext) Literal() ILiteralContext {
var t antlr.RuleContext
for _, ctx := range s.GetChildren() {
if _, ok := ctx.(ILiteralContext); ok {
t = ctx.(antlr.RuleContext)
break
}
}
if t == nil {
return nil
}
return t.(ILiteralContext)
}
func (s *ConstantLiteralContext) EnterRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.EnterConstantLiteral(s)
}
}
func (s *ConstantLiteralContext) ExitRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.ExitConstantLiteral(s)
}
}
func (s *ConstantLiteralContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
switch t := visitor.(type) {
case CELVisitor:
return t.VisitConstantLiteral(s)
default:
return t.VisitChildren(s)
}
}
type NestedContext struct {
*PrimaryContext
e IExprContext
}
func NewNestedContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *NestedContext {
var p = new(NestedContext)
p.PrimaryContext = NewEmptyPrimaryContext()
p.parser = parser
p.CopyFrom(ctx.(*PrimaryContext))
return p
}
func (s *NestedContext) GetE() IExprContext { return s.e }
func (s *NestedContext) SetE(v IExprContext) { s.e = v }
func (s *NestedContext) GetRuleContext() antlr.RuleContext {
return s
}
func (s *NestedContext) LPAREN() antlr.TerminalNode {
return s.GetToken(CELParserLPAREN, 0)
}
func (s *NestedContext) RPAREN() antlr.TerminalNode {
return s.GetToken(CELParserRPAREN, 0)
}
func (s *NestedContext) 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 *NestedContext) EnterRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.EnterNested(s)
}
}
func (s *NestedContext) ExitRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.ExitNested(s)
}
}
func (s *NestedContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
switch t := visitor.(type) {
case CELVisitor:
return t.VisitNested(s)
default:
return t.VisitChildren(s)
}
}
type IdentOrGlobalCallContext struct {
*PrimaryContext
leadingDot antlr.Token
id antlr.Token
op antlr.Token
args IExprListContext
}
func NewIdentOrGlobalCallContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *IdentOrGlobalCallContext {
var p = new(IdentOrGlobalCallContext)
p.PrimaryContext = NewEmptyPrimaryContext()
p.parser = parser
p.CopyFrom(ctx.(*PrimaryContext))
return p
}
func (s *IdentOrGlobalCallContext) GetLeadingDot() antlr.Token { return s.leadingDot }
func (s *IdentOrGlobalCallContext) GetId() antlr.Token { return s.id }
func (s *IdentOrGlobalCallContext) GetOp() antlr.Token { return s.op }
func (s *IdentOrGlobalCallContext) SetLeadingDot(v antlr.Token) { s.leadingDot = v }
func (s *IdentOrGlobalCallContext) SetId(v antlr.Token) { s.id = v }
func (s *IdentOrGlobalCallContext) SetOp(v antlr.Token) { s.op = v }
func (s *IdentOrGlobalCallContext) GetArgs() IExprListContext { return s.args }
func (s *IdentOrGlobalCallContext) SetArgs(v IExprListContext) { s.args = v }
func (s *IdentOrGlobalCallContext) GetRuleContext() antlr.RuleContext {
return s
}
func (s *IdentOrGlobalCallContext) IDENTIFIER() antlr.TerminalNode {
return s.GetToken(CELParserIDENTIFIER, 0)
}
func (s *IdentOrGlobalCallContext) RPAREN() antlr.TerminalNode {
return s.GetToken(CELParserRPAREN, 0)
}
func (s *IdentOrGlobalCallContext) DOT() antlr.TerminalNode {
return s.GetToken(CELParserDOT, 0)
}
func (s *IdentOrGlobalCallContext) LPAREN() antlr.TerminalNode {
return s.GetToken(CELParserLPAREN, 0)
}
func (s *IdentOrGlobalCallContext) ExprList() IExprListContext {
var t antlr.RuleContext
for _, ctx := range s.GetChildren() {
if _, ok := ctx.(IExprListContext); ok {
t = ctx.(antlr.RuleContext)
break
}
}
if t == nil {
return nil
}
return t.(IExprListContext)
}
func (s *IdentOrGlobalCallContext) EnterRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.EnterIdentOrGlobalCall(s)
}
}
func (s *IdentOrGlobalCallContext) ExitRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.ExitIdentOrGlobalCall(s)
}
}
func (s *IdentOrGlobalCallContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
switch t := visitor.(type) {
case CELVisitor:
return t.VisitIdentOrGlobalCall(s)
default:
return t.VisitChildren(s)
}
}
func (p *CELParser) Primary() (localctx IPrimaryContext) {
this := p
_ = this
localctx = NewPrimaryContext(p, p.GetParserRuleContext(), p.GetState())
p.EnterRule(localctx, 16, CELParserRULE_primary)
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.SetState(157)
p.GetErrorHandler().Sync(p)
switch p.GetTokenStream().LA(1) {
case CELParserDOT, CELParserIDENTIFIER:
localctx = NewIdentOrGlobalCallContext(p, localctx)
p.EnterOuterAlt(localctx, 1)
p.SetState(126)
p.GetErrorHandler().Sync(p)
_la = p.GetTokenStream().LA(1)
if _la == CELParserDOT {
{
p.SetState(125)
var _m = p.Match(CELParserDOT)
localctx.(*IdentOrGlobalCallContext).leadingDot = _m
}
}
{
p.SetState(128)
var _m = p.Match(CELParserIDENTIFIER)
localctx.(*IdentOrGlobalCallContext).id = _m
}
p.SetState(134)
p.GetErrorHandler().Sync(p)
if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 17, p.GetParserRuleContext()) == 1 {
{
p.SetState(129)
var _m = p.Match(CELParserLPAREN)
localctx.(*IdentOrGlobalCallContext).op = _m
}
p.SetState(131)
p.GetErrorHandler().Sync(p)
_la = p.GetTokenStream().LA(1)
if ((_la-10)&-(0x1f+1)) == 0 && ((1<<uint((_la-10)))&((1<<(CELParserLBRACKET-10))|(1<<(CELParserLBRACE-10))|(1<<(CELParserLPAREN-10))|(1<<(CELParserDOT-10))|(1<<(CELParserMINUS-10))|(1<<(CELParserEXCLAM-10))|(1<<(CELParserCEL_TRUE-10))|(1<<(CELParserCEL_FALSE-10))|(1<<(CELParserNUL-10))|(1<<(CELParserNUM_FLOAT-10))|(1<<(CELParserNUM_INT-10))|(1<<(CELParserNUM_UINT-10))|(1<<(CELParserSTRING-10))|(1<<(CELParserBYTES-10))|(1<<(CELParserIDENTIFIER-10)))) != 0 {
{
p.SetState(130)
var _x = p.ExprList()
localctx.(*IdentOrGlobalCallContext).args = _x
}
}
{
p.SetState(133)
p.Match(CELParserRPAREN)
}
}
case CELParserLPAREN:
localctx = NewNestedContext(p, localctx)
p.EnterOuterAlt(localctx, 2)
{
p.SetState(136)
p.Match(CELParserLPAREN)
}
{
p.SetState(137)
var _x = p.Expr()
localctx.(*NestedContext).e = _x
}
{
p.SetState(138)
p.Match(CELParserRPAREN)
}
case CELParserLBRACKET:
localctx = NewCreateListContext(p, localctx)
p.EnterOuterAlt(localctx, 3)
{
p.SetState(140)
var _m = p.Match(CELParserLBRACKET)
localctx.(*CreateListContext).op = _m
}
p.SetState(142)
p.GetErrorHandler().Sync(p)
_la = p.GetTokenStream().LA(1)
if ((_la-10)&-(0x1f+1)) == 0 && ((1<<uint((_la-10)))&((1<<(CELParserLBRACKET-10))|(1<<(CELParserLBRACE-10))|(1<<(CELParserLPAREN-10))|(1<<(CELParserDOT-10))|(1<<(CELParserMINUS-10))|(1<<(CELParserEXCLAM-10))|(1<<(CELParserCEL_TRUE-10))|(1<<(CELParserCEL_FALSE-10))|(1<<(CELParserNUL-10))|(1<<(CELParserNUM_FLOAT-10))|(1<<(CELParserNUM_INT-10))|(1<<(CELParserNUM_UINT-10))|(1<<(CELParserSTRING-10))|(1<<(CELParserBYTES-10))|(1<<(CELParserIDENTIFIER-10)))) != 0 {
{
p.SetState(141)
var _x = p.ExprList()
localctx.(*CreateListContext).elems = _x
}
}
p.SetState(145)
p.GetErrorHandler().Sync(p)
_la = p.GetTokenStream().LA(1)
if _la == CELParserCOMMA {
{
p.SetState(144)
p.Match(CELParserCOMMA)
}
}
{
p.SetState(147)
p.Match(CELParserRPRACKET)
}
case CELParserLBRACE:
localctx = NewCreateStructContext(p, localctx)
p.EnterOuterAlt(localctx, 4)
{
p.SetState(148)
var _m = p.Match(CELParserLBRACE)
localctx.(*CreateStructContext).op = _m
}
p.SetState(150)
p.GetErrorHandler().Sync(p)
_la = p.GetTokenStream().LA(1)
if ((_la-10)&-(0x1f+1)) == 0 && ((1<<uint((_la-10)))&((1<<(CELParserLBRACKET-10))|(1<<(CELParserLBRACE-10))|(1<<(CELParserLPAREN-10))|(1<<(CELParserDOT-10))|(1<<(CELParserMINUS-10))|(1<<(CELParserEXCLAM-10))|(1<<(CELParserCEL_TRUE-10))|(1<<(CELParserCEL_FALSE-10))|(1<<(CELParserNUL-10))|(1<<(CELParserNUM_FLOAT-10))|(1<<(CELParserNUM_INT-10))|(1<<(CELParserNUM_UINT-10))|(1<<(CELParserSTRING-10))|(1<<(CELParserBYTES-10))|(1<<(CELParserIDENTIFIER-10)))) != 0 {
{
p.SetState(149)
var _x = p.MapInitializerList()
localctx.(*CreateStructContext).entries = _x
}
}
p.SetState(153)
p.GetErrorHandler().Sync(p)
_la = p.GetTokenStream().LA(1)
if _la == CELParserCOMMA {
{
p.SetState(152)
p.Match(CELParserCOMMA)
}
}
{
p.SetState(155)
p.Match(CELParserRBRACE)
}
case CELParserMINUS, CELParserCEL_TRUE, CELParserCEL_FALSE, CELParserNUL, CELParserNUM_FLOAT, CELParserNUM_INT, CELParserNUM_UINT, CELParserSTRING, CELParserBYTES:
localctx = NewConstantLiteralContext(p, localctx)
p.EnterOuterAlt(localctx, 5)
{
p.SetState(156)
p.Literal()
}
default:
panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil))
}
return localctx
}
// IExprListContext is an interface to support dynamic dispatch.
type IExprListContext interface {
antlr.ParserRuleContext
// GetParser returns the parser.
GetParser() antlr.Parser
// Get_expr returns the _expr rule contexts.
Get_expr() IExprContext
// Set_expr sets the _expr rule contexts.
Set_expr(IExprContext)
// GetE returns the e rule context list.
GetE() []IExprContext
// SetE sets the e rule context list.
SetE([]IExprContext)
// IsExprListContext differentiates from other interfaces.
IsExprListContext()
}
type ExprListContext struct {
*antlr.BaseParserRuleContext
parser antlr.Parser
_expr IExprContext
e []IExprContext
}
func NewEmptyExprListContext() *ExprListContext {
var p = new(ExprListContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
p.RuleIndex = CELParserRULE_exprList
return p
}
func (*ExprListContext) IsExprListContext() {}
func NewExprListContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ExprListContext {
var p = new(ExprListContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
p.parser = parser
p.RuleIndex = CELParserRULE_exprList
return p
}
func (s *ExprListContext) GetParser() antlr.Parser { return s.parser }
func (s *ExprListContext) Get_expr() IExprContext { return s._expr }
func (s *ExprListContext) Set_expr(v IExprContext) { s._expr = v }
func (s *ExprListContext) GetE() []IExprContext { return s.e }
func (s *ExprListContext) SetE(v []IExprContext) { s.e = v }
func (s *ExprListContext) AllExpr() []IExprContext {
children := s.GetChildren()
len := 0
for _, ctx := range children {
if _, ok := ctx.(IExprContext); ok {
len++
}
}
tst := make([]IExprContext, len)
i := 0
for _, ctx := range children {
if t, ok := ctx.(IExprContext); ok {
tst[i] = t.(IExprContext)
i++
}
}
return tst
}
func (s *ExprListContext) Expr(i int) IExprContext {
var t antlr.RuleContext
j := 0
for _, ctx := range s.GetChildren() {
if _, ok := ctx.(IExprContext); ok {
if j == i {
t = ctx.(antlr.RuleContext)
break
}
j++
}
}
if t == nil {
return nil
}
return t.(IExprContext)
}
func (s *ExprListContext) AllCOMMA() []antlr.TerminalNode {
return s.GetTokens(CELParserCOMMA)
}
func (s *ExprListContext) COMMA(i int) antlr.TerminalNode {
return s.GetToken(CELParserCOMMA, i)
}
func (s *ExprListContext) GetRuleContext() antlr.RuleContext {
return s
}
func (s *ExprListContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
return antlr.TreesStringTree(s, ruleNames, recog)
}
func (s *ExprListContext) EnterRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.EnterExprList(s)
}
}
func (s *ExprListContext) ExitRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.ExitExprList(s)
}
}
func (s *ExprListContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
switch t := visitor.(type) {
case CELVisitor:
return t.VisitExprList(s)
default:
return t.VisitChildren(s)
}
}
func (p *CELParser) ExprList() (localctx IExprListContext) {
this := p
_ = this
localctx = NewExprListContext(p, p.GetParserRuleContext(), p.GetState())
p.EnterRule(localctx, 18, CELParserRULE_exprList)
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)
}
}
}()
var _alt int
p.EnterOuterAlt(localctx, 1)
{
p.SetState(159)
var _x = p.Expr()
localctx.(*ExprListContext)._expr = _x
}
localctx.(*ExprListContext).e = append(localctx.(*ExprListContext).e, localctx.(*ExprListContext)._expr)
p.SetState(164)
p.GetErrorHandler().Sync(p)
_alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 23, p.GetParserRuleContext())
for _alt != 2 && _alt != antlr.ATNInvalidAltNumber {
if _alt == 1 {
{
p.SetState(160)
p.Match(CELParserCOMMA)
}
{
p.SetState(161)
var _x = p.Expr()
localctx.(*ExprListContext)._expr = _x
}
localctx.(*ExprListContext).e = append(localctx.(*ExprListContext).e, localctx.(*ExprListContext)._expr)
}
p.SetState(166)
p.GetErrorHandler().Sync(p)
_alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 23, p.GetParserRuleContext())
}
return localctx
}
// IFieldInitializerListContext is an interface to support dynamic dispatch.
type IFieldInitializerListContext interface {
antlr.ParserRuleContext
// GetParser returns the parser.
GetParser() antlr.Parser
// Get_IDENTIFIER returns the _IDENTIFIER token.
Get_IDENTIFIER() antlr.Token
// GetS21 returns the s21 token.
GetS21() antlr.Token
// Set_IDENTIFIER sets the _IDENTIFIER token.
Set_IDENTIFIER(antlr.Token)
// SetS21 sets the s21 token.
SetS21(antlr.Token)
// GetFields returns the fields token list.
GetFields() []antlr.Token
// GetCols returns the cols token list.
GetCols() []antlr.Token
// SetFields sets the fields token list.
SetFields([]antlr.Token)
// SetCols sets the cols token list.
SetCols([]antlr.Token)
// Get_expr returns the _expr rule contexts.
Get_expr() IExprContext
// Set_expr sets the _expr rule contexts.
Set_expr(IExprContext)
// GetValues returns the values rule context list.
GetValues() []IExprContext
// SetValues sets the values rule context list.
SetValues([]IExprContext)
// IsFieldInitializerListContext differentiates from other interfaces.
IsFieldInitializerListContext()
}
type FieldInitializerListContext struct {
*antlr.BaseParserRuleContext
parser antlr.Parser
_IDENTIFIER antlr.Token
fields []antlr.Token
s21 antlr.Token
cols []antlr.Token
_expr IExprContext
values []IExprContext
}
func NewEmptyFieldInitializerListContext() *FieldInitializerListContext {
var p = new(FieldInitializerListContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
p.RuleIndex = CELParserRULE_fieldInitializerList
return p
}
func (*FieldInitializerListContext) IsFieldInitializerListContext() {}
func NewFieldInitializerListContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *FieldInitializerListContext {
var p = new(FieldInitializerListContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
p.parser = parser
p.RuleIndex = CELParserRULE_fieldInitializerList
return p
}
func (s *FieldInitializerListContext) GetParser() antlr.Parser { return s.parser }
func (s *FieldInitializerListContext) Get_IDENTIFIER() antlr.Token { return s._IDENTIFIER }
func (s *FieldInitializerListContext) GetS21() antlr.Token { return s.s21 }
func (s *FieldInitializerListContext) Set_IDENTIFIER(v antlr.Token) { s._IDENTIFIER = v }
func (s *FieldInitializerListContext) SetS21(v antlr.Token) { s.s21 = v }
func (s *FieldInitializerListContext) GetFields() []antlr.Token { return s.fields }
func (s *FieldInitializerListContext) GetCols() []antlr.Token { return s.cols }
func (s *FieldInitializerListContext) SetFields(v []antlr.Token) { s.fields = v }
func (s *FieldInitializerListContext) SetCols(v []antlr.Token) { s.cols = v }
func (s *FieldInitializerListContext) Get_expr() IExprContext { return s._expr }
func (s *FieldInitializerListContext) Set_expr(v IExprContext) { s._expr = v }
func (s *FieldInitializerListContext) GetValues() []IExprContext { return s.values }
func (s *FieldInitializerListContext) SetValues(v []IExprContext) { s.values = v }
func (s *FieldInitializerListContext) AllIDENTIFIER() []antlr.TerminalNode {
return s.GetTokens(CELParserIDENTIFIER)
}
func (s *FieldInitializerListContext) IDENTIFIER(i int) antlr.TerminalNode {
return s.GetToken(CELParserIDENTIFIER, i)
}
func (s *FieldInitializerListContext) AllCOLON() []antlr.TerminalNode {
return s.GetTokens(CELParserCOLON)
}
func (s *FieldInitializerListContext) COLON(i int) antlr.TerminalNode {
return s.GetToken(CELParserCOLON, i)
}
func (s *FieldInitializerListContext) AllExpr() []IExprContext {
children := s.GetChildren()
len := 0
for _, ctx := range children {
if _, ok := ctx.(IExprContext); ok {
len++
}
}
tst := make([]IExprContext, len)
i := 0
for _, ctx := range children {
if t, ok := ctx.(IExprContext); ok {
tst[i] = t.(IExprContext)
i++
}
}
return tst
}
func (s *FieldInitializerListContext) Expr(i int) IExprContext {
var t antlr.RuleContext
j := 0
for _, ctx := range s.GetChildren() {
if _, ok := ctx.(IExprContext); ok {
if j == i {
t = ctx.(antlr.RuleContext)
break
}
j++
}
}
if t == nil {
return nil
}
return t.(IExprContext)
}
func (s *FieldInitializerListContext) AllCOMMA() []antlr.TerminalNode {
return s.GetTokens(CELParserCOMMA)
}
func (s *FieldInitializerListContext) COMMA(i int) antlr.TerminalNode {
return s.GetToken(CELParserCOMMA, i)
}
func (s *FieldInitializerListContext) GetRuleContext() antlr.RuleContext {
return s
}
func (s *FieldInitializerListContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
return antlr.TreesStringTree(s, ruleNames, recog)
}
func (s *FieldInitializerListContext) EnterRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.EnterFieldInitializerList(s)
}
}
func (s *FieldInitializerListContext) ExitRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.ExitFieldInitializerList(s)
}
}
func (s *FieldInitializerListContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
switch t := visitor.(type) {
case CELVisitor:
return t.VisitFieldInitializerList(s)
default:
return t.VisitChildren(s)
}
}
func (p *CELParser) FieldInitializerList() (localctx IFieldInitializerListContext) {
this := p
_ = this
localctx = NewFieldInitializerListContext(p, p.GetParserRuleContext(), p.GetState())
p.EnterRule(localctx, 20, CELParserRULE_fieldInitializerList)
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)
}
}
}()
var _alt int
p.EnterOuterAlt(localctx, 1)
{
p.SetState(167)
var _m = p.Match(CELParserIDENTIFIER)
localctx.(*FieldInitializerListContext)._IDENTIFIER = _m
}
localctx.(*FieldInitializerListContext).fields = append(localctx.(*FieldInitializerListContext).fields, localctx.(*FieldInitializerListContext)._IDENTIFIER)
{
p.SetState(168)
var _m = p.Match(CELParserCOLON)
localctx.(*FieldInitializerListContext).s21 = _m
}
localctx.(*FieldInitializerListContext).cols = append(localctx.(*FieldInitializerListContext).cols, localctx.(*FieldInitializerListContext).s21)
{
p.SetState(169)
var _x = p.Expr()
localctx.(*FieldInitializerListContext)._expr = _x
}
localctx.(*FieldInitializerListContext).values = append(localctx.(*FieldInitializerListContext).values, localctx.(*FieldInitializerListContext)._expr)
p.SetState(176)
p.GetErrorHandler().Sync(p)
_alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 24, p.GetParserRuleContext())
for _alt != 2 && _alt != antlr.ATNInvalidAltNumber {
if _alt == 1 {
{
p.SetState(170)
p.Match(CELParserCOMMA)
}
{
p.SetState(171)
var _m = p.Match(CELParserIDENTIFIER)
localctx.(*FieldInitializerListContext)._IDENTIFIER = _m
}
localctx.(*FieldInitializerListContext).fields = append(localctx.(*FieldInitializerListContext).fields, localctx.(*FieldInitializerListContext)._IDENTIFIER)
{
p.SetState(172)
var _m = p.Match(CELParserCOLON)
localctx.(*FieldInitializerListContext).s21 = _m
}
localctx.(*FieldInitializerListContext).cols = append(localctx.(*FieldInitializerListContext).cols, localctx.(*FieldInitializerListContext).s21)
{
p.SetState(173)
var _x = p.Expr()
localctx.(*FieldInitializerListContext)._expr = _x
}
localctx.(*FieldInitializerListContext).values = append(localctx.(*FieldInitializerListContext).values, localctx.(*FieldInitializerListContext)._expr)
}
p.SetState(178)
p.GetErrorHandler().Sync(p)
_alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 24, p.GetParserRuleContext())
}
return localctx
}
// IMapInitializerListContext is an interface to support dynamic dispatch.
type IMapInitializerListContext interface {
antlr.ParserRuleContext
// GetParser returns the parser.
GetParser() antlr.Parser
// GetS21 returns the s21 token.
GetS21() antlr.Token
// SetS21 sets the s21 token.
SetS21(antlr.Token)
// GetCols returns the cols token list.
GetCols() []antlr.Token
// SetCols sets the cols token list.
SetCols([]antlr.Token)
// Get_expr returns the _expr rule contexts.
Get_expr() IExprContext
// Set_expr sets the _expr rule contexts.
Set_expr(IExprContext)
// GetKeys returns the keys rule context list.
GetKeys() []IExprContext
// GetValues returns the values rule context list.
GetValues() []IExprContext
// SetKeys sets the keys rule context list.
SetKeys([]IExprContext)
// SetValues sets the values rule context list.
SetValues([]IExprContext)
// IsMapInitializerListContext differentiates from other interfaces.
IsMapInitializerListContext()
}
type MapInitializerListContext struct {
*antlr.BaseParserRuleContext
parser antlr.Parser
_expr IExprContext
keys []IExprContext
s21 antlr.Token
cols []antlr.Token
values []IExprContext
}
func NewEmptyMapInitializerListContext() *MapInitializerListContext {
var p = new(MapInitializerListContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
p.RuleIndex = CELParserRULE_mapInitializerList
return p
}
func (*MapInitializerListContext) IsMapInitializerListContext() {}
func NewMapInitializerListContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *MapInitializerListContext {
var p = new(MapInitializerListContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
p.parser = parser
p.RuleIndex = CELParserRULE_mapInitializerList
return p
}
func (s *MapInitializerListContext) GetParser() antlr.Parser { return s.parser }
func (s *MapInitializerListContext) GetS21() antlr.Token { return s.s21 }
func (s *MapInitializerListContext) SetS21(v antlr.Token) { s.s21 = v }
func (s *MapInitializerListContext) GetCols() []antlr.Token { return s.cols }
func (s *MapInitializerListContext) SetCols(v []antlr.Token) { s.cols = v }
func (s *MapInitializerListContext) Get_expr() IExprContext { return s._expr }
func (s *MapInitializerListContext) Set_expr(v IExprContext) { s._expr = v }
func (s *MapInitializerListContext) GetKeys() []IExprContext { return s.keys }
func (s *MapInitializerListContext) GetValues() []IExprContext { return s.values }
func (s *MapInitializerListContext) SetKeys(v []IExprContext) { s.keys = v }
func (s *MapInitializerListContext) SetValues(v []IExprContext) { s.values = v }
func (s *MapInitializerListContext) AllExpr() []IExprContext {
children := s.GetChildren()
len := 0
for _, ctx := range children {
if _, ok := ctx.(IExprContext); ok {
len++
}
}
tst := make([]IExprContext, len)
i := 0
for _, ctx := range children {
if t, ok := ctx.(IExprContext); ok {
tst[i] = t.(IExprContext)
i++
}
}
return tst
}
func (s *MapInitializerListContext) Expr(i int) IExprContext {
var t antlr.RuleContext
j := 0
for _, ctx := range s.GetChildren() {
if _, ok := ctx.(IExprContext); ok {
if j == i {
t = ctx.(antlr.RuleContext)
break
}
j++
}
}
if t == nil {
return nil
}
return t.(IExprContext)
}
func (s *MapInitializerListContext) AllCOLON() []antlr.TerminalNode {
return s.GetTokens(CELParserCOLON)
}
func (s *MapInitializerListContext) COLON(i int) antlr.TerminalNode {
return s.GetToken(CELParserCOLON, i)
}
func (s *MapInitializerListContext) AllCOMMA() []antlr.TerminalNode {
return s.GetTokens(CELParserCOMMA)
}
func (s *MapInitializerListContext) COMMA(i int) antlr.TerminalNode {
return s.GetToken(CELParserCOMMA, i)
}
func (s *MapInitializerListContext) GetRuleContext() antlr.RuleContext {
return s
}
func (s *MapInitializerListContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
return antlr.TreesStringTree(s, ruleNames, recog)
}
func (s *MapInitializerListContext) EnterRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.EnterMapInitializerList(s)
}
}
func (s *MapInitializerListContext) ExitRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.ExitMapInitializerList(s)
}
}
func (s *MapInitializerListContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
switch t := visitor.(type) {
case CELVisitor:
return t.VisitMapInitializerList(s)
default:
return t.VisitChildren(s)
}
}
func (p *CELParser) MapInitializerList() (localctx IMapInitializerListContext) {
this := p
_ = this
localctx = NewMapInitializerListContext(p, p.GetParserRuleContext(), p.GetState())
p.EnterRule(localctx, 22, CELParserRULE_mapInitializerList)
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)
}
}
}()
var _alt int
p.EnterOuterAlt(localctx, 1)
{
p.SetState(179)
var _x = p.Expr()
localctx.(*MapInitializerListContext)._expr = _x
}
localctx.(*MapInitializerListContext).keys = append(localctx.(*MapInitializerListContext).keys, localctx.(*MapInitializerListContext)._expr)
{
p.SetState(180)
var _m = p.Match(CELParserCOLON)
localctx.(*MapInitializerListContext).s21 = _m
}
localctx.(*MapInitializerListContext).cols = append(localctx.(*MapInitializerListContext).cols, localctx.(*MapInitializerListContext).s21)
{
p.SetState(181)
var _x = p.Expr()
localctx.(*MapInitializerListContext)._expr = _x
}
localctx.(*MapInitializerListContext).values = append(localctx.(*MapInitializerListContext).values, localctx.(*MapInitializerListContext)._expr)
p.SetState(189)
p.GetErrorHandler().Sync(p)
_alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 25, p.GetParserRuleContext())
for _alt != 2 && _alt != antlr.ATNInvalidAltNumber {
if _alt == 1 {
{
p.SetState(182)
p.Match(CELParserCOMMA)
}
{
p.SetState(183)
var _x = p.Expr()
localctx.(*MapInitializerListContext)._expr = _x
}
localctx.(*MapInitializerListContext).keys = append(localctx.(*MapInitializerListContext).keys, localctx.(*MapInitializerListContext)._expr)
{
p.SetState(184)
var _m = p.Match(CELParserCOLON)
localctx.(*MapInitializerListContext).s21 = _m
}
localctx.(*MapInitializerListContext).cols = append(localctx.(*MapInitializerListContext).cols, localctx.(*MapInitializerListContext).s21)
{
p.SetState(185)
var _x = p.Expr()
localctx.(*MapInitializerListContext)._expr = _x
}
localctx.(*MapInitializerListContext).values = append(localctx.(*MapInitializerListContext).values, localctx.(*MapInitializerListContext)._expr)
}
p.SetState(191)
p.GetErrorHandler().Sync(p)
_alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 25, p.GetParserRuleContext())
}
return localctx
}
// ILiteralContext is an interface to support dynamic dispatch.
type ILiteralContext interface {
antlr.ParserRuleContext
// GetParser returns the parser.
GetParser() antlr.Parser
// IsLiteralContext differentiates from other interfaces.
IsLiteralContext()
}
type LiteralContext struct {
*antlr.BaseParserRuleContext
parser antlr.Parser
}
func NewEmptyLiteralContext() *LiteralContext {
var p = new(LiteralContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
p.RuleIndex = CELParserRULE_literal
return p
}
func (*LiteralContext) IsLiteralContext() {}
func NewLiteralContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *LiteralContext {
var p = new(LiteralContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
p.parser = parser
p.RuleIndex = CELParserRULE_literal
return p
}
func (s *LiteralContext) GetParser() antlr.Parser { return s.parser }
func (s *LiteralContext) CopyFrom(ctx *LiteralContext) {
s.BaseParserRuleContext.CopyFrom(ctx.BaseParserRuleContext)
}
func (s *LiteralContext) GetRuleContext() antlr.RuleContext {
return s
}
func (s *LiteralContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
return antlr.TreesStringTree(s, ruleNames, recog)
}
type BytesContext struct {
*LiteralContext
tok antlr.Token
}
func NewBytesContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *BytesContext {
var p = new(BytesContext)
p.LiteralContext = NewEmptyLiteralContext()
p.parser = parser
p.CopyFrom(ctx.(*LiteralContext))
return p
}
func (s *BytesContext) GetTok() antlr.Token { return s.tok }
func (s *BytesContext) SetTok(v antlr.Token) { s.tok = v }
func (s *BytesContext) GetRuleContext() antlr.RuleContext {
return s
}
func (s *BytesContext) BYTES() antlr.TerminalNode {
return s.GetToken(CELParserBYTES, 0)
}
func (s *BytesContext) EnterRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.EnterBytes(s)
}
}
func (s *BytesContext) ExitRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.ExitBytes(s)
}
}
func (s *BytesContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
switch t := visitor.(type) {
case CELVisitor:
return t.VisitBytes(s)
default:
return t.VisitChildren(s)
}
}
type UintContext struct {
*LiteralContext
tok antlr.Token
}
func NewUintContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *UintContext {
var p = new(UintContext)
p.LiteralContext = NewEmptyLiteralContext()
p.parser = parser
p.CopyFrom(ctx.(*LiteralContext))
return p
}
func (s *UintContext) GetTok() antlr.Token { return s.tok }
func (s *UintContext) SetTok(v antlr.Token) { s.tok = v }
func (s *UintContext) GetRuleContext() antlr.RuleContext {
return s
}
func (s *UintContext) NUM_UINT() antlr.TerminalNode {
return s.GetToken(CELParserNUM_UINT, 0)
}
func (s *UintContext) EnterRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.EnterUint(s)
}
}
func (s *UintContext) ExitRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.ExitUint(s)
}
}
func (s *UintContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
switch t := visitor.(type) {
case CELVisitor:
return t.VisitUint(s)
default:
return t.VisitChildren(s)
}
}
type NullContext struct {
*LiteralContext
tok antlr.Token
}
func NewNullContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *NullContext {
var p = new(NullContext)
p.LiteralContext = NewEmptyLiteralContext()
p.parser = parser
p.CopyFrom(ctx.(*LiteralContext))
return p
}
func (s *NullContext) GetTok() antlr.Token { return s.tok }
func (s *NullContext) SetTok(v antlr.Token) { s.tok = v }
func (s *NullContext) GetRuleContext() antlr.RuleContext {
return s
}
func (s *NullContext) NUL() antlr.TerminalNode {
return s.GetToken(CELParserNUL, 0)
}
func (s *NullContext) EnterRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.EnterNull(s)
}
}
func (s *NullContext) ExitRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.ExitNull(s)
}
}
func (s *NullContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
switch t := visitor.(type) {
case CELVisitor:
return t.VisitNull(s)
default:
return t.VisitChildren(s)
}
}
type BoolFalseContext struct {
*LiteralContext
tok antlr.Token
}
func NewBoolFalseContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *BoolFalseContext {
var p = new(BoolFalseContext)
p.LiteralContext = NewEmptyLiteralContext()
p.parser = parser
p.CopyFrom(ctx.(*LiteralContext))
return p
}
func (s *BoolFalseContext) GetTok() antlr.Token { return s.tok }
func (s *BoolFalseContext) SetTok(v antlr.Token) { s.tok = v }
func (s *BoolFalseContext) GetRuleContext() antlr.RuleContext {
return s
}
func (s *BoolFalseContext) CEL_FALSE() antlr.TerminalNode {
return s.GetToken(CELParserCEL_FALSE, 0)
}
func (s *BoolFalseContext) EnterRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.EnterBoolFalse(s)
}
}
func (s *BoolFalseContext) ExitRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.ExitBoolFalse(s)
}
}
func (s *BoolFalseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
switch t := visitor.(type) {
case CELVisitor:
return t.VisitBoolFalse(s)
default:
return t.VisitChildren(s)
}
}
type StringContext struct {
*LiteralContext
tok antlr.Token
}
func NewStringContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *StringContext {
var p = new(StringContext)
p.LiteralContext = NewEmptyLiteralContext()
p.parser = parser
p.CopyFrom(ctx.(*LiteralContext))
return p
}
func (s *StringContext) GetTok() antlr.Token { return s.tok }
func (s *StringContext) SetTok(v antlr.Token) { s.tok = v }
func (s *StringContext) GetRuleContext() antlr.RuleContext {
return s
}
func (s *StringContext) STRING() antlr.TerminalNode {
return s.GetToken(CELParserSTRING, 0)
}
func (s *StringContext) EnterRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.EnterString(s)
}
}
func (s *StringContext) ExitRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.ExitString(s)
}
}
func (s *StringContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
switch t := visitor.(type) {
case CELVisitor:
return t.VisitString(s)
default:
return t.VisitChildren(s)
}
}
type DoubleContext struct {
*LiteralContext
sign antlr.Token
tok antlr.Token
}
func NewDoubleContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *DoubleContext {
var p = new(DoubleContext)
p.LiteralContext = NewEmptyLiteralContext()
p.parser = parser
p.CopyFrom(ctx.(*LiteralContext))
return p
}
func (s *DoubleContext) GetSign() antlr.Token { return s.sign }
func (s *DoubleContext) GetTok() antlr.Token { return s.tok }
func (s *DoubleContext) SetSign(v antlr.Token) { s.sign = v }
func (s *DoubleContext) SetTok(v antlr.Token) { s.tok = v }
func (s *DoubleContext) GetRuleContext() antlr.RuleContext {
return s
}
func (s *DoubleContext) NUM_FLOAT() antlr.TerminalNode {
return s.GetToken(CELParserNUM_FLOAT, 0)
}
func (s *DoubleContext) MINUS() antlr.TerminalNode {
return s.GetToken(CELParserMINUS, 0)
}
func (s *DoubleContext) EnterRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.EnterDouble(s)
}
}
func (s *DoubleContext) ExitRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.ExitDouble(s)
}
}
func (s *DoubleContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
switch t := visitor.(type) {
case CELVisitor:
return t.VisitDouble(s)
default:
return t.VisitChildren(s)
}
}
type BoolTrueContext struct {
*LiteralContext
tok antlr.Token
}
func NewBoolTrueContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *BoolTrueContext {
var p = new(BoolTrueContext)
p.LiteralContext = NewEmptyLiteralContext()
p.parser = parser
p.CopyFrom(ctx.(*LiteralContext))
return p
}
func (s *BoolTrueContext) GetTok() antlr.Token { return s.tok }
func (s *BoolTrueContext) SetTok(v antlr.Token) { s.tok = v }
func (s *BoolTrueContext) GetRuleContext() antlr.RuleContext {
return s
}
func (s *BoolTrueContext) CEL_TRUE() antlr.TerminalNode {
return s.GetToken(CELParserCEL_TRUE, 0)
}
func (s *BoolTrueContext) EnterRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.EnterBoolTrue(s)
}
}
func (s *BoolTrueContext) ExitRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.ExitBoolTrue(s)
}
}
func (s *BoolTrueContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
switch t := visitor.(type) {
case CELVisitor:
return t.VisitBoolTrue(s)
default:
return t.VisitChildren(s)
}
}
type IntContext struct {
*LiteralContext
sign antlr.Token
tok antlr.Token
}
func NewIntContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *IntContext {
var p = new(IntContext)
p.LiteralContext = NewEmptyLiteralContext()
p.parser = parser
p.CopyFrom(ctx.(*LiteralContext))
return p
}
func (s *IntContext) GetSign() antlr.Token { return s.sign }
func (s *IntContext) GetTok() antlr.Token { return s.tok }
func (s *IntContext) SetSign(v antlr.Token) { s.sign = v }
func (s *IntContext) SetTok(v antlr.Token) { s.tok = v }
func (s *IntContext) GetRuleContext() antlr.RuleContext {
return s
}
func (s *IntContext) NUM_INT() antlr.TerminalNode {
return s.GetToken(CELParserNUM_INT, 0)
}
func (s *IntContext) MINUS() antlr.TerminalNode {
return s.GetToken(CELParserMINUS, 0)
}
func (s *IntContext) EnterRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.EnterInt(s)
}
}
func (s *IntContext) ExitRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(CELListener); ok {
listenerT.ExitInt(s)
}
}
func (s *IntContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
switch t := visitor.(type) {
case CELVisitor:
return t.VisitInt(s)
default:
return t.VisitChildren(s)
}
}
func (p *CELParser) Literal() (localctx ILiteralContext) {
this := p
_ = this
localctx = NewLiteralContext(p, p.GetParserRuleContext(), p.GetState())
p.EnterRule(localctx, 24, CELParserRULE_literal)
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.SetState(206)
p.GetErrorHandler().Sync(p)
switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 28, p.GetParserRuleContext()) {
case 1:
localctx = NewIntContext(p, localctx)
p.EnterOuterAlt(localctx, 1)
p.SetState(193)
p.GetErrorHandler().Sync(p)
_la = p.GetTokenStream().LA(1)
if _la == CELParserMINUS {
{
p.SetState(192)
var _m = p.Match(CELParserMINUS)
localctx.(*IntContext).sign = _m
}
}
{
p.SetState(195)
var _m = p.Match(CELParserNUM_INT)
localctx.(*IntContext).tok = _m
}
case 2:
localctx = NewUintContext(p, localctx)
p.EnterOuterAlt(localctx, 2)
{
p.SetState(196)
var _m = p.Match(CELParserNUM_UINT)
localctx.(*UintContext).tok = _m
}
case 3:
localctx = NewDoubleContext(p, localctx)
p.EnterOuterAlt(localctx, 3)
p.SetState(198)
p.GetErrorHandler().Sync(p)
_la = p.GetTokenStream().LA(1)
if _la == CELParserMINUS {
{
p.SetState(197)
var _m = p.Match(CELParserMINUS)
localctx.(*DoubleContext).sign = _m
}
}
{
p.SetState(200)
var _m = p.Match(CELParserNUM_FLOAT)
localctx.(*DoubleContext).tok = _m
}
case 4:
localctx = NewStringContext(p, localctx)
p.EnterOuterAlt(localctx, 4)
{
p.SetState(201)
var _m = p.Match(CELParserSTRING)
localctx.(*StringContext).tok = _m
}
case 5:
localctx = NewBytesContext(p, localctx)
p.EnterOuterAlt(localctx, 5)
{
p.SetState(202)
var _m = p.Match(CELParserBYTES)
localctx.(*BytesContext).tok = _m
}
case 6:
localctx = NewBoolTrueContext(p, localctx)
p.EnterOuterAlt(localctx, 6)
{
p.SetState(203)
var _m = p.Match(CELParserCEL_TRUE)
localctx.(*BoolTrueContext).tok = _m
}
case 7:
localctx = NewBoolFalseContext(p, localctx)
p.EnterOuterAlt(localctx, 7)
{
p.SetState(204)
var _m = p.Match(CELParserCEL_FALSE)
localctx.(*BoolFalseContext).tok = _m
}
case 8:
localctx = NewNullContext(p, localctx)
p.EnterOuterAlt(localctx, 8)
{
p.SetState(205)
var _m = p.Match(CELParserNUL)
localctx.(*NullContext).tok = _m
}
}
return localctx
}
func (p *CELParser) Sempred(localctx antlr.RuleContext, ruleIndex, predIndex int) bool {
switch ruleIndex {
case 4:
var t *RelationContext = nil
if localctx != nil {
t = localctx.(*RelationContext)
}
return p.Relation_Sempred(t, predIndex)
case 5:
var t *CalcContext = nil
if localctx != nil {
t = localctx.(*CalcContext)
}
return p.Calc_Sempred(t, predIndex)
case 7:
var t *MemberContext = nil
if localctx != nil {
t = localctx.(*MemberContext)
}
return p.Member_Sempred(t, predIndex)
default:
panic("No predicate with index: " + fmt.Sprint(ruleIndex))
}
}
func (p *CELParser) Relation_Sempred(localctx antlr.RuleContext, predIndex int) bool {
this := p
_ = this
switch predIndex {
case 0:
return p.Precpred(p.GetParserRuleContext(), 1)
default:
panic("No predicate with index: " + fmt.Sprint(predIndex))
}
}
func (p *CELParser) Calc_Sempred(localctx antlr.RuleContext, predIndex int) bool {
this := p
_ = this
switch predIndex {
case 1:
return p.Precpred(p.GetParserRuleContext(), 2)
case 2:
return p.Precpred(p.GetParserRuleContext(), 1)
default:
panic("No predicate with index: " + fmt.Sprint(predIndex))
}
}
func (p *CELParser) Member_Sempred(localctx antlr.RuleContext, predIndex int) bool {
this := p
_ = this
switch predIndex {
case 3:
return p.Precpred(p.GetParserRuleContext(), 3)
case 4:
return p.Precpred(p.GetParserRuleContext(), 2)
case 5:
return p.Precpred(p.GetParserRuleContext(), 1)
default:
panic("No predicate with index: " + fmt.Sprint(predIndex))
}
}