| 1 | // Code generated from /usr/local/google/home/jdtatum/github/cel-go/parser/gen/CEL.g4 by ANTLR 4.13.1. DO NOT EDIT. |
| 2 | |
| 3 | package gen // CEL |
| 4 | import ( |
| 5 | "fmt" |
| 6 | "strconv" |
| 7 | "sync" |
| 8 | |
| 9 | "github.com/antlr4-go/antlr/v4" |
| 10 | ) |
| 11 | |
| 12 | // Suppress unused import errors |
| 13 | var _ = fmt.Printf |
| 14 | var _ = strconv.Itoa |
| 15 | var _ = sync.Once{} |
| 16 | |
| 17 | type CELParser struct { |
| 18 | *antlr.BaseParser |
| 19 | } |
| 20 | |
| 21 | var CELParserStaticData struct { |
| 22 | once sync.Once |
| 23 | serializedATN []int32 |
| 24 | LiteralNames []string |
| 25 | SymbolicNames []string |
| 26 | RuleNames []string |
| 27 | PredictionContextCache *antlr.PredictionContextCache |
| 28 | atn *antlr.ATN |
| 29 | decisionToDFA []*antlr.DFA |
| 30 | } |
| 31 | |
| 32 | func celParserInit() { |
| 33 | staticData := &CELParserStaticData |
| 34 | staticData.LiteralNames = []string{ |
| 35 | "", "'=='", "'!='", "'in'", "'<'", "'<='", "'>='", "'>'", "'&&'", "'||'", |
| 36 | "'['", "']'", "'{'", "'}'", "'('", "')'", "'.'", "','", "'-'", "'!'", |
| 37 | "'?'", "':'", "'+'", "'*'", "'/'", "'%'", "'true'", "'false'", "'null'", |
| 38 | } |
| 39 | staticData.SymbolicNames = []string{ |
| 40 | "", "EQUALS", "NOT_EQUALS", "IN", "LESS", "LESS_EQUALS", "GREATER_EQUALS", |
| 41 | "GREATER", "LOGICAL_AND", "LOGICAL_OR", "LBRACKET", "RPRACKET", "LBRACE", |
| 42 | "RBRACE", "LPAREN", "RPAREN", "DOT", "COMMA", "MINUS", "EXCLAM", "QUESTIONMARK", |
| 43 | "COLON", "PLUS", "STAR", "SLASH", "PERCENT", "CEL_TRUE", "CEL_FALSE", |
| 44 | "NUL", "WHITESPACE", "COMMENT", "NUM_FLOAT", "NUM_INT", "NUM_UINT", |
| 45 | "STRING", "BYTES", "IDENTIFIER", "ESC_IDENTIFIER", |
| 46 | } |
| 47 | staticData.RuleNames = []string{ |
| 48 | "start", "expr", "conditionalOr", "conditionalAnd", "relation", "calc", |
| 49 | "unary", "member", "primary", "exprList", "listInit", "fieldInitializerList", |
| 50 | "optField", "mapInitializerList", "escapeIdent", "optExpr", "literal", |
| 51 | } |
| 52 | staticData.PredictionContextCache = antlr.NewPredictionContextCache() |
| 53 | staticData.serializedATN = []int32{ |
| 54 | 4, 1, 37, 259, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, |
| 55 | 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, |
| 56 | 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, |
| 57 | 2, 16, 7, 16, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, |
| 58 | 1, 44, 8, 1, 1, 2, 1, 2, 1, 2, 5, 2, 49, 8, 2, 10, 2, 12, 2, 52, 9, 2, |
| 59 | 1, 3, 1, 3, 1, 3, 5, 3, 57, 8, 3, 10, 3, 12, 3, 60, 9, 3, 1, 4, 1, 4, 1, |
| 60 | 4, 1, 4, 1, 4, 1, 4, 5, 4, 68, 8, 4, 10, 4, 12, 4, 71, 9, 4, 1, 5, 1, 5, |
| 61 | 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 5, 5, 82, 8, 5, 10, 5, 12, 5, |
| 62 | 85, 9, 5, 1, 6, 1, 6, 4, 6, 89, 8, 6, 11, 6, 12, 6, 90, 1, 6, 1, 6, 4, |
| 63 | 6, 95, 8, 6, 11, 6, 12, 6, 96, 1, 6, 3, 6, 100, 8, 6, 1, 7, 1, 7, 1, 7, |
| 64 | 1, 7, 1, 7, 1, 7, 3, 7, 108, 8, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, |
| 65 | 3, 7, 116, 8, 7, 1, 7, 1, 7, 1, 7, 1, 7, 3, 7, 122, 8, 7, 1, 7, 1, 7, 1, |
| 66 | 7, 5, 7, 127, 8, 7, 10, 7, 12, 7, 130, 9, 7, 1, 8, 3, 8, 133, 8, 8, 1, |
| 67 | 8, 1, 8, 3, 8, 137, 8, 8, 1, 8, 1, 8, 1, 8, 3, 8, 142, 8, 8, 1, 8, 1, 8, |
| 68 | 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 3, 8, 151, 8, 8, 1, 8, 3, 8, 154, 8, 8, 1, |
| 69 | 8, 1, 8, 1, 8, 3, 8, 159, 8, 8, 1, 8, 3, 8, 162, 8, 8, 1, 8, 1, 8, 3, 8, |
| 70 | 166, 8, 8, 1, 8, 1, 8, 1, 8, 5, 8, 171, 8, 8, 10, 8, 12, 8, 174, 9, 8, |
| 71 | 1, 8, 1, 8, 3, 8, 178, 8, 8, 1, 8, 3, 8, 181, 8, 8, 1, 8, 1, 8, 3, 8, 185, |
| 72 | 8, 8, 1, 9, 1, 9, 1, 9, 5, 9, 190, 8, 9, 10, 9, 12, 9, 193, 9, 9, 1, 10, |
| 73 | 1, 10, 1, 10, 5, 10, 198, 8, 10, 10, 10, 12, 10, 201, 9, 10, 1, 11, 1, |
| 74 | 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 5, 11, 211, 8, 11, 10, 11, |
| 75 | 12, 11, 214, 9, 11, 1, 12, 3, 12, 217, 8, 12, 1, 12, 1, 12, 1, 13, 1, 13, |
| 76 | 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 5, 13, 229, 8, 13, 10, 13, 12, |
| 77 | 13, 232, 9, 13, 1, 14, 1, 14, 3, 14, 236, 8, 14, 1, 15, 3, 15, 239, 8, |
| 78 | 15, 1, 15, 1, 15, 1, 16, 3, 16, 244, 8, 16, 1, 16, 1, 16, 1, 16, 3, 16, |
| 79 | 249, 8, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 3, 16, 257, 8, 16, |
| 80 | 1, 16, 0, 3, 8, 10, 14, 17, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, |
| 81 | 24, 26, 28, 30, 32, 0, 3, 1, 0, 1, 7, 1, 0, 23, 25, 2, 0, 18, 18, 22, 22, |
| 82 | 290, 0, 34, 1, 0, 0, 0, 2, 37, 1, 0, 0, 0, 4, 45, 1, 0, 0, 0, 6, 53, 1, |
| 83 | 0, 0, 0, 8, 61, 1, 0, 0, 0, 10, 72, 1, 0, 0, 0, 12, 99, 1, 0, 0, 0, 14, |
| 84 | 101, 1, 0, 0, 0, 16, 184, 1, 0, 0, 0, 18, 186, 1, 0, 0, 0, 20, 194, 1, |
| 85 | 0, 0, 0, 22, 202, 1, 0, 0, 0, 24, 216, 1, 0, 0, 0, 26, 220, 1, 0, 0, 0, |
| 86 | 28, 235, 1, 0, 0, 0, 30, 238, 1, 0, 0, 0, 32, 256, 1, 0, 0, 0, 34, 35, |
| 87 | 3, 2, 1, 0, 35, 36, 5, 0, 0, 1, 36, 1, 1, 0, 0, 0, 37, 43, 3, 4, 2, 0, |
| 88 | 38, 39, 5, 20, 0, 0, 39, 40, 3, 4, 2, 0, 40, 41, 5, 21, 0, 0, 41, 42, 3, |
| 89 | 2, 1, 0, 42, 44, 1, 0, 0, 0, 43, 38, 1, 0, 0, 0, 43, 44, 1, 0, 0, 0, 44, |
| 90 | 3, 1, 0, 0, 0, 45, 50, 3, 6, 3, 0, 46, 47, 5, 9, 0, 0, 47, 49, 3, 6, 3, |
| 91 | 0, 48, 46, 1, 0, 0, 0, 49, 52, 1, 0, 0, 0, 50, 48, 1, 0, 0, 0, 50, 51, |
| 92 | 1, 0, 0, 0, 51, 5, 1, 0, 0, 0, 52, 50, 1, 0, 0, 0, 53, 58, 3, 8, 4, 0, |
| 93 | 54, 55, 5, 8, 0, 0, 55, 57, 3, 8, 4, 0, 56, 54, 1, 0, 0, 0, 57, 60, 1, |
| 94 | 0, 0, 0, 58, 56, 1, 0, 0, 0, 58, 59, 1, 0, 0, 0, 59, 7, 1, 0, 0, 0, 60, |
| 95 | 58, 1, 0, 0, 0, 61, 62, 6, 4, -1, 0, 62, 63, 3, 10, 5, 0, 63, 69, 1, 0, |
| 96 | 0, 0, 64, 65, 10, 1, 0, 0, 65, 66, 7, 0, 0, 0, 66, 68, 3, 8, 4, 2, 67, |
| 97 | 64, 1, 0, 0, 0, 68, 71, 1, 0, 0, 0, 69, 67, 1, 0, 0, 0, 69, 70, 1, 0, 0, |
| 98 | 0, 70, 9, 1, 0, 0, 0, 71, 69, 1, 0, 0, 0, 72, 73, 6, 5, -1, 0, 73, 74, |
| 99 | 3, 12, 6, 0, 74, 83, 1, 0, 0, 0, 75, 76, 10, 2, 0, 0, 76, 77, 7, 1, 0, |
| 100 | 0, 77, 82, 3, 10, 5, 3, 78, 79, 10, 1, 0, 0, 79, 80, 7, 2, 0, 0, 80, 82, |
| 101 | 3, 10, 5, 2, 81, 75, 1, 0, 0, 0, 81, 78, 1, 0, 0, 0, 82, 85, 1, 0, 0, 0, |
| 102 | 83, 81, 1, 0, 0, 0, 83, 84, 1, 0, 0, 0, 84, 11, 1, 0, 0, 0, 85, 83, 1, |
| 103 | 0, 0, 0, 86, 100, 3, 14, 7, 0, 87, 89, 5, 19, 0, 0, 88, 87, 1, 0, 0, 0, |
| 104 | 89, 90, 1, 0, 0, 0, 90, 88, 1, 0, 0, 0, 90, 91, 1, 0, 0, 0, 91, 92, 1, |
| 105 | 0, 0, 0, 92, 100, 3, 14, 7, 0, 93, 95, 5, 18, 0, 0, 94, 93, 1, 0, 0, 0, |
| 106 | 95, 96, 1, 0, 0, 0, 96, 94, 1, 0, 0, 0, 96, 97, 1, 0, 0, 0, 97, 98, 1, |
| 107 | 0, 0, 0, 98, 100, 3, 14, 7, 0, 99, 86, 1, 0, 0, 0, 99, 88, 1, 0, 0, 0, |
| 108 | 99, 94, 1, 0, 0, 0, 100, 13, 1, 0, 0, 0, 101, 102, 6, 7, -1, 0, 102, 103, |
| 109 | 3, 16, 8, 0, 103, 128, 1, 0, 0, 0, 104, 105, 10, 3, 0, 0, 105, 107, 5, |
| 110 | 16, 0, 0, 106, 108, 5, 20, 0, 0, 107, 106, 1, 0, 0, 0, 107, 108, 1, 0, |
| 111 | 0, 0, 108, 109, 1, 0, 0, 0, 109, 127, 3, 28, 14, 0, 110, 111, 10, 2, 0, |
| 112 | 0, 111, 112, 5, 16, 0, 0, 112, 113, 5, 36, 0, 0, 113, 115, 5, 14, 0, 0, |
| 113 | 114, 116, 3, 18, 9, 0, 115, 114, 1, 0, 0, 0, 115, 116, 1, 0, 0, 0, 116, |
| 114 | 117, 1, 0, 0, 0, 117, 127, 5, 15, 0, 0, 118, 119, 10, 1, 0, 0, 119, 121, |
| 115 | 5, 10, 0, 0, 120, 122, 5, 20, 0, 0, 121, 120, 1, 0, 0, 0, 121, 122, 1, |
| 116 | 0, 0, 0, 122, 123, 1, 0, 0, 0, 123, 124, 3, 2, 1, 0, 124, 125, 5, 11, 0, |
| 117 | 0, 125, 127, 1, 0, 0, 0, 126, 104, 1, 0, 0, 0, 126, 110, 1, 0, 0, 0, 126, |
| 118 | 118, 1, 0, 0, 0, 127, 130, 1, 0, 0, 0, 128, 126, 1, 0, 0, 0, 128, 129, |
| 119 | 1, 0, 0, 0, 129, 15, 1, 0, 0, 0, 130, 128, 1, 0, 0, 0, 131, 133, 5, 16, |
| 120 | 0, 0, 132, 131, 1, 0, 0, 0, 132, 133, 1, 0, 0, 0, 133, 134, 1, 0, 0, 0, |
| 121 | 134, 185, 5, 36, 0, 0, 135, 137, 5, 16, 0, 0, 136, 135, 1, 0, 0, 0, 136, |
| 122 | 137, 1, 0, 0, 0, 137, 138, 1, 0, 0, 0, 138, 139, 5, 36, 0, 0, 139, 141, |
| 123 | 5, 14, 0, 0, 140, 142, 3, 18, 9, 0, 141, 140, 1, 0, 0, 0, 141, 142, 1, |
| 124 | 0, 0, 0, 142, 143, 1, 0, 0, 0, 143, 185, 5, 15, 0, 0, 144, 145, 5, 14, |
| 125 | 0, 0, 145, 146, 3, 2, 1, 0, 146, 147, 5, 15, 0, 0, 147, 185, 1, 0, 0, 0, |
| 126 | 148, 150, 5, 10, 0, 0, 149, 151, 3, 20, 10, 0, 150, 149, 1, 0, 0, 0, 150, |
| 127 | 151, 1, 0, 0, 0, 151, 153, 1, 0, 0, 0, 152, 154, 5, 17, 0, 0, 153, 152, |
| 128 | 1, 0, 0, 0, 153, 154, 1, 0, 0, 0, 154, 155, 1, 0, 0, 0, 155, 185, 5, 11, |
| 129 | 0, 0, 156, 158, 5, 12, 0, 0, 157, 159, 3, 26, 13, 0, 158, 157, 1, 0, 0, |
| 130 | 0, 158, 159, 1, 0, 0, 0, 159, 161, 1, 0, 0, 0, 160, 162, 5, 17, 0, 0, 161, |
| 131 | 160, 1, 0, 0, 0, 161, 162, 1, 0, 0, 0, 162, 163, 1, 0, 0, 0, 163, 185, |
| 132 | 5, 13, 0, 0, 164, 166, 5, 16, 0, 0, 165, 164, 1, 0, 0, 0, 165, 166, 1, |
| 133 | 0, 0, 0, 166, 167, 1, 0, 0, 0, 167, 172, 5, 36, 0, 0, 168, 169, 5, 16, |
| 134 | 0, 0, 169, 171, 5, 36, 0, 0, 170, 168, 1, 0, 0, 0, 171, 174, 1, 0, 0, 0, |
| 135 | 172, 170, 1, 0, 0, 0, 172, 173, 1, 0, 0, 0, 173, 175, 1, 0, 0, 0, 174, |
| 136 | 172, 1, 0, 0, 0, 175, 177, 5, 12, 0, 0, 176, 178, 3, 22, 11, 0, 177, 176, |
| 137 | 1, 0, 0, 0, 177, 178, 1, 0, 0, 0, 178, 180, 1, 0, 0, 0, 179, 181, 5, 17, |
| 138 | 0, 0, 180, 179, 1, 0, 0, 0, 180, 181, 1, 0, 0, 0, 181, 182, 1, 0, 0, 0, |
| 139 | 182, 185, 5, 13, 0, 0, 183, 185, 3, 32, 16, 0, 184, 132, 1, 0, 0, 0, 184, |
| 140 | 136, 1, 0, 0, 0, 184, 144, 1, 0, 0, 0, 184, 148, 1, 0, 0, 0, 184, 156, |
| 141 | 1, 0, 0, 0, 184, 165, 1, 0, 0, 0, 184, 183, 1, 0, 0, 0, 185, 17, 1, 0, |
| 142 | 0, 0, 186, 191, 3, 2, 1, 0, 187, 188, 5, 17, 0, 0, 188, 190, 3, 2, 1, 0, |
| 143 | 189, 187, 1, 0, 0, 0, 190, 193, 1, 0, 0, 0, 191, 189, 1, 0, 0, 0, 191, |
| 144 | 192, 1, 0, 0, 0, 192, 19, 1, 0, 0, 0, 193, 191, 1, 0, 0, 0, 194, 199, 3, |
| 145 | 30, 15, 0, 195, 196, 5, 17, 0, 0, 196, 198, 3, 30, 15, 0, 197, 195, 1, |
| 146 | 0, 0, 0, 198, 201, 1, 0, 0, 0, 199, 197, 1, 0, 0, 0, 199, 200, 1, 0, 0, |
| 147 | 0, 200, 21, 1, 0, 0, 0, 201, 199, 1, 0, 0, 0, 202, 203, 3, 24, 12, 0, 203, |
| 148 | 204, 5, 21, 0, 0, 204, 212, 3, 2, 1, 0, 205, 206, 5, 17, 0, 0, 206, 207, |
| 149 | 3, 24, 12, 0, 207, 208, 5, 21, 0, 0, 208, 209, 3, 2, 1, 0, 209, 211, 1, |
| 150 | 0, 0, 0, 210, 205, 1, 0, 0, 0, 211, 214, 1, 0, 0, 0, 212, 210, 1, 0, 0, |
| 151 | 0, 212, 213, 1, 0, 0, 0, 213, 23, 1, 0, 0, 0, 214, 212, 1, 0, 0, 0, 215, |
| 152 | 217, 5, 20, 0, 0, 216, 215, 1, 0, 0, 0, 216, 217, 1, 0, 0, 0, 217, 218, |
| 153 | 1, 0, 0, 0, 218, 219, 3, 28, 14, 0, 219, 25, 1, 0, 0, 0, 220, 221, 3, 30, |
| 154 | 15, 0, 221, 222, 5, 21, 0, 0, 222, 230, 3, 2, 1, 0, 223, 224, 5, 17, 0, |
| 155 | 0, 224, 225, 3, 30, 15, 0, 225, 226, 5, 21, 0, 0, 226, 227, 3, 2, 1, 0, |
| 156 | 227, 229, 1, 0, 0, 0, 228, 223, 1, 0, 0, 0, 229, 232, 1, 0, 0, 0, 230, |
| 157 | 228, 1, 0, 0, 0, 230, 231, 1, 0, 0, 0, 231, 27, 1, 0, 0, 0, 232, 230, 1, |
| 158 | 0, 0, 0, 233, 236, 5, 36, 0, 0, 234, 236, 5, 37, 0, 0, 235, 233, 1, 0, |
| 159 | 0, 0, 235, 234, 1, 0, 0, 0, 236, 29, 1, 0, 0, 0, 237, 239, 5, 20, 0, 0, |
| 160 | 238, 237, 1, 0, 0, 0, 238, 239, 1, 0, 0, 0, 239, 240, 1, 0, 0, 0, 240, |
| 161 | 241, 3, 2, 1, 0, 241, 31, 1, 0, 0, 0, 242, 244, 5, 18, 0, 0, 243, 242, |
| 162 | 1, 0, 0, 0, 243, 244, 1, 0, 0, 0, 244, 245, 1, 0, 0, 0, 245, 257, 5, 32, |
| 163 | 0, 0, 246, 257, 5, 33, 0, 0, 247, 249, 5, 18, 0, 0, 248, 247, 1, 0, 0, |
| 164 | 0, 248, 249, 1, 0, 0, 0, 249, 250, 1, 0, 0, 0, 250, 257, 5, 31, 0, 0, 251, |
| 165 | 257, 5, 34, 0, 0, 252, 257, 5, 35, 0, 0, 253, 257, 5, 26, 0, 0, 254, 257, |
| 166 | 5, 27, 0, 0, 255, 257, 5, 28, 0, 0, 256, 243, 1, 0, 0, 0, 256, 246, 1, |
| 167 | 0, 0, 0, 256, 248, 1, 0, 0, 0, 256, 251, 1, 0, 0, 0, 256, 252, 1, 0, 0, |
| 168 | 0, 256, 253, 1, 0, 0, 0, 256, 254, 1, 0, 0, 0, 256, 255, 1, 0, 0, 0, 257, |
| 169 | 33, 1, 0, 0, 0, 36, 43, 50, 58, 69, 81, 83, 90, 96, 99, 107, 115, 121, |
| 170 | 126, 128, 132, 136, 141, 150, 153, 158, 161, 165, 172, 177, 180, 184, 191, |
| 171 | 199, 212, 216, 230, 235, 238, 243, 248, 256, |
| 172 | } |
| 173 | deserializer := antlr.NewATNDeserializer(nil) |
| 174 | staticData.atn = deserializer.Deserialize(staticData.serializedATN) |
| 175 | atn := staticData.atn |
| 176 | staticData.decisionToDFA = make([]*antlr.DFA, len(atn.DecisionToState)) |
| 177 | decisionToDFA := staticData.decisionToDFA |
| 178 | for index, state := range atn.DecisionToState { |
| 179 | decisionToDFA[index] = antlr.NewDFA(state, index) |
| 180 | } |
| 181 | } |
| 182 | |
| 183 | // CELParserInit initializes any static state used to implement CELParser. By default the |
| 184 | // static state used to implement the parser is lazily initialized during the first call to |
| 185 | // NewCELParser(). You can call this function if you wish to initialize the static state ahead |
| 186 | // of time. |
| 187 | func CELParserInit() { |
| 188 | staticData := &CELParserStaticData |
| 189 | staticData.once.Do(celParserInit) |
| 190 | } |
| 191 | |
| 192 | // NewCELParser produces a new parser instance for the optional input antlr.TokenStream. |
| 193 | func NewCELParser(input antlr.TokenStream) *CELParser { |
| 194 | CELParserInit() |
| 195 | this := new(CELParser) |
| 196 | this.BaseParser = antlr.NewBaseParser(input) |
| 197 | staticData := &CELParserStaticData |
| 198 | this.Interpreter = antlr.NewParserATNSimulator(this, staticData.atn, staticData.decisionToDFA, staticData.PredictionContextCache) |
| 199 | this.RuleNames = staticData.RuleNames |
| 200 | this.LiteralNames = staticData.LiteralNames |
| 201 | this.SymbolicNames = staticData.SymbolicNames |
| 202 | this.GrammarFileName = "CEL.g4" |
| 203 | |
| 204 | return this |
| 205 | } |
| 206 | |
| 207 | // CELParser tokens. |
| 208 | const ( |
| 209 | CELParserEOF = antlr.TokenEOF |
| 210 | CELParserEQUALS = 1 |
| 211 | CELParserNOT_EQUALS = 2 |
| 212 | CELParserIN = 3 |
| 213 | CELParserLESS = 4 |
| 214 | CELParserLESS_EQUALS = 5 |
| 215 | CELParserGREATER_EQUALS = 6 |
| 216 | CELParserGREATER = 7 |
| 217 | CELParserLOGICAL_AND = 8 |
| 218 | CELParserLOGICAL_OR = 9 |
| 219 | CELParserLBRACKET = 10 |
| 220 | CELParserRPRACKET = 11 |
| 221 | CELParserLBRACE = 12 |
| 222 | CELParserRBRACE = 13 |
| 223 | CELParserLPAREN = 14 |
| 224 | CELParserRPAREN = 15 |
| 225 | CELParserDOT = 16 |
| 226 | CELParserCOMMA = 17 |
| 227 | CELParserMINUS = 18 |
| 228 | CELParserEXCLAM = 19 |
| 229 | CELParserQUESTIONMARK = 20 |
| 230 | CELParserCOLON = 21 |
| 231 | CELParserPLUS = 22 |
| 232 | CELParserSTAR = 23 |
| 233 | CELParserSLASH = 24 |
| 234 | CELParserPERCENT = 25 |
| 235 | CELParserCEL_TRUE = 26 |
| 236 | CELParserCEL_FALSE = 27 |
| 237 | CELParserNUL = 28 |
| 238 | CELParserWHITESPACE = 29 |
| 239 | CELParserCOMMENT = 30 |
| 240 | CELParserNUM_FLOAT = 31 |
| 241 | CELParserNUM_INT = 32 |
| 242 | CELParserNUM_UINT = 33 |
| 243 | CELParserSTRING = 34 |
| 244 | CELParserBYTES = 35 |
| 245 | CELParserIDENTIFIER = 36 |
| 246 | CELParserESC_IDENTIFIER = 37 |
| 247 | ) |
| 248 | |
| 249 | // CELParser rules. |
| 250 | const ( |
| 251 | CELParserRULE_start = 0 |
| 252 | CELParserRULE_expr = 1 |
| 253 | CELParserRULE_conditionalOr = 2 |
| 254 | CELParserRULE_conditionalAnd = 3 |
| 255 | CELParserRULE_relation = 4 |
| 256 | CELParserRULE_calc = 5 |
| 257 | CELParserRULE_unary = 6 |
| 258 | CELParserRULE_member = 7 |
| 259 | CELParserRULE_primary = 8 |
| 260 | CELParserRULE_exprList = 9 |
| 261 | CELParserRULE_listInit = 10 |
| 262 | CELParserRULE_fieldInitializerList = 11 |
| 263 | CELParserRULE_optField = 12 |
| 264 | CELParserRULE_mapInitializerList = 13 |
| 265 | CELParserRULE_escapeIdent = 14 |
| 266 | CELParserRULE_optExpr = 15 |
| 267 | CELParserRULE_literal = 16 |
| 268 | ) |
| 269 | |
| 270 | // IStartContext is an interface to support dynamic dispatch. |
| 271 | type IStartContext interface { |
| 272 | antlr.ParserRuleContext |
| 273 | |
| 274 | // GetParser returns the parser. |
| 275 | GetParser() antlr.Parser |
| 276 | |
| 277 | // GetE returns the e rule contexts. |
| 278 | GetE() IExprContext |
| 279 | |
| 280 | // SetE sets the e rule contexts. |
| 281 | SetE(IExprContext) |
| 282 | |
| 283 | // Getter signatures |
| 284 | EOF() antlr.TerminalNode |
| 285 | Expr() IExprContext |
| 286 | |
| 287 | // IsStartContext differentiates from other interfaces. |
| 288 | IsStartContext() |
| 289 | } |
| 290 | |
| 291 | type StartContext struct { |
| 292 | antlr.BaseParserRuleContext |
| 293 | parser antlr.Parser |
| 294 | e IExprContext |
| 295 | } |
| 296 | |
| 297 | func NewEmptyStartContext() *StartContext { |
| 298 | var p = new(StartContext) |
| 299 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) |
| 300 | p.RuleIndex = CELParserRULE_start |
| 301 | return p |
| 302 | } |
| 303 | |
| 304 | func InitEmptyStartContext(p *StartContext) { |
| 305 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) |
| 306 | p.RuleIndex = CELParserRULE_start |
| 307 | } |
| 308 | |
| 309 | func (*StartContext) IsStartContext() {} |
| 310 | |
| 311 | func NewStartContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *StartContext { |
| 312 | var p = new(StartContext) |
| 313 | |
| 314 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) |
| 315 | |
| 316 | p.parser = parser |
| 317 | p.RuleIndex = CELParserRULE_start |
| 318 | |
| 319 | return p |
| 320 | } |
| 321 | |
| 322 | func (s *StartContext) GetParser() antlr.Parser { return s.parser } |
| 323 | |
| 324 | func (s *StartContext) GetE() IExprContext { return s.e } |
| 325 | |
| 326 | func (s *StartContext) SetE(v IExprContext) { s.e = v } |
| 327 | |
| 328 | func (s *StartContext) EOF() antlr.TerminalNode { |
| 329 | return s.GetToken(CELParserEOF, 0) |
| 330 | } |
| 331 | |
| 332 | func (s *StartContext) Expr() IExprContext { |
| 333 | var t antlr.RuleContext |
| 334 | for _, ctx := range s.GetChildren() { |
| 335 | if _, ok := ctx.(IExprContext); ok { |
| 336 | t = ctx.(antlr.RuleContext) |
| 337 | break |
| 338 | } |
| 339 | } |
| 340 | |
| 341 | if t == nil { |
| 342 | return nil |
| 343 | } |
| 344 | |
| 345 | return t.(IExprContext) |
| 346 | } |
| 347 | |
| 348 | func (s *StartContext) GetRuleContext() antlr.RuleContext { |
| 349 | return s |
| 350 | } |
| 351 | |
| 352 | func (s *StartContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { |
| 353 | return antlr.TreesStringTree(s, ruleNames, recog) |
| 354 | } |
| 355 | |
| 356 | func (s *StartContext) EnterRule(listener antlr.ParseTreeListener) { |
| 357 | if listenerT, ok := listener.(CELListener); ok { |
| 358 | listenerT.EnterStart(s) |
| 359 | } |
| 360 | } |
| 361 | |
| 362 | func (s *StartContext) ExitRule(listener antlr.ParseTreeListener) { |
| 363 | if listenerT, ok := listener.(CELListener); ok { |
| 364 | listenerT.ExitStart(s) |
| 365 | } |
| 366 | } |
| 367 | |
| 368 | func (s *StartContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { |
| 369 | switch t := visitor.(type) { |
| 370 | case CELVisitor: |
| 371 | return t.VisitStart(s) |
| 372 | |
| 373 | default: |
| 374 | return t.VisitChildren(s) |
| 375 | } |
| 376 | } |
| 377 | |
| 378 | func (p *CELParser) Start_() (localctx IStartContext) { |
| 379 | localctx = NewStartContext(p, p.GetParserRuleContext(), p.GetState()) |
| 380 | p.EnterRule(localctx, 0, CELParserRULE_start) |
| 381 | p.EnterOuterAlt(localctx, 1) |
| 382 | { |
| 383 | p.SetState(34) |
| 384 | |
| 385 | var _x = p.Expr() |
| 386 | |
| 387 | localctx.(*StartContext).e = _x |
| 388 | } |
| 389 | { |
| 390 | p.SetState(35) |
| 391 | p.Match(CELParserEOF) |
| 392 | if p.HasError() { |
| 393 | // Recognition error - abort rule |
| 394 | goto errorExit |
| 395 | } |
| 396 | } |
| 397 | |
| 398 | errorExit: |
| 399 | if p.HasError() { |
| 400 | v := p.GetError() |
| 401 | localctx.SetException(v) |
| 402 | p.GetErrorHandler().ReportError(p, v) |
| 403 | p.GetErrorHandler().Recover(p, v) |
| 404 | p.SetError(nil) |
| 405 | } |
| 406 | p.ExitRule() |
| 407 | return localctx |
| 408 | goto errorExit // Trick to prevent compiler error if the label is not used |
| 409 | } |
| 410 | |
| 411 | // IExprContext is an interface to support dynamic dispatch. |
| 412 | type IExprContext interface { |
| 413 | antlr.ParserRuleContext |
| 414 | |
| 415 | // GetParser returns the parser. |
| 416 | GetParser() antlr.Parser |
| 417 | |
| 418 | // GetOp returns the op token. |
| 419 | GetOp() antlr.Token |
| 420 | |
| 421 | // SetOp sets the op token. |
| 422 | SetOp(antlr.Token) |
| 423 | |
| 424 | // GetE returns the e rule contexts. |
| 425 | GetE() IConditionalOrContext |
| 426 | |
| 427 | // GetE1 returns the e1 rule contexts. |
| 428 | GetE1() IConditionalOrContext |
| 429 | |
| 430 | // GetE2 returns the e2 rule contexts. |
| 431 | GetE2() IExprContext |
| 432 | |
| 433 | // SetE sets the e rule contexts. |
| 434 | SetE(IConditionalOrContext) |
| 435 | |
| 436 | // SetE1 sets the e1 rule contexts. |
| 437 | SetE1(IConditionalOrContext) |
| 438 | |
| 439 | // SetE2 sets the e2 rule contexts. |
| 440 | SetE2(IExprContext) |
| 441 | |
| 442 | // Getter signatures |
| 443 | AllConditionalOr() []IConditionalOrContext |
| 444 | ConditionalOr(i int) IConditionalOrContext |
| 445 | COLON() antlr.TerminalNode |
| 446 | QUESTIONMARK() antlr.TerminalNode |
| 447 | Expr() IExprContext |
| 448 | |
| 449 | // IsExprContext differentiates from other interfaces. |
| 450 | IsExprContext() |
| 451 | } |
| 452 | |
| 453 | type ExprContext struct { |
| 454 | antlr.BaseParserRuleContext |
| 455 | parser antlr.Parser |
| 456 | e IConditionalOrContext |
| 457 | op antlr.Token |
| 458 | e1 IConditionalOrContext |
| 459 | e2 IExprContext |
| 460 | } |
| 461 | |
| 462 | func NewEmptyExprContext() *ExprContext { |
| 463 | var p = new(ExprContext) |
| 464 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) |
| 465 | p.RuleIndex = CELParserRULE_expr |
| 466 | return p |
| 467 | } |
| 468 | |
| 469 | func InitEmptyExprContext(p *ExprContext) { |
| 470 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) |
| 471 | p.RuleIndex = CELParserRULE_expr |
| 472 | } |
| 473 | |
| 474 | func (*ExprContext) IsExprContext() {} |
| 475 | |
| 476 | func NewExprContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ExprContext { |
| 477 | var p = new(ExprContext) |
| 478 | |
| 479 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) |
| 480 | |
| 481 | p.parser = parser |
| 482 | p.RuleIndex = CELParserRULE_expr |
| 483 | |
| 484 | return p |
| 485 | } |
| 486 | |
| 487 | func (s *ExprContext) GetParser() antlr.Parser { return s.parser } |
| 488 | |
| 489 | func (s *ExprContext) GetOp() antlr.Token { return s.op } |
| 490 | |
| 491 | func (s *ExprContext) SetOp(v antlr.Token) { s.op = v } |
| 492 | |
| 493 | func (s *ExprContext) GetE() IConditionalOrContext { return s.e } |
| 494 | |
| 495 | func (s *ExprContext) GetE1() IConditionalOrContext { return s.e1 } |
| 496 | |
| 497 | func (s *ExprContext) GetE2() IExprContext { return s.e2 } |
| 498 | |
| 499 | func (s *ExprContext) SetE(v IConditionalOrContext) { s.e = v } |
| 500 | |
| 501 | func (s *ExprContext) SetE1(v IConditionalOrContext) { s.e1 = v } |
| 502 | |
| 503 | func (s *ExprContext) SetE2(v IExprContext) { s.e2 = v } |
| 504 | |
| 505 | func (s *ExprContext) AllConditionalOr() []IConditionalOrContext { |
| 506 | children := s.GetChildren() |
| 507 | len := 0 |
| 508 | for _, ctx := range children { |
| 509 | if _, ok := ctx.(IConditionalOrContext); ok { |
| 510 | len++ |
| 511 | } |
| 512 | } |
| 513 | |
| 514 | tst := make([]IConditionalOrContext, len) |
| 515 | i := 0 |
| 516 | for _, ctx := range children { |
| 517 | if t, ok := ctx.(IConditionalOrContext); ok { |
| 518 | tst[i] = t.(IConditionalOrContext) |
| 519 | i++ |
| 520 | } |
| 521 | } |
| 522 | |
| 523 | return tst |
| 524 | } |
| 525 | |
| 526 | func (s *ExprContext) ConditionalOr(i int) IConditionalOrContext { |
| 527 | var t antlr.RuleContext |
| 528 | j := 0 |
| 529 | for _, ctx := range s.GetChildren() { |
| 530 | if _, ok := ctx.(IConditionalOrContext); ok { |
| 531 | if j == i { |
| 532 | t = ctx.(antlr.RuleContext) |
| 533 | break |
| 534 | } |
| 535 | j++ |
| 536 | } |
| 537 | } |
| 538 | |
| 539 | if t == nil { |
| 540 | return nil |
| 541 | } |
| 542 | |
| 543 | return t.(IConditionalOrContext) |
| 544 | } |
| 545 | |
| 546 | func (s *ExprContext) COLON() antlr.TerminalNode { |
| 547 | return s.GetToken(CELParserCOLON, 0) |
| 548 | } |
| 549 | |
| 550 | func (s *ExprContext) QUESTIONMARK() antlr.TerminalNode { |
| 551 | return s.GetToken(CELParserQUESTIONMARK, 0) |
| 552 | } |
| 553 | |
| 554 | func (s *ExprContext) Expr() IExprContext { |
| 555 | var t antlr.RuleContext |
| 556 | for _, ctx := range s.GetChildren() { |
| 557 | if _, ok := ctx.(IExprContext); ok { |
| 558 | t = ctx.(antlr.RuleContext) |
| 559 | break |
| 560 | } |
| 561 | } |
| 562 | |
| 563 | if t == nil { |
| 564 | return nil |
| 565 | } |
| 566 | |
| 567 | return t.(IExprContext) |
| 568 | } |
| 569 | |
| 570 | func (s *ExprContext) GetRuleContext() antlr.RuleContext { |
| 571 | return s |
| 572 | } |
| 573 | |
| 574 | func (s *ExprContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { |
| 575 | return antlr.TreesStringTree(s, ruleNames, recog) |
| 576 | } |
| 577 | |
| 578 | func (s *ExprContext) EnterRule(listener antlr.ParseTreeListener) { |
| 579 | if listenerT, ok := listener.(CELListener); ok { |
| 580 | listenerT.EnterExpr(s) |
| 581 | } |
| 582 | } |
| 583 | |
| 584 | func (s *ExprContext) ExitRule(listener antlr.ParseTreeListener) { |
| 585 | if listenerT, ok := listener.(CELListener); ok { |
| 586 | listenerT.ExitExpr(s) |
| 587 | } |
| 588 | } |
| 589 | |
| 590 | func (s *ExprContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { |
| 591 | switch t := visitor.(type) { |
| 592 | case CELVisitor: |
| 593 | return t.VisitExpr(s) |
| 594 | |
| 595 | default: |
| 596 | return t.VisitChildren(s) |
| 597 | } |
| 598 | } |
| 599 | |
| 600 | func (p *CELParser) Expr() (localctx IExprContext) { |
| 601 | localctx = NewExprContext(p, p.GetParserRuleContext(), p.GetState()) |
| 602 | p.EnterRule(localctx, 2, CELParserRULE_expr) |
| 603 | var _la int |
| 604 | |
| 605 | p.EnterOuterAlt(localctx, 1) |
| 606 | { |
| 607 | p.SetState(37) |
| 608 | |
| 609 | var _x = p.ConditionalOr() |
| 610 | |
| 611 | localctx.(*ExprContext).e = _x |
| 612 | } |
| 613 | p.SetState(43) |
| 614 | p.GetErrorHandler().Sync(p) |
| 615 | if p.HasError() { |
| 616 | goto errorExit |
| 617 | } |
| 618 | _la = p.GetTokenStream().LA(1) |
| 619 | |
| 620 | if _la == CELParserQUESTIONMARK { |
| 621 | { |
| 622 | p.SetState(38) |
| 623 | |
| 624 | var _m = p.Match(CELParserQUESTIONMARK) |
| 625 | |
| 626 | localctx.(*ExprContext).op = _m |
| 627 | if p.HasError() { |
| 628 | // Recognition error - abort rule |
| 629 | goto errorExit |
| 630 | } |
| 631 | } |
| 632 | { |
| 633 | p.SetState(39) |
| 634 | |
| 635 | var _x = p.ConditionalOr() |
| 636 | |
| 637 | localctx.(*ExprContext).e1 = _x |
| 638 | } |
| 639 | { |
| 640 | p.SetState(40) |
| 641 | p.Match(CELParserCOLON) |
| 642 | if p.HasError() { |
| 643 | // Recognition error - abort rule |
| 644 | goto errorExit |
| 645 | } |
| 646 | } |
| 647 | { |
| 648 | p.SetState(41) |
| 649 | |
| 650 | var _x = p.Expr() |
| 651 | |
| 652 | localctx.(*ExprContext).e2 = _x |
| 653 | } |
| 654 | |
| 655 | } |
| 656 | |
| 657 | errorExit: |
| 658 | if p.HasError() { |
| 659 | v := p.GetError() |
| 660 | localctx.SetException(v) |
| 661 | p.GetErrorHandler().ReportError(p, v) |
| 662 | p.GetErrorHandler().Recover(p, v) |
| 663 | p.SetError(nil) |
| 664 | } |
| 665 | p.ExitRule() |
| 666 | return localctx |
| 667 | goto errorExit // Trick to prevent compiler error if the label is not used |
| 668 | } |
| 669 | |
| 670 | // IConditionalOrContext is an interface to support dynamic dispatch. |
| 671 | type IConditionalOrContext interface { |
| 672 | antlr.ParserRuleContext |
| 673 | |
| 674 | // GetParser returns the parser. |
| 675 | GetParser() antlr.Parser |
| 676 | |
| 677 | // GetS9 returns the s9 token. |
| 678 | GetS9() antlr.Token |
| 679 | |
| 680 | // SetS9 sets the s9 token. |
| 681 | SetS9(antlr.Token) |
| 682 | |
| 683 | // GetOps returns the ops token list. |
| 684 | GetOps() []antlr.Token |
| 685 | |
| 686 | // SetOps sets the ops token list. |
| 687 | SetOps([]antlr.Token) |
| 688 | |
| 689 | // GetE returns the e rule contexts. |
| 690 | GetE() IConditionalAndContext |
| 691 | |
| 692 | // Get_conditionalAnd returns the _conditionalAnd rule contexts. |
| 693 | Get_conditionalAnd() IConditionalAndContext |
| 694 | |
| 695 | // SetE sets the e rule contexts. |
| 696 | SetE(IConditionalAndContext) |
| 697 | |
| 698 | // Set_conditionalAnd sets the _conditionalAnd rule contexts. |
| 699 | Set_conditionalAnd(IConditionalAndContext) |
| 700 | |
| 701 | // GetE1 returns the e1 rule context list. |
| 702 | GetE1() []IConditionalAndContext |
| 703 | |
| 704 | // SetE1 sets the e1 rule context list. |
| 705 | SetE1([]IConditionalAndContext) |
| 706 | |
| 707 | // Getter signatures |
| 708 | AllConditionalAnd() []IConditionalAndContext |
| 709 | ConditionalAnd(i int) IConditionalAndContext |
| 710 | AllLOGICAL_OR() []antlr.TerminalNode |
| 711 | LOGICAL_OR(i int) antlr.TerminalNode |
| 712 | |
| 713 | // IsConditionalOrContext differentiates from other interfaces. |
| 714 | IsConditionalOrContext() |
| 715 | } |
| 716 | |
| 717 | type ConditionalOrContext struct { |
| 718 | antlr.BaseParserRuleContext |
| 719 | parser antlr.Parser |
| 720 | e IConditionalAndContext |
| 721 | s9 antlr.Token |
| 722 | ops []antlr.Token |
| 723 | _conditionalAnd IConditionalAndContext |
| 724 | e1 []IConditionalAndContext |
| 725 | } |
| 726 | |
| 727 | func NewEmptyConditionalOrContext() *ConditionalOrContext { |
| 728 | var p = new(ConditionalOrContext) |
| 729 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) |
| 730 | p.RuleIndex = CELParserRULE_conditionalOr |
| 731 | return p |
| 732 | } |
| 733 | |
| 734 | func InitEmptyConditionalOrContext(p *ConditionalOrContext) { |
| 735 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) |
| 736 | p.RuleIndex = CELParserRULE_conditionalOr |
| 737 | } |
| 738 | |
| 739 | func (*ConditionalOrContext) IsConditionalOrContext() {} |
| 740 | |
| 741 | func NewConditionalOrContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ConditionalOrContext { |
| 742 | var p = new(ConditionalOrContext) |
| 743 | |
| 744 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) |
| 745 | |
| 746 | p.parser = parser |
| 747 | p.RuleIndex = CELParserRULE_conditionalOr |
| 748 | |
| 749 | return p |
| 750 | } |
| 751 | |
| 752 | func (s *ConditionalOrContext) GetParser() antlr.Parser { return s.parser } |
| 753 | |
| 754 | func (s *ConditionalOrContext) GetS9() antlr.Token { return s.s9 } |
| 755 | |
| 756 | func (s *ConditionalOrContext) SetS9(v antlr.Token) { s.s9 = v } |
| 757 | |
| 758 | func (s *ConditionalOrContext) GetOps() []antlr.Token { return s.ops } |
| 759 | |
| 760 | func (s *ConditionalOrContext) SetOps(v []antlr.Token) { s.ops = v } |
| 761 | |
| 762 | func (s *ConditionalOrContext) GetE() IConditionalAndContext { return s.e } |
| 763 | |
| 764 | func (s *ConditionalOrContext) Get_conditionalAnd() IConditionalAndContext { return s._conditionalAnd } |
| 765 | |
| 766 | func (s *ConditionalOrContext) SetE(v IConditionalAndContext) { s.e = v } |
| 767 | |
| 768 | func (s *ConditionalOrContext) Set_conditionalAnd(v IConditionalAndContext) { s._conditionalAnd = v } |
| 769 | |
| 770 | func (s *ConditionalOrContext) GetE1() []IConditionalAndContext { return s.e1 } |
| 771 | |
| 772 | func (s *ConditionalOrContext) SetE1(v []IConditionalAndContext) { s.e1 = v } |
| 773 | |
| 774 | func (s *ConditionalOrContext) AllConditionalAnd() []IConditionalAndContext { |
| 775 | children := s.GetChildren() |
| 776 | len := 0 |
| 777 | for _, ctx := range children { |
| 778 | if _, ok := ctx.(IConditionalAndContext); ok { |
| 779 | len++ |
| 780 | } |
| 781 | } |
| 782 | |
| 783 | tst := make([]IConditionalAndContext, len) |
| 784 | i := 0 |
| 785 | for _, ctx := range children { |
| 786 | if t, ok := ctx.(IConditionalAndContext); ok { |
| 787 | tst[i] = t.(IConditionalAndContext) |
| 788 | i++ |
| 789 | } |
| 790 | } |
| 791 | |
| 792 | return tst |
| 793 | } |
| 794 | |
| 795 | func (s *ConditionalOrContext) ConditionalAnd(i int) IConditionalAndContext { |
| 796 | var t antlr.RuleContext |
| 797 | j := 0 |
| 798 | for _, ctx := range s.GetChildren() { |
| 799 | if _, ok := ctx.(IConditionalAndContext); ok { |
| 800 | if j == i { |
| 801 | t = ctx.(antlr.RuleContext) |
| 802 | break |
| 803 | } |
| 804 | j++ |
| 805 | } |
| 806 | } |
| 807 | |
| 808 | if t == nil { |
| 809 | return nil |
| 810 | } |
| 811 | |
| 812 | return t.(IConditionalAndContext) |
| 813 | } |
| 814 | |
| 815 | func (s *ConditionalOrContext) AllLOGICAL_OR() []antlr.TerminalNode { |
| 816 | return s.GetTokens(CELParserLOGICAL_OR) |
| 817 | } |
| 818 | |
| 819 | func (s *ConditionalOrContext) LOGICAL_OR(i int) antlr.TerminalNode { |
| 820 | return s.GetToken(CELParserLOGICAL_OR, i) |
| 821 | } |
| 822 | |
| 823 | func (s *ConditionalOrContext) GetRuleContext() antlr.RuleContext { |
| 824 | return s |
| 825 | } |
| 826 | |
| 827 | func (s *ConditionalOrContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { |
| 828 | return antlr.TreesStringTree(s, ruleNames, recog) |
| 829 | } |
| 830 | |
| 831 | func (s *ConditionalOrContext) EnterRule(listener antlr.ParseTreeListener) { |
| 832 | if listenerT, ok := listener.(CELListener); ok { |
| 833 | listenerT.EnterConditionalOr(s) |
| 834 | } |
| 835 | } |
| 836 | |
| 837 | func (s *ConditionalOrContext) ExitRule(listener antlr.ParseTreeListener) { |
| 838 | if listenerT, ok := listener.(CELListener); ok { |
| 839 | listenerT.ExitConditionalOr(s) |
| 840 | } |
| 841 | } |
| 842 | |
| 843 | func (s *ConditionalOrContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { |
| 844 | switch t := visitor.(type) { |
| 845 | case CELVisitor: |
| 846 | return t.VisitConditionalOr(s) |
| 847 | |
| 848 | default: |
| 849 | return t.VisitChildren(s) |
| 850 | } |
| 851 | } |
| 852 | |
| 853 | func (p *CELParser) ConditionalOr() (localctx IConditionalOrContext) { |
| 854 | localctx = NewConditionalOrContext(p, p.GetParserRuleContext(), p.GetState()) |
| 855 | p.EnterRule(localctx, 4, CELParserRULE_conditionalOr) |
| 856 | var _la int |
| 857 | |
| 858 | p.EnterOuterAlt(localctx, 1) |
| 859 | { |
| 860 | p.SetState(45) |
| 861 | |
| 862 | var _x = p.ConditionalAnd() |
| 863 | |
| 864 | localctx.(*ConditionalOrContext).e = _x |
| 865 | } |
| 866 | p.SetState(50) |
| 867 | p.GetErrorHandler().Sync(p) |
| 868 | if p.HasError() { |
| 869 | goto errorExit |
| 870 | } |
| 871 | _la = p.GetTokenStream().LA(1) |
| 872 | |
| 873 | for _la == CELParserLOGICAL_OR { |
| 874 | { |
| 875 | p.SetState(46) |
| 876 | |
| 877 | var _m = p.Match(CELParserLOGICAL_OR) |
| 878 | |
| 879 | localctx.(*ConditionalOrContext).s9 = _m |
| 880 | if p.HasError() { |
| 881 | // Recognition error - abort rule |
| 882 | goto errorExit |
| 883 | } |
| 884 | } |
| 885 | localctx.(*ConditionalOrContext).ops = append(localctx.(*ConditionalOrContext).ops, localctx.(*ConditionalOrContext).s9) |
| 886 | { |
| 887 | p.SetState(47) |
| 888 | |
| 889 | var _x = p.ConditionalAnd() |
| 890 | |
| 891 | localctx.(*ConditionalOrContext)._conditionalAnd = _x |
| 892 | } |
| 893 | localctx.(*ConditionalOrContext).e1 = append(localctx.(*ConditionalOrContext).e1, localctx.(*ConditionalOrContext)._conditionalAnd) |
| 894 | |
| 895 | p.SetState(52) |
| 896 | p.GetErrorHandler().Sync(p) |
| 897 | if p.HasError() { |
| 898 | goto errorExit |
| 899 | } |
| 900 | _la = p.GetTokenStream().LA(1) |
| 901 | } |
| 902 | |
| 903 | errorExit: |
| 904 | if p.HasError() { |
| 905 | v := p.GetError() |
| 906 | localctx.SetException(v) |
| 907 | p.GetErrorHandler().ReportError(p, v) |
| 908 | p.GetErrorHandler().Recover(p, v) |
| 909 | p.SetError(nil) |
| 910 | } |
| 911 | p.ExitRule() |
| 912 | return localctx |
| 913 | goto errorExit // Trick to prevent compiler error if the label is not used |
| 914 | } |
| 915 | |
| 916 | // IConditionalAndContext is an interface to support dynamic dispatch. |
| 917 | type IConditionalAndContext interface { |
| 918 | antlr.ParserRuleContext |
| 919 | |
| 920 | // GetParser returns the parser. |
| 921 | GetParser() antlr.Parser |
| 922 | |
| 923 | // GetS8 returns the s8 token. |
| 924 | GetS8() antlr.Token |
| 925 | |
| 926 | // SetS8 sets the s8 token. |
| 927 | SetS8(antlr.Token) |
| 928 | |
| 929 | // GetOps returns the ops token list. |
| 930 | GetOps() []antlr.Token |
| 931 | |
| 932 | // SetOps sets the ops token list. |
| 933 | SetOps([]antlr.Token) |
| 934 | |
| 935 | // GetE returns the e rule contexts. |
| 936 | GetE() IRelationContext |
| 937 | |
| 938 | // Get_relation returns the _relation rule contexts. |
| 939 | Get_relation() IRelationContext |
| 940 | |
| 941 | // SetE sets the e rule contexts. |
| 942 | SetE(IRelationContext) |
| 943 | |
| 944 | // Set_relation sets the _relation rule contexts. |
| 945 | Set_relation(IRelationContext) |
| 946 | |
| 947 | // GetE1 returns the e1 rule context list. |
| 948 | GetE1() []IRelationContext |
| 949 | |
| 950 | // SetE1 sets the e1 rule context list. |
| 951 | SetE1([]IRelationContext) |
| 952 | |
| 953 | // Getter signatures |
| 954 | AllRelation() []IRelationContext |
| 955 | Relation(i int) IRelationContext |
| 956 | AllLOGICAL_AND() []antlr.TerminalNode |
| 957 | LOGICAL_AND(i int) antlr.TerminalNode |
| 958 | |
| 959 | // IsConditionalAndContext differentiates from other interfaces. |
| 960 | IsConditionalAndContext() |
| 961 | } |
| 962 | |
| 963 | type ConditionalAndContext struct { |
| 964 | antlr.BaseParserRuleContext |
| 965 | parser antlr.Parser |
| 966 | e IRelationContext |
| 967 | s8 antlr.Token |
| 968 | ops []antlr.Token |
| 969 | _relation IRelationContext |
| 970 | e1 []IRelationContext |
| 971 | } |
| 972 | |
| 973 | func NewEmptyConditionalAndContext() *ConditionalAndContext { |
| 974 | var p = new(ConditionalAndContext) |
| 975 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) |
| 976 | p.RuleIndex = CELParserRULE_conditionalAnd |
| 977 | return p |
| 978 | } |
| 979 | |
| 980 | func InitEmptyConditionalAndContext(p *ConditionalAndContext) { |
| 981 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) |
| 982 | p.RuleIndex = CELParserRULE_conditionalAnd |
| 983 | } |
| 984 | |
| 985 | func (*ConditionalAndContext) IsConditionalAndContext() {} |
| 986 | |
| 987 | func NewConditionalAndContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ConditionalAndContext { |
| 988 | var p = new(ConditionalAndContext) |
| 989 | |
| 990 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) |
| 991 | |
| 992 | p.parser = parser |
| 993 | p.RuleIndex = CELParserRULE_conditionalAnd |
| 994 | |
| 995 | return p |
| 996 | } |
| 997 | |
| 998 | func (s *ConditionalAndContext) GetParser() antlr.Parser { return s.parser } |
| 999 | |
| 1000 | func (s *ConditionalAndContext) GetS8() antlr.Token { return s.s8 } |
| 1001 | |
| 1002 | func (s *ConditionalAndContext) SetS8(v antlr.Token) { s.s8 = v } |
| 1003 | |
| 1004 | func (s *ConditionalAndContext) GetOps() []antlr.Token { return s.ops } |
| 1005 | |
| 1006 | func (s *ConditionalAndContext) SetOps(v []antlr.Token) { s.ops = v } |
| 1007 | |
| 1008 | func (s *ConditionalAndContext) GetE() IRelationContext { return s.e } |
| 1009 | |
| 1010 | func (s *ConditionalAndContext) Get_relation() IRelationContext { return s._relation } |
| 1011 | |
| 1012 | func (s *ConditionalAndContext) SetE(v IRelationContext) { s.e = v } |
| 1013 | |
| 1014 | func (s *ConditionalAndContext) Set_relation(v IRelationContext) { s._relation = v } |
| 1015 | |
| 1016 | func (s *ConditionalAndContext) GetE1() []IRelationContext { return s.e1 } |
| 1017 | |
| 1018 | func (s *ConditionalAndContext) SetE1(v []IRelationContext) { s.e1 = v } |
| 1019 | |
| 1020 | func (s *ConditionalAndContext) AllRelation() []IRelationContext { |
| 1021 | children := s.GetChildren() |
| 1022 | len := 0 |
| 1023 | for _, ctx := range children { |
| 1024 | if _, ok := ctx.(IRelationContext); ok { |
| 1025 | len++ |
| 1026 | } |
| 1027 | } |
| 1028 | |
| 1029 | tst := make([]IRelationContext, len) |
| 1030 | i := 0 |
| 1031 | for _, ctx := range children { |
| 1032 | if t, ok := ctx.(IRelationContext); ok { |
| 1033 | tst[i] = t.(IRelationContext) |
| 1034 | i++ |
| 1035 | } |
| 1036 | } |
| 1037 | |
| 1038 | return tst |
| 1039 | } |
| 1040 | |
| 1041 | func (s *ConditionalAndContext) Relation(i int) IRelationContext { |
| 1042 | var t antlr.RuleContext |
| 1043 | j := 0 |
| 1044 | for _, ctx := range s.GetChildren() { |
| 1045 | if _, ok := ctx.(IRelationContext); ok { |
| 1046 | if j == i { |
| 1047 | t = ctx.(antlr.RuleContext) |
| 1048 | break |
| 1049 | } |
| 1050 | j++ |
| 1051 | } |
| 1052 | } |
| 1053 | |
| 1054 | if t == nil { |
| 1055 | return nil |
| 1056 | } |
| 1057 | |
| 1058 | return t.(IRelationContext) |
| 1059 | } |
| 1060 | |
| 1061 | func (s *ConditionalAndContext) AllLOGICAL_AND() []antlr.TerminalNode { |
| 1062 | return s.GetTokens(CELParserLOGICAL_AND) |
| 1063 | } |
| 1064 | |
| 1065 | func (s *ConditionalAndContext) LOGICAL_AND(i int) antlr.TerminalNode { |
| 1066 | return s.GetToken(CELParserLOGICAL_AND, i) |
| 1067 | } |
| 1068 | |
| 1069 | func (s *ConditionalAndContext) GetRuleContext() antlr.RuleContext { |
| 1070 | return s |
| 1071 | } |
| 1072 | |
| 1073 | func (s *ConditionalAndContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { |
| 1074 | return antlr.TreesStringTree(s, ruleNames, recog) |
| 1075 | } |
| 1076 | |
| 1077 | func (s *ConditionalAndContext) EnterRule(listener antlr.ParseTreeListener) { |
| 1078 | if listenerT, ok := listener.(CELListener); ok { |
| 1079 | listenerT.EnterConditionalAnd(s) |
| 1080 | } |
| 1081 | } |
| 1082 | |
| 1083 | func (s *ConditionalAndContext) ExitRule(listener antlr.ParseTreeListener) { |
| 1084 | if listenerT, ok := listener.(CELListener); ok { |
| 1085 | listenerT.ExitConditionalAnd(s) |
| 1086 | } |
| 1087 | } |
| 1088 | |
| 1089 | func (s *ConditionalAndContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { |
| 1090 | switch t := visitor.(type) { |
| 1091 | case CELVisitor: |
| 1092 | return t.VisitConditionalAnd(s) |
| 1093 | |
| 1094 | default: |
| 1095 | return t.VisitChildren(s) |
| 1096 | } |
| 1097 | } |
| 1098 | |
| 1099 | func (p *CELParser) ConditionalAnd() (localctx IConditionalAndContext) { |
| 1100 | localctx = NewConditionalAndContext(p, p.GetParserRuleContext(), p.GetState()) |
| 1101 | p.EnterRule(localctx, 6, CELParserRULE_conditionalAnd) |
| 1102 | var _la int |
| 1103 | |
| 1104 | p.EnterOuterAlt(localctx, 1) |
| 1105 | { |
| 1106 | p.SetState(53) |
| 1107 | |
| 1108 | var _x = p.relation(0) |
| 1109 | |
| 1110 | localctx.(*ConditionalAndContext).e = _x |
| 1111 | } |
| 1112 | p.SetState(58) |
| 1113 | p.GetErrorHandler().Sync(p) |
| 1114 | if p.HasError() { |
| 1115 | goto errorExit |
| 1116 | } |
| 1117 | _la = p.GetTokenStream().LA(1) |
| 1118 | |
| 1119 | for _la == CELParserLOGICAL_AND { |
| 1120 | { |
| 1121 | p.SetState(54) |
| 1122 | |
| 1123 | var _m = p.Match(CELParserLOGICAL_AND) |
| 1124 | |
| 1125 | localctx.(*ConditionalAndContext).s8 = _m |
| 1126 | if p.HasError() { |
| 1127 | // Recognition error - abort rule |
| 1128 | goto errorExit |
| 1129 | } |
| 1130 | } |
| 1131 | localctx.(*ConditionalAndContext).ops = append(localctx.(*ConditionalAndContext).ops, localctx.(*ConditionalAndContext).s8) |
| 1132 | { |
| 1133 | p.SetState(55) |
| 1134 | |
| 1135 | var _x = p.relation(0) |
| 1136 | |
| 1137 | localctx.(*ConditionalAndContext)._relation = _x |
| 1138 | } |
| 1139 | localctx.(*ConditionalAndContext).e1 = append(localctx.(*ConditionalAndContext).e1, localctx.(*ConditionalAndContext)._relation) |
| 1140 | |
| 1141 | p.SetState(60) |
| 1142 | p.GetErrorHandler().Sync(p) |
| 1143 | if p.HasError() { |
| 1144 | goto errorExit |
| 1145 | } |
| 1146 | _la = p.GetTokenStream().LA(1) |
| 1147 | } |
| 1148 | |
| 1149 | errorExit: |
| 1150 | if p.HasError() { |
| 1151 | v := p.GetError() |
| 1152 | localctx.SetException(v) |
| 1153 | p.GetErrorHandler().ReportError(p, v) |
| 1154 | p.GetErrorHandler().Recover(p, v) |
| 1155 | p.SetError(nil) |
| 1156 | } |
| 1157 | p.ExitRule() |
| 1158 | return localctx |
| 1159 | goto errorExit // Trick to prevent compiler error if the label is not used |
| 1160 | } |
| 1161 | |
| 1162 | // IRelationContext is an interface to support dynamic dispatch. |
| 1163 | type IRelationContext interface { |
| 1164 | antlr.ParserRuleContext |
| 1165 | |
| 1166 | // GetParser returns the parser. |
| 1167 | GetParser() antlr.Parser |
| 1168 | |
| 1169 | // GetOp returns the op token. |
| 1170 | GetOp() antlr.Token |
| 1171 | |
| 1172 | // SetOp sets the op token. |
| 1173 | SetOp(antlr.Token) |
| 1174 | |
| 1175 | // Getter signatures |
| 1176 | Calc() ICalcContext |
| 1177 | AllRelation() []IRelationContext |
| 1178 | Relation(i int) IRelationContext |
| 1179 | LESS() antlr.TerminalNode |
| 1180 | LESS_EQUALS() antlr.TerminalNode |
| 1181 | GREATER_EQUALS() antlr.TerminalNode |
| 1182 | GREATER() antlr.TerminalNode |
| 1183 | EQUALS() antlr.TerminalNode |
| 1184 | NOT_EQUALS() antlr.TerminalNode |
| 1185 | IN() antlr.TerminalNode |
| 1186 | |
| 1187 | // IsRelationContext differentiates from other interfaces. |
| 1188 | IsRelationContext() |
| 1189 | } |
| 1190 | |
| 1191 | type RelationContext struct { |
| 1192 | antlr.BaseParserRuleContext |
| 1193 | parser antlr.Parser |
| 1194 | op antlr.Token |
| 1195 | } |
| 1196 | |
| 1197 | func NewEmptyRelationContext() *RelationContext { |
| 1198 | var p = new(RelationContext) |
| 1199 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) |
| 1200 | p.RuleIndex = CELParserRULE_relation |
| 1201 | return p |
| 1202 | } |
| 1203 | |
| 1204 | func InitEmptyRelationContext(p *RelationContext) { |
| 1205 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) |
| 1206 | p.RuleIndex = CELParserRULE_relation |
| 1207 | } |
| 1208 | |
| 1209 | func (*RelationContext) IsRelationContext() {} |
| 1210 | |
| 1211 | func NewRelationContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RelationContext { |
| 1212 | var p = new(RelationContext) |
| 1213 | |
| 1214 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) |
| 1215 | |
| 1216 | p.parser = parser |
| 1217 | p.RuleIndex = CELParserRULE_relation |
| 1218 | |
| 1219 | return p |
| 1220 | } |
| 1221 | |
| 1222 | func (s *RelationContext) GetParser() antlr.Parser { return s.parser } |
| 1223 | |
| 1224 | func (s *RelationContext) GetOp() antlr.Token { return s.op } |
| 1225 | |
| 1226 | func (s *RelationContext) SetOp(v antlr.Token) { s.op = v } |
| 1227 | |
| 1228 | func (s *RelationContext) Calc() ICalcContext { |
| 1229 | var t antlr.RuleContext |
| 1230 | for _, ctx := range s.GetChildren() { |
| 1231 | if _, ok := ctx.(ICalcContext); ok { |
| 1232 | t = ctx.(antlr.RuleContext) |
| 1233 | break |
| 1234 | } |
| 1235 | } |
| 1236 | |
| 1237 | if t == nil { |
| 1238 | return nil |
| 1239 | } |
| 1240 | |
| 1241 | return t.(ICalcContext) |
| 1242 | } |
| 1243 | |
| 1244 | func (s *RelationContext) AllRelation() []IRelationContext { |
| 1245 | children := s.GetChildren() |
| 1246 | len := 0 |
| 1247 | for _, ctx := range children { |
| 1248 | if _, ok := ctx.(IRelationContext); ok { |
| 1249 | len++ |
| 1250 | } |
| 1251 | } |
| 1252 | |
| 1253 | tst := make([]IRelationContext, len) |
| 1254 | i := 0 |
| 1255 | for _, ctx := range children { |
| 1256 | if t, ok := ctx.(IRelationContext); ok { |
| 1257 | tst[i] = t.(IRelationContext) |
| 1258 | i++ |
| 1259 | } |
| 1260 | } |
| 1261 | |
| 1262 | return tst |
| 1263 | } |
| 1264 | |
| 1265 | func (s *RelationContext) Relation(i int) IRelationContext { |
| 1266 | var t antlr.RuleContext |
| 1267 | j := 0 |
| 1268 | for _, ctx := range s.GetChildren() { |
| 1269 | if _, ok := ctx.(IRelationContext); ok { |
| 1270 | if j == i { |
| 1271 | t = ctx.(antlr.RuleContext) |
| 1272 | break |
| 1273 | } |
| 1274 | j++ |
| 1275 | } |
| 1276 | } |
| 1277 | |
| 1278 | if t == nil { |
| 1279 | return nil |
| 1280 | } |
| 1281 | |
| 1282 | return t.(IRelationContext) |
| 1283 | } |
| 1284 | |
| 1285 | func (s *RelationContext) LESS() antlr.TerminalNode { |
| 1286 | return s.GetToken(CELParserLESS, 0) |
| 1287 | } |
| 1288 | |
| 1289 | func (s *RelationContext) LESS_EQUALS() antlr.TerminalNode { |
| 1290 | return s.GetToken(CELParserLESS_EQUALS, 0) |
| 1291 | } |
| 1292 | |
| 1293 | func (s *RelationContext) GREATER_EQUALS() antlr.TerminalNode { |
| 1294 | return s.GetToken(CELParserGREATER_EQUALS, 0) |
| 1295 | } |
| 1296 | |
| 1297 | func (s *RelationContext) GREATER() antlr.TerminalNode { |
| 1298 | return s.GetToken(CELParserGREATER, 0) |
| 1299 | } |
| 1300 | |
| 1301 | func (s *RelationContext) EQUALS() antlr.TerminalNode { |
| 1302 | return s.GetToken(CELParserEQUALS, 0) |
| 1303 | } |
| 1304 | |
| 1305 | func (s *RelationContext) NOT_EQUALS() antlr.TerminalNode { |
| 1306 | return s.GetToken(CELParserNOT_EQUALS, 0) |
| 1307 | } |
| 1308 | |
| 1309 | func (s *RelationContext) IN() antlr.TerminalNode { |
| 1310 | return s.GetToken(CELParserIN, 0) |
| 1311 | } |
| 1312 | |
| 1313 | func (s *RelationContext) GetRuleContext() antlr.RuleContext { |
| 1314 | return s |
| 1315 | } |
| 1316 | |
| 1317 | func (s *RelationContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { |
| 1318 | return antlr.TreesStringTree(s, ruleNames, recog) |
| 1319 | } |
| 1320 | |
| 1321 | func (s *RelationContext) EnterRule(listener antlr.ParseTreeListener) { |
| 1322 | if listenerT, ok := listener.(CELListener); ok { |
| 1323 | listenerT.EnterRelation(s) |
| 1324 | } |
| 1325 | } |
| 1326 | |
| 1327 | func (s *RelationContext) ExitRule(listener antlr.ParseTreeListener) { |
| 1328 | if listenerT, ok := listener.(CELListener); ok { |
| 1329 | listenerT.ExitRelation(s) |
| 1330 | } |
| 1331 | } |
| 1332 | |
| 1333 | func (s *RelationContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { |
| 1334 | switch t := visitor.(type) { |
| 1335 | case CELVisitor: |
| 1336 | return t.VisitRelation(s) |
| 1337 | |
| 1338 | default: |
| 1339 | return t.VisitChildren(s) |
| 1340 | } |
| 1341 | } |
| 1342 | |
| 1343 | func (p *CELParser) Relation() (localctx IRelationContext) { |
| 1344 | return p.relation(0) |
| 1345 | } |
| 1346 | |
| 1347 | func (p *CELParser) relation(_p int) (localctx IRelationContext) { |
| 1348 | var _parentctx antlr.ParserRuleContext = p.GetParserRuleContext() |
| 1349 | |
| 1350 | _parentState := p.GetState() |
| 1351 | localctx = NewRelationContext(p, p.GetParserRuleContext(), _parentState) |
| 1352 | var _prevctx IRelationContext = localctx |
| 1353 | var _ antlr.ParserRuleContext = _prevctx // TODO: To prevent unused variable warning. |
| 1354 | _startState := 8 |
| 1355 | p.EnterRecursionRule(localctx, 8, CELParserRULE_relation, _p) |
| 1356 | var _la int |
| 1357 | |
| 1358 | var _alt int |
| 1359 | |
| 1360 | p.EnterOuterAlt(localctx, 1) |
| 1361 | { |
| 1362 | p.SetState(62) |
| 1363 | p.calc(0) |
| 1364 | } |
| 1365 | |
| 1366 | p.GetParserRuleContext().SetStop(p.GetTokenStream().LT(-1)) |
| 1367 | p.SetState(69) |
| 1368 | p.GetErrorHandler().Sync(p) |
| 1369 | if p.HasError() { |
| 1370 | goto errorExit |
| 1371 | } |
| 1372 | _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 3, p.GetParserRuleContext()) |
| 1373 | if p.HasError() { |
| 1374 | goto errorExit |
| 1375 | } |
| 1376 | for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { |
| 1377 | if _alt == 1 { |
| 1378 | if p.GetParseListeners() != nil { |
| 1379 | p.TriggerExitRuleEvent() |
| 1380 | } |
| 1381 | _prevctx = localctx |
| 1382 | localctx = NewRelationContext(p, _parentctx, _parentState) |
| 1383 | p.PushNewRecursionContext(localctx, _startState, CELParserRULE_relation) |
| 1384 | p.SetState(64) |
| 1385 | |
| 1386 | if !(p.Precpred(p.GetParserRuleContext(), 1)) { |
| 1387 | p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 1)", "")) |
| 1388 | goto errorExit |
| 1389 | } |
| 1390 | { |
| 1391 | p.SetState(65) |
| 1392 | |
| 1393 | var _lt = p.GetTokenStream().LT(1) |
| 1394 | |
| 1395 | localctx.(*RelationContext).op = _lt |
| 1396 | |
| 1397 | _la = p.GetTokenStream().LA(1) |
| 1398 | |
| 1399 | if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&254) != 0) { |
| 1400 | var _ri = p.GetErrorHandler().RecoverInline(p) |
| 1401 | |
| 1402 | localctx.(*RelationContext).op = _ri |
| 1403 | } else { |
| 1404 | p.GetErrorHandler().ReportMatch(p) |
| 1405 | p.Consume() |
| 1406 | } |
| 1407 | } |
| 1408 | { |
| 1409 | p.SetState(66) |
| 1410 | p.relation(2) |
| 1411 | } |
| 1412 | |
| 1413 | } |
| 1414 | p.SetState(71) |
| 1415 | p.GetErrorHandler().Sync(p) |
| 1416 | if p.HasError() { |
| 1417 | goto errorExit |
| 1418 | } |
| 1419 | _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 3, p.GetParserRuleContext()) |
| 1420 | if p.HasError() { |
| 1421 | goto errorExit |
| 1422 | } |
| 1423 | } |
| 1424 | |
| 1425 | errorExit: |
| 1426 | if p.HasError() { |
| 1427 | v := p.GetError() |
| 1428 | localctx.SetException(v) |
| 1429 | p.GetErrorHandler().ReportError(p, v) |
| 1430 | p.GetErrorHandler().Recover(p, v) |
| 1431 | p.SetError(nil) |
| 1432 | } |
| 1433 | p.UnrollRecursionContexts(_parentctx) |
| 1434 | return localctx |
| 1435 | goto errorExit // Trick to prevent compiler error if the label is not used |
| 1436 | } |
| 1437 | |
| 1438 | // ICalcContext is an interface to support dynamic dispatch. |
| 1439 | type ICalcContext interface { |
| 1440 | antlr.ParserRuleContext |
| 1441 | |
| 1442 | // GetParser returns the parser. |
| 1443 | GetParser() antlr.Parser |
| 1444 | |
| 1445 | // GetOp returns the op token. |
| 1446 | GetOp() antlr.Token |
| 1447 | |
| 1448 | // SetOp sets the op token. |
| 1449 | SetOp(antlr.Token) |
| 1450 | |
| 1451 | // Getter signatures |
| 1452 | Unary() IUnaryContext |
| 1453 | AllCalc() []ICalcContext |
| 1454 | Calc(i int) ICalcContext |
| 1455 | STAR() antlr.TerminalNode |
| 1456 | SLASH() antlr.TerminalNode |
| 1457 | PERCENT() antlr.TerminalNode |
| 1458 | PLUS() antlr.TerminalNode |
| 1459 | MINUS() antlr.TerminalNode |
| 1460 | |
| 1461 | // IsCalcContext differentiates from other interfaces. |
| 1462 | IsCalcContext() |
| 1463 | } |
| 1464 | |
| 1465 | type CalcContext struct { |
| 1466 | antlr.BaseParserRuleContext |
| 1467 | parser antlr.Parser |
| 1468 | op antlr.Token |
| 1469 | } |
| 1470 | |
| 1471 | func NewEmptyCalcContext() *CalcContext { |
| 1472 | var p = new(CalcContext) |
| 1473 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) |
| 1474 | p.RuleIndex = CELParserRULE_calc |
| 1475 | return p |
| 1476 | } |
| 1477 | |
| 1478 | func InitEmptyCalcContext(p *CalcContext) { |
| 1479 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) |
| 1480 | p.RuleIndex = CELParserRULE_calc |
| 1481 | } |
| 1482 | |
| 1483 | func (*CalcContext) IsCalcContext() {} |
| 1484 | |
| 1485 | func NewCalcContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CalcContext { |
| 1486 | var p = new(CalcContext) |
| 1487 | |
| 1488 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) |
| 1489 | |
| 1490 | p.parser = parser |
| 1491 | p.RuleIndex = CELParserRULE_calc |
| 1492 | |
| 1493 | return p |
| 1494 | } |
| 1495 | |
| 1496 | func (s *CalcContext) GetParser() antlr.Parser { return s.parser } |
| 1497 | |
| 1498 | func (s *CalcContext) GetOp() antlr.Token { return s.op } |
| 1499 | |
| 1500 | func (s *CalcContext) SetOp(v antlr.Token) { s.op = v } |
| 1501 | |
| 1502 | func (s *CalcContext) Unary() IUnaryContext { |
| 1503 | var t antlr.RuleContext |
| 1504 | for _, ctx := range s.GetChildren() { |
| 1505 | if _, ok := ctx.(IUnaryContext); ok { |
| 1506 | t = ctx.(antlr.RuleContext) |
| 1507 | break |
| 1508 | } |
| 1509 | } |
| 1510 | |
| 1511 | if t == nil { |
| 1512 | return nil |
| 1513 | } |
| 1514 | |
| 1515 | return t.(IUnaryContext) |
| 1516 | } |
| 1517 | |
| 1518 | func (s *CalcContext) AllCalc() []ICalcContext { |
| 1519 | children := s.GetChildren() |
| 1520 | len := 0 |
| 1521 | for _, ctx := range children { |
| 1522 | if _, ok := ctx.(ICalcContext); ok { |
| 1523 | len++ |
| 1524 | } |
| 1525 | } |
| 1526 | |
| 1527 | tst := make([]ICalcContext, len) |
| 1528 | i := 0 |
| 1529 | for _, ctx := range children { |
| 1530 | if t, ok := ctx.(ICalcContext); ok { |
| 1531 | tst[i] = t.(ICalcContext) |
| 1532 | i++ |
| 1533 | } |
| 1534 | } |
| 1535 | |
| 1536 | return tst |
| 1537 | } |
| 1538 | |
| 1539 | func (s *CalcContext) Calc(i int) ICalcContext { |
| 1540 | var t antlr.RuleContext |
| 1541 | j := 0 |
| 1542 | for _, ctx := range s.GetChildren() { |
| 1543 | if _, ok := ctx.(ICalcContext); ok { |
| 1544 | if j == i { |
| 1545 | t = ctx.(antlr.RuleContext) |
| 1546 | break |
| 1547 | } |
| 1548 | j++ |
| 1549 | } |
| 1550 | } |
| 1551 | |
| 1552 | if t == nil { |
| 1553 | return nil |
| 1554 | } |
| 1555 | |
| 1556 | return t.(ICalcContext) |
| 1557 | } |
| 1558 | |
| 1559 | func (s *CalcContext) STAR() antlr.TerminalNode { |
| 1560 | return s.GetToken(CELParserSTAR, 0) |
| 1561 | } |
| 1562 | |
| 1563 | func (s *CalcContext) SLASH() antlr.TerminalNode { |
| 1564 | return s.GetToken(CELParserSLASH, 0) |
| 1565 | } |
| 1566 | |
| 1567 | func (s *CalcContext) PERCENT() antlr.TerminalNode { |
| 1568 | return s.GetToken(CELParserPERCENT, 0) |
| 1569 | } |
| 1570 | |
| 1571 | func (s *CalcContext) PLUS() antlr.TerminalNode { |
| 1572 | return s.GetToken(CELParserPLUS, 0) |
| 1573 | } |
| 1574 | |
| 1575 | func (s *CalcContext) MINUS() antlr.TerminalNode { |
| 1576 | return s.GetToken(CELParserMINUS, 0) |
| 1577 | } |
| 1578 | |
| 1579 | func (s *CalcContext) GetRuleContext() antlr.RuleContext { |
| 1580 | return s |
| 1581 | } |
| 1582 | |
| 1583 | func (s *CalcContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { |
| 1584 | return antlr.TreesStringTree(s, ruleNames, recog) |
| 1585 | } |
| 1586 | |
| 1587 | func (s *CalcContext) EnterRule(listener antlr.ParseTreeListener) { |
| 1588 | if listenerT, ok := listener.(CELListener); ok { |
| 1589 | listenerT.EnterCalc(s) |
| 1590 | } |
| 1591 | } |
| 1592 | |
| 1593 | func (s *CalcContext) ExitRule(listener antlr.ParseTreeListener) { |
| 1594 | if listenerT, ok := listener.(CELListener); ok { |
| 1595 | listenerT.ExitCalc(s) |
| 1596 | } |
| 1597 | } |
| 1598 | |
| 1599 | func (s *CalcContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { |
| 1600 | switch t := visitor.(type) { |
| 1601 | case CELVisitor: |
| 1602 | return t.VisitCalc(s) |
| 1603 | |
| 1604 | default: |
| 1605 | return t.VisitChildren(s) |
| 1606 | } |
| 1607 | } |
| 1608 | |
| 1609 | func (p *CELParser) Calc() (localctx ICalcContext) { |
| 1610 | return p.calc(0) |
| 1611 | } |
| 1612 | |
| 1613 | func (p *CELParser) calc(_p int) (localctx ICalcContext) { |
| 1614 | var _parentctx antlr.ParserRuleContext = p.GetParserRuleContext() |
| 1615 | |
| 1616 | _parentState := p.GetState() |
| 1617 | localctx = NewCalcContext(p, p.GetParserRuleContext(), _parentState) |
| 1618 | var _prevctx ICalcContext = localctx |
| 1619 | var _ antlr.ParserRuleContext = _prevctx // TODO: To prevent unused variable warning. |
| 1620 | _startState := 10 |
| 1621 | p.EnterRecursionRule(localctx, 10, CELParserRULE_calc, _p) |
| 1622 | var _la int |
| 1623 | |
| 1624 | var _alt int |
| 1625 | |
| 1626 | p.EnterOuterAlt(localctx, 1) |
| 1627 | { |
| 1628 | p.SetState(73) |
| 1629 | p.Unary() |
| 1630 | } |
| 1631 | |
| 1632 | p.GetParserRuleContext().SetStop(p.GetTokenStream().LT(-1)) |
| 1633 | p.SetState(83) |
| 1634 | p.GetErrorHandler().Sync(p) |
| 1635 | if p.HasError() { |
| 1636 | goto errorExit |
| 1637 | } |
| 1638 | _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 5, p.GetParserRuleContext()) |
| 1639 | if p.HasError() { |
| 1640 | goto errorExit |
| 1641 | } |
| 1642 | for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { |
| 1643 | if _alt == 1 { |
| 1644 | if p.GetParseListeners() != nil { |
| 1645 | p.TriggerExitRuleEvent() |
| 1646 | } |
| 1647 | _prevctx = localctx |
| 1648 | p.SetState(81) |
| 1649 | p.GetErrorHandler().Sync(p) |
| 1650 | if p.HasError() { |
| 1651 | goto errorExit |
| 1652 | } |
| 1653 | |
| 1654 | switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 4, p.GetParserRuleContext()) { |
| 1655 | case 1: |
| 1656 | localctx = NewCalcContext(p, _parentctx, _parentState) |
| 1657 | p.PushNewRecursionContext(localctx, _startState, CELParserRULE_calc) |
| 1658 | p.SetState(75) |
| 1659 | |
| 1660 | if !(p.Precpred(p.GetParserRuleContext(), 2)) { |
| 1661 | p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 2)", "")) |
| 1662 | goto errorExit |
| 1663 | } |
| 1664 | { |
| 1665 | p.SetState(76) |
| 1666 | |
| 1667 | var _lt = p.GetTokenStream().LT(1) |
| 1668 | |
| 1669 | localctx.(*CalcContext).op = _lt |
| 1670 | |
| 1671 | _la = p.GetTokenStream().LA(1) |
| 1672 | |
| 1673 | if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&58720256) != 0) { |
| 1674 | var _ri = p.GetErrorHandler().RecoverInline(p) |
| 1675 | |
| 1676 | localctx.(*CalcContext).op = _ri |
| 1677 | } else { |
| 1678 | p.GetErrorHandler().ReportMatch(p) |
| 1679 | p.Consume() |
| 1680 | } |
| 1681 | } |
| 1682 | { |
| 1683 | p.SetState(77) |
| 1684 | p.calc(3) |
| 1685 | } |
| 1686 | |
| 1687 | case 2: |
| 1688 | localctx = NewCalcContext(p, _parentctx, _parentState) |
| 1689 | p.PushNewRecursionContext(localctx, _startState, CELParserRULE_calc) |
| 1690 | p.SetState(78) |
| 1691 | |
| 1692 | if !(p.Precpred(p.GetParserRuleContext(), 1)) { |
| 1693 | p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 1)", "")) |
| 1694 | goto errorExit |
| 1695 | } |
| 1696 | { |
| 1697 | p.SetState(79) |
| 1698 | |
| 1699 | var _lt = p.GetTokenStream().LT(1) |
| 1700 | |
| 1701 | localctx.(*CalcContext).op = _lt |
| 1702 | |
| 1703 | _la = p.GetTokenStream().LA(1) |
| 1704 | |
| 1705 | if !(_la == CELParserMINUS || _la == CELParserPLUS) { |
| 1706 | var _ri = p.GetErrorHandler().RecoverInline(p) |
| 1707 | |
| 1708 | localctx.(*CalcContext).op = _ri |
| 1709 | } else { |
| 1710 | p.GetErrorHandler().ReportMatch(p) |
| 1711 | p.Consume() |
| 1712 | } |
| 1713 | } |
| 1714 | { |
| 1715 | p.SetState(80) |
| 1716 | p.calc(2) |
| 1717 | } |
| 1718 | |
| 1719 | case antlr.ATNInvalidAltNumber: |
| 1720 | goto errorExit |
| 1721 | } |
| 1722 | |
| 1723 | } |
| 1724 | p.SetState(85) |
| 1725 | p.GetErrorHandler().Sync(p) |
| 1726 | if p.HasError() { |
| 1727 | goto errorExit |
| 1728 | } |
| 1729 | _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 5, p.GetParserRuleContext()) |
| 1730 | if p.HasError() { |
| 1731 | goto errorExit |
| 1732 | } |
| 1733 | } |
| 1734 | |
| 1735 | errorExit: |
| 1736 | if p.HasError() { |
| 1737 | v := p.GetError() |
| 1738 | localctx.SetException(v) |
| 1739 | p.GetErrorHandler().ReportError(p, v) |
| 1740 | p.GetErrorHandler().Recover(p, v) |
| 1741 | p.SetError(nil) |
| 1742 | } |
| 1743 | p.UnrollRecursionContexts(_parentctx) |
| 1744 | return localctx |
| 1745 | goto errorExit // Trick to prevent compiler error if the label is not used |
| 1746 | } |
| 1747 | |
| 1748 | // IUnaryContext is an interface to support dynamic dispatch. |
| 1749 | type IUnaryContext interface { |
| 1750 | antlr.ParserRuleContext |
| 1751 | |
| 1752 | // GetParser returns the parser. |
| 1753 | GetParser() antlr.Parser |
| 1754 | // IsUnaryContext differentiates from other interfaces. |
| 1755 | IsUnaryContext() |
| 1756 | } |
| 1757 | |
| 1758 | type UnaryContext struct { |
| 1759 | antlr.BaseParserRuleContext |
| 1760 | parser antlr.Parser |
| 1761 | } |
| 1762 | |
| 1763 | func NewEmptyUnaryContext() *UnaryContext { |
| 1764 | var p = new(UnaryContext) |
| 1765 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) |
| 1766 | p.RuleIndex = CELParserRULE_unary |
| 1767 | return p |
| 1768 | } |
| 1769 | |
| 1770 | func InitEmptyUnaryContext(p *UnaryContext) { |
| 1771 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) |
| 1772 | p.RuleIndex = CELParserRULE_unary |
| 1773 | } |
| 1774 | |
| 1775 | func (*UnaryContext) IsUnaryContext() {} |
| 1776 | |
| 1777 | func NewUnaryContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *UnaryContext { |
| 1778 | var p = new(UnaryContext) |
| 1779 | |
| 1780 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) |
| 1781 | |
| 1782 | p.parser = parser |
| 1783 | p.RuleIndex = CELParserRULE_unary |
| 1784 | |
| 1785 | return p |
| 1786 | } |
| 1787 | |
| 1788 | func (s *UnaryContext) GetParser() antlr.Parser { return s.parser } |
| 1789 | |
| 1790 | func (s *UnaryContext) CopyAll(ctx *UnaryContext) { |
| 1791 | s.CopyFrom(&ctx.BaseParserRuleContext) |
| 1792 | } |
| 1793 | |
| 1794 | func (s *UnaryContext) GetRuleContext() antlr.RuleContext { |
| 1795 | return s |
| 1796 | } |
| 1797 | |
| 1798 | func (s *UnaryContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { |
| 1799 | return antlr.TreesStringTree(s, ruleNames, recog) |
| 1800 | } |
| 1801 | |
| 1802 | type LogicalNotContext struct { |
| 1803 | UnaryContext |
| 1804 | s19 antlr.Token |
| 1805 | ops []antlr.Token |
| 1806 | } |
| 1807 | |
| 1808 | func NewLogicalNotContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *LogicalNotContext { |
| 1809 | var p = new(LogicalNotContext) |
| 1810 | |
| 1811 | InitEmptyUnaryContext(&p.UnaryContext) |
| 1812 | p.parser = parser |
| 1813 | p.CopyAll(ctx.(*UnaryContext)) |
| 1814 | |
| 1815 | return p |
| 1816 | } |
| 1817 | |
| 1818 | func (s *LogicalNotContext) GetS19() antlr.Token { return s.s19 } |
| 1819 | |
| 1820 | func (s *LogicalNotContext) SetS19(v antlr.Token) { s.s19 = v } |
| 1821 | |
| 1822 | func (s *LogicalNotContext) GetOps() []antlr.Token { return s.ops } |
| 1823 | |
| 1824 | func (s *LogicalNotContext) SetOps(v []antlr.Token) { s.ops = v } |
| 1825 | |
| 1826 | func (s *LogicalNotContext) GetRuleContext() antlr.RuleContext { |
| 1827 | return s |
| 1828 | } |
| 1829 | |
| 1830 | func (s *LogicalNotContext) Member() IMemberContext { |
| 1831 | var t antlr.RuleContext |
| 1832 | for _, ctx := range s.GetChildren() { |
| 1833 | if _, ok := ctx.(IMemberContext); ok { |
| 1834 | t = ctx.(antlr.RuleContext) |
| 1835 | break |
| 1836 | } |
| 1837 | } |
| 1838 | |
| 1839 | if t == nil { |
| 1840 | return nil |
| 1841 | } |
| 1842 | |
| 1843 | return t.(IMemberContext) |
| 1844 | } |
| 1845 | |
| 1846 | func (s *LogicalNotContext) AllEXCLAM() []antlr.TerminalNode { |
| 1847 | return s.GetTokens(CELParserEXCLAM) |
| 1848 | } |
| 1849 | |
| 1850 | func (s *LogicalNotContext) EXCLAM(i int) antlr.TerminalNode { |
| 1851 | return s.GetToken(CELParserEXCLAM, i) |
| 1852 | } |
| 1853 | |
| 1854 | func (s *LogicalNotContext) EnterRule(listener antlr.ParseTreeListener) { |
| 1855 | if listenerT, ok := listener.(CELListener); ok { |
| 1856 | listenerT.EnterLogicalNot(s) |
| 1857 | } |
| 1858 | } |
| 1859 | |
| 1860 | func (s *LogicalNotContext) ExitRule(listener antlr.ParseTreeListener) { |
| 1861 | if listenerT, ok := listener.(CELListener); ok { |
| 1862 | listenerT.ExitLogicalNot(s) |
| 1863 | } |
| 1864 | } |
| 1865 | |
| 1866 | func (s *LogicalNotContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { |
| 1867 | switch t := visitor.(type) { |
| 1868 | case CELVisitor: |
| 1869 | return t.VisitLogicalNot(s) |
| 1870 | |
| 1871 | default: |
| 1872 | return t.VisitChildren(s) |
| 1873 | } |
| 1874 | } |
| 1875 | |
| 1876 | type MemberExprContext struct { |
| 1877 | UnaryContext |
| 1878 | } |
| 1879 | |
| 1880 | func NewMemberExprContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *MemberExprContext { |
| 1881 | var p = new(MemberExprContext) |
| 1882 | |
| 1883 | InitEmptyUnaryContext(&p.UnaryContext) |
| 1884 | p.parser = parser |
| 1885 | p.CopyAll(ctx.(*UnaryContext)) |
| 1886 | |
| 1887 | return p |
| 1888 | } |
| 1889 | |
| 1890 | func (s *MemberExprContext) GetRuleContext() antlr.RuleContext { |
| 1891 | return s |
| 1892 | } |
| 1893 | |
| 1894 | func (s *MemberExprContext) Member() IMemberContext { |
| 1895 | var t antlr.RuleContext |
| 1896 | for _, ctx := range s.GetChildren() { |
| 1897 | if _, ok := ctx.(IMemberContext); ok { |
| 1898 | t = ctx.(antlr.RuleContext) |
| 1899 | break |
| 1900 | } |
| 1901 | } |
| 1902 | |
| 1903 | if t == nil { |
| 1904 | return nil |
| 1905 | } |
| 1906 | |
| 1907 | return t.(IMemberContext) |
| 1908 | } |
| 1909 | |
| 1910 | func (s *MemberExprContext) EnterRule(listener antlr.ParseTreeListener) { |
| 1911 | if listenerT, ok := listener.(CELListener); ok { |
| 1912 | listenerT.EnterMemberExpr(s) |
| 1913 | } |
| 1914 | } |
| 1915 | |
| 1916 | func (s *MemberExprContext) ExitRule(listener antlr.ParseTreeListener) { |
| 1917 | if listenerT, ok := listener.(CELListener); ok { |
| 1918 | listenerT.ExitMemberExpr(s) |
| 1919 | } |
| 1920 | } |
| 1921 | |
| 1922 | func (s *MemberExprContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { |
| 1923 | switch t := visitor.(type) { |
| 1924 | case CELVisitor: |
| 1925 | return t.VisitMemberExpr(s) |
| 1926 | |
| 1927 | default: |
| 1928 | return t.VisitChildren(s) |
| 1929 | } |
| 1930 | } |
| 1931 | |
| 1932 | type NegateContext struct { |
| 1933 | UnaryContext |
| 1934 | s18 antlr.Token |
| 1935 | ops []antlr.Token |
| 1936 | } |
| 1937 | |
| 1938 | func NewNegateContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *NegateContext { |
| 1939 | var p = new(NegateContext) |
| 1940 | |
| 1941 | InitEmptyUnaryContext(&p.UnaryContext) |
| 1942 | p.parser = parser |
| 1943 | p.CopyAll(ctx.(*UnaryContext)) |
| 1944 | |
| 1945 | return p |
| 1946 | } |
| 1947 | |
| 1948 | func (s *NegateContext) GetS18() antlr.Token { return s.s18 } |
| 1949 | |
| 1950 | func (s *NegateContext) SetS18(v antlr.Token) { s.s18 = v } |
| 1951 | |
| 1952 | func (s *NegateContext) GetOps() []antlr.Token { return s.ops } |
| 1953 | |
| 1954 | func (s *NegateContext) SetOps(v []antlr.Token) { s.ops = v } |
| 1955 | |
| 1956 | func (s *NegateContext) GetRuleContext() antlr.RuleContext { |
| 1957 | return s |
| 1958 | } |
| 1959 | |
| 1960 | func (s *NegateContext) Member() IMemberContext { |
| 1961 | var t antlr.RuleContext |
| 1962 | for _, ctx := range s.GetChildren() { |
| 1963 | if _, ok := ctx.(IMemberContext); ok { |
| 1964 | t = ctx.(antlr.RuleContext) |
| 1965 | break |
| 1966 | } |
| 1967 | } |
| 1968 | |
| 1969 | if t == nil { |
| 1970 | return nil |
| 1971 | } |
| 1972 | |
| 1973 | return t.(IMemberContext) |
| 1974 | } |
| 1975 | |
| 1976 | func (s *NegateContext) AllMINUS() []antlr.TerminalNode { |
| 1977 | return s.GetTokens(CELParserMINUS) |
| 1978 | } |
| 1979 | |
| 1980 | func (s *NegateContext) MINUS(i int) antlr.TerminalNode { |
| 1981 | return s.GetToken(CELParserMINUS, i) |
| 1982 | } |
| 1983 | |
| 1984 | func (s *NegateContext) EnterRule(listener antlr.ParseTreeListener) { |
| 1985 | if listenerT, ok := listener.(CELListener); ok { |
| 1986 | listenerT.EnterNegate(s) |
| 1987 | } |
| 1988 | } |
| 1989 | |
| 1990 | func (s *NegateContext) ExitRule(listener antlr.ParseTreeListener) { |
| 1991 | if listenerT, ok := listener.(CELListener); ok { |
| 1992 | listenerT.ExitNegate(s) |
| 1993 | } |
| 1994 | } |
| 1995 | |
| 1996 | func (s *NegateContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { |
| 1997 | switch t := visitor.(type) { |
| 1998 | case CELVisitor: |
| 1999 | return t.VisitNegate(s) |
| 2000 | |
| 2001 | default: |
| 2002 | return t.VisitChildren(s) |
| 2003 | } |
| 2004 | } |
| 2005 | |
| 2006 | func (p *CELParser) Unary() (localctx IUnaryContext) { |
| 2007 | localctx = NewUnaryContext(p, p.GetParserRuleContext(), p.GetState()) |
| 2008 | p.EnterRule(localctx, 12, CELParserRULE_unary) |
| 2009 | var _la int |
| 2010 | |
| 2011 | var _alt int |
| 2012 | |
| 2013 | p.SetState(99) |
| 2014 | p.GetErrorHandler().Sync(p) |
| 2015 | if p.HasError() { |
| 2016 | goto errorExit |
| 2017 | } |
| 2018 | |
| 2019 | switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 8, p.GetParserRuleContext()) { |
| 2020 | case 1: |
| 2021 | localctx = NewMemberExprContext(p, localctx) |
| 2022 | p.EnterOuterAlt(localctx, 1) |
| 2023 | { |
| 2024 | p.SetState(86) |
| 2025 | p.member(0) |
| 2026 | } |
| 2027 | |
| 2028 | case 2: |
| 2029 | localctx = NewLogicalNotContext(p, localctx) |
| 2030 | p.EnterOuterAlt(localctx, 2) |
| 2031 | p.SetState(88) |
| 2032 | p.GetErrorHandler().Sync(p) |
| 2033 | if p.HasError() { |
| 2034 | goto errorExit |
| 2035 | } |
| 2036 | _la = p.GetTokenStream().LA(1) |
| 2037 | |
| 2038 | for ok := true; ok; ok = _la == CELParserEXCLAM { |
| 2039 | { |
| 2040 | p.SetState(87) |
| 2041 | |
| 2042 | var _m = p.Match(CELParserEXCLAM) |
| 2043 | |
| 2044 | localctx.(*LogicalNotContext).s19 = _m |
| 2045 | if p.HasError() { |
| 2046 | // Recognition error - abort rule |
| 2047 | goto errorExit |
| 2048 | } |
| 2049 | } |
| 2050 | localctx.(*LogicalNotContext).ops = append(localctx.(*LogicalNotContext).ops, localctx.(*LogicalNotContext).s19) |
| 2051 | |
| 2052 | p.SetState(90) |
| 2053 | p.GetErrorHandler().Sync(p) |
| 2054 | if p.HasError() { |
| 2055 | goto errorExit |
| 2056 | } |
| 2057 | _la = p.GetTokenStream().LA(1) |
| 2058 | } |
| 2059 | { |
| 2060 | p.SetState(92) |
| 2061 | p.member(0) |
| 2062 | } |
| 2063 | |
| 2064 | case 3: |
| 2065 | localctx = NewNegateContext(p, localctx) |
| 2066 | p.EnterOuterAlt(localctx, 3) |
| 2067 | p.SetState(94) |
| 2068 | p.GetErrorHandler().Sync(p) |
| 2069 | if p.HasError() { |
| 2070 | goto errorExit |
| 2071 | } |
| 2072 | _alt = 1 |
| 2073 | for ok := true; ok; ok = _alt != 2 && _alt != antlr.ATNInvalidAltNumber { |
| 2074 | switch _alt { |
| 2075 | case 1: |
| 2076 | { |
| 2077 | p.SetState(93) |
| 2078 | |
| 2079 | var _m = p.Match(CELParserMINUS) |
| 2080 | |
| 2081 | localctx.(*NegateContext).s18 = _m |
| 2082 | if p.HasError() { |
| 2083 | // Recognition error - abort rule |
| 2084 | goto errorExit |
| 2085 | } |
| 2086 | } |
| 2087 | localctx.(*NegateContext).ops = append(localctx.(*NegateContext).ops, localctx.(*NegateContext).s18) |
| 2088 | |
| 2089 | default: |
| 2090 | p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) |
| 2091 | goto errorExit |
| 2092 | } |
| 2093 | |
| 2094 | p.SetState(96) |
| 2095 | p.GetErrorHandler().Sync(p) |
| 2096 | _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 7, p.GetParserRuleContext()) |
| 2097 | if p.HasError() { |
| 2098 | goto errorExit |
| 2099 | } |
| 2100 | } |
| 2101 | { |
| 2102 | p.SetState(98) |
| 2103 | p.member(0) |
| 2104 | } |
| 2105 | |
| 2106 | case antlr.ATNInvalidAltNumber: |
| 2107 | goto errorExit |
| 2108 | } |
| 2109 | |
| 2110 | errorExit: |
| 2111 | if p.HasError() { |
| 2112 | v := p.GetError() |
| 2113 | localctx.SetException(v) |
| 2114 | p.GetErrorHandler().ReportError(p, v) |
| 2115 | p.GetErrorHandler().Recover(p, v) |
| 2116 | p.SetError(nil) |
| 2117 | } |
| 2118 | p.ExitRule() |
| 2119 | return localctx |
| 2120 | goto errorExit // Trick to prevent compiler error if the label is not used |
| 2121 | } |
| 2122 | |
| 2123 | // IMemberContext is an interface to support dynamic dispatch. |
| 2124 | type IMemberContext interface { |
| 2125 | antlr.ParserRuleContext |
| 2126 | |
| 2127 | // GetParser returns the parser. |
| 2128 | GetParser() antlr.Parser |
| 2129 | // IsMemberContext differentiates from other interfaces. |
| 2130 | IsMemberContext() |
| 2131 | } |
| 2132 | |
| 2133 | type MemberContext struct { |
| 2134 | antlr.BaseParserRuleContext |
| 2135 | parser antlr.Parser |
| 2136 | } |
| 2137 | |
| 2138 | func NewEmptyMemberContext() *MemberContext { |
| 2139 | var p = new(MemberContext) |
| 2140 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) |
| 2141 | p.RuleIndex = CELParserRULE_member |
| 2142 | return p |
| 2143 | } |
| 2144 | |
| 2145 | func InitEmptyMemberContext(p *MemberContext) { |
| 2146 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) |
| 2147 | p.RuleIndex = CELParserRULE_member |
| 2148 | } |
| 2149 | |
| 2150 | func (*MemberContext) IsMemberContext() {} |
| 2151 | |
| 2152 | func NewMemberContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *MemberContext { |
| 2153 | var p = new(MemberContext) |
| 2154 | |
| 2155 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) |
| 2156 | |
| 2157 | p.parser = parser |
| 2158 | p.RuleIndex = CELParserRULE_member |
| 2159 | |
| 2160 | return p |
| 2161 | } |
| 2162 | |
| 2163 | func (s *MemberContext) GetParser() antlr.Parser { return s.parser } |
| 2164 | |
| 2165 | func (s *MemberContext) CopyAll(ctx *MemberContext) { |
| 2166 | s.CopyFrom(&ctx.BaseParserRuleContext) |
| 2167 | } |
| 2168 | |
| 2169 | func (s *MemberContext) GetRuleContext() antlr.RuleContext { |
| 2170 | return s |
| 2171 | } |
| 2172 | |
| 2173 | func (s *MemberContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { |
| 2174 | return antlr.TreesStringTree(s, ruleNames, recog) |
| 2175 | } |
| 2176 | |
| 2177 | type MemberCallContext struct { |
| 2178 | MemberContext |
| 2179 | op antlr.Token |
| 2180 | id antlr.Token |
| 2181 | open antlr.Token |
| 2182 | args IExprListContext |
| 2183 | } |
| 2184 | |
| 2185 | func NewMemberCallContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *MemberCallContext { |
| 2186 | var p = new(MemberCallContext) |
| 2187 | |
| 2188 | InitEmptyMemberContext(&p.MemberContext) |
| 2189 | p.parser = parser |
| 2190 | p.CopyAll(ctx.(*MemberContext)) |
| 2191 | |
| 2192 | return p |
| 2193 | } |
| 2194 | |
| 2195 | func (s *MemberCallContext) GetOp() antlr.Token { return s.op } |
| 2196 | |
| 2197 | func (s *MemberCallContext) GetId() antlr.Token { return s.id } |
| 2198 | |
| 2199 | func (s *MemberCallContext) GetOpen() antlr.Token { return s.open } |
| 2200 | |
| 2201 | func (s *MemberCallContext) SetOp(v antlr.Token) { s.op = v } |
| 2202 | |
| 2203 | func (s *MemberCallContext) SetId(v antlr.Token) { s.id = v } |
| 2204 | |
| 2205 | func (s *MemberCallContext) SetOpen(v antlr.Token) { s.open = v } |
| 2206 | |
| 2207 | func (s *MemberCallContext) GetArgs() IExprListContext { return s.args } |
| 2208 | |
| 2209 | func (s *MemberCallContext) SetArgs(v IExprListContext) { s.args = v } |
| 2210 | |
| 2211 | func (s *MemberCallContext) GetRuleContext() antlr.RuleContext { |
| 2212 | return s |
| 2213 | } |
| 2214 | |
| 2215 | func (s *MemberCallContext) Member() IMemberContext { |
| 2216 | var t antlr.RuleContext |
| 2217 | for _, ctx := range s.GetChildren() { |
| 2218 | if _, ok := ctx.(IMemberContext); ok { |
| 2219 | t = ctx.(antlr.RuleContext) |
| 2220 | break |
| 2221 | } |
| 2222 | } |
| 2223 | |
| 2224 | if t == nil { |
| 2225 | return nil |
| 2226 | } |
| 2227 | |
| 2228 | return t.(IMemberContext) |
| 2229 | } |
| 2230 | |
| 2231 | func (s *MemberCallContext) RPAREN() antlr.TerminalNode { |
| 2232 | return s.GetToken(CELParserRPAREN, 0) |
| 2233 | } |
| 2234 | |
| 2235 | func (s *MemberCallContext) DOT() antlr.TerminalNode { |
| 2236 | return s.GetToken(CELParserDOT, 0) |
| 2237 | } |
| 2238 | |
| 2239 | func (s *MemberCallContext) IDENTIFIER() antlr.TerminalNode { |
| 2240 | return s.GetToken(CELParserIDENTIFIER, 0) |
| 2241 | } |
| 2242 | |
| 2243 | func (s *MemberCallContext) LPAREN() antlr.TerminalNode { |
| 2244 | return s.GetToken(CELParserLPAREN, 0) |
| 2245 | } |
| 2246 | |
| 2247 | func (s *MemberCallContext) ExprList() IExprListContext { |
| 2248 | var t antlr.RuleContext |
| 2249 | for _, ctx := range s.GetChildren() { |
| 2250 | if _, ok := ctx.(IExprListContext); ok { |
| 2251 | t = ctx.(antlr.RuleContext) |
| 2252 | break |
| 2253 | } |
| 2254 | } |
| 2255 | |
| 2256 | if t == nil { |
| 2257 | return nil |
| 2258 | } |
| 2259 | |
| 2260 | return t.(IExprListContext) |
| 2261 | } |
| 2262 | |
| 2263 | func (s *MemberCallContext) EnterRule(listener antlr.ParseTreeListener) { |
| 2264 | if listenerT, ok := listener.(CELListener); ok { |
| 2265 | listenerT.EnterMemberCall(s) |
| 2266 | } |
| 2267 | } |
| 2268 | |
| 2269 | func (s *MemberCallContext) ExitRule(listener antlr.ParseTreeListener) { |
| 2270 | if listenerT, ok := listener.(CELListener); ok { |
| 2271 | listenerT.ExitMemberCall(s) |
| 2272 | } |
| 2273 | } |
| 2274 | |
| 2275 | func (s *MemberCallContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { |
| 2276 | switch t := visitor.(type) { |
| 2277 | case CELVisitor: |
| 2278 | return t.VisitMemberCall(s) |
| 2279 | |
| 2280 | default: |
| 2281 | return t.VisitChildren(s) |
| 2282 | } |
| 2283 | } |
| 2284 | |
| 2285 | type SelectContext struct { |
| 2286 | MemberContext |
| 2287 | op antlr.Token |
| 2288 | opt antlr.Token |
| 2289 | id IEscapeIdentContext |
| 2290 | } |
| 2291 | |
| 2292 | func NewSelectContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *SelectContext { |
| 2293 | var p = new(SelectContext) |
| 2294 | |
| 2295 | InitEmptyMemberContext(&p.MemberContext) |
| 2296 | p.parser = parser |
| 2297 | p.CopyAll(ctx.(*MemberContext)) |
| 2298 | |
| 2299 | return p |
| 2300 | } |
| 2301 | |
| 2302 | func (s *SelectContext) GetOp() antlr.Token { return s.op } |
| 2303 | |
| 2304 | func (s *SelectContext) GetOpt() antlr.Token { return s.opt } |
| 2305 | |
| 2306 | func (s *SelectContext) SetOp(v antlr.Token) { s.op = v } |
| 2307 | |
| 2308 | func (s *SelectContext) SetOpt(v antlr.Token) { s.opt = v } |
| 2309 | |
| 2310 | func (s *SelectContext) GetId() IEscapeIdentContext { return s.id } |
| 2311 | |
| 2312 | func (s *SelectContext) SetId(v IEscapeIdentContext) { s.id = v } |
| 2313 | |
| 2314 | func (s *SelectContext) GetRuleContext() antlr.RuleContext { |
| 2315 | return s |
| 2316 | } |
| 2317 | |
| 2318 | func (s *SelectContext) Member() IMemberContext { |
| 2319 | var t antlr.RuleContext |
| 2320 | for _, ctx := range s.GetChildren() { |
| 2321 | if _, ok := ctx.(IMemberContext); ok { |
| 2322 | t = ctx.(antlr.RuleContext) |
| 2323 | break |
| 2324 | } |
| 2325 | } |
| 2326 | |
| 2327 | if t == nil { |
| 2328 | return nil |
| 2329 | } |
| 2330 | |
| 2331 | return t.(IMemberContext) |
| 2332 | } |
| 2333 | |
| 2334 | func (s *SelectContext) DOT() antlr.TerminalNode { |
| 2335 | return s.GetToken(CELParserDOT, 0) |
| 2336 | } |
| 2337 | |
| 2338 | func (s *SelectContext) EscapeIdent() IEscapeIdentContext { |
| 2339 | var t antlr.RuleContext |
| 2340 | for _, ctx := range s.GetChildren() { |
| 2341 | if _, ok := ctx.(IEscapeIdentContext); ok { |
| 2342 | t = ctx.(antlr.RuleContext) |
| 2343 | break |
| 2344 | } |
| 2345 | } |
| 2346 | |
| 2347 | if t == nil { |
| 2348 | return nil |
| 2349 | } |
| 2350 | |
| 2351 | return t.(IEscapeIdentContext) |
| 2352 | } |
| 2353 | |
| 2354 | func (s *SelectContext) QUESTIONMARK() antlr.TerminalNode { |
| 2355 | return s.GetToken(CELParserQUESTIONMARK, 0) |
| 2356 | } |
| 2357 | |
| 2358 | func (s *SelectContext) EnterRule(listener antlr.ParseTreeListener) { |
| 2359 | if listenerT, ok := listener.(CELListener); ok { |
| 2360 | listenerT.EnterSelect(s) |
| 2361 | } |
| 2362 | } |
| 2363 | |
| 2364 | func (s *SelectContext) ExitRule(listener antlr.ParseTreeListener) { |
| 2365 | if listenerT, ok := listener.(CELListener); ok { |
| 2366 | listenerT.ExitSelect(s) |
| 2367 | } |
| 2368 | } |
| 2369 | |
| 2370 | func (s *SelectContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { |
| 2371 | switch t := visitor.(type) { |
| 2372 | case CELVisitor: |
| 2373 | return t.VisitSelect(s) |
| 2374 | |
| 2375 | default: |
| 2376 | return t.VisitChildren(s) |
| 2377 | } |
| 2378 | } |
| 2379 | |
| 2380 | type PrimaryExprContext struct { |
| 2381 | MemberContext |
| 2382 | } |
| 2383 | |
| 2384 | func NewPrimaryExprContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *PrimaryExprContext { |
| 2385 | var p = new(PrimaryExprContext) |
| 2386 | |
| 2387 | InitEmptyMemberContext(&p.MemberContext) |
| 2388 | p.parser = parser |
| 2389 | p.CopyAll(ctx.(*MemberContext)) |
| 2390 | |
| 2391 | return p |
| 2392 | } |
| 2393 | |
| 2394 | func (s *PrimaryExprContext) GetRuleContext() antlr.RuleContext { |
| 2395 | return s |
| 2396 | } |
| 2397 | |
| 2398 | func (s *PrimaryExprContext) Primary() IPrimaryContext { |
| 2399 | var t antlr.RuleContext |
| 2400 | for _, ctx := range s.GetChildren() { |
| 2401 | if _, ok := ctx.(IPrimaryContext); ok { |
| 2402 | t = ctx.(antlr.RuleContext) |
| 2403 | break |
| 2404 | } |
| 2405 | } |
| 2406 | |
| 2407 | if t == nil { |
| 2408 | return nil |
| 2409 | } |
| 2410 | |
| 2411 | return t.(IPrimaryContext) |
| 2412 | } |
| 2413 | |
| 2414 | func (s *PrimaryExprContext) EnterRule(listener antlr.ParseTreeListener) { |
| 2415 | if listenerT, ok := listener.(CELListener); ok { |
| 2416 | listenerT.EnterPrimaryExpr(s) |
| 2417 | } |
| 2418 | } |
| 2419 | |
| 2420 | func (s *PrimaryExprContext) ExitRule(listener antlr.ParseTreeListener) { |
| 2421 | if listenerT, ok := listener.(CELListener); ok { |
| 2422 | listenerT.ExitPrimaryExpr(s) |
| 2423 | } |
| 2424 | } |
| 2425 | |
| 2426 | func (s *PrimaryExprContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { |
| 2427 | switch t := visitor.(type) { |
| 2428 | case CELVisitor: |
| 2429 | return t.VisitPrimaryExpr(s) |
| 2430 | |
| 2431 | default: |
| 2432 | return t.VisitChildren(s) |
| 2433 | } |
| 2434 | } |
| 2435 | |
| 2436 | type IndexContext struct { |
| 2437 | MemberContext |
| 2438 | op antlr.Token |
| 2439 | opt antlr.Token |
| 2440 | index IExprContext |
| 2441 | } |
| 2442 | |
| 2443 | func NewIndexContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *IndexContext { |
| 2444 | var p = new(IndexContext) |
| 2445 | |
| 2446 | InitEmptyMemberContext(&p.MemberContext) |
| 2447 | p.parser = parser |
| 2448 | p.CopyAll(ctx.(*MemberContext)) |
| 2449 | |
| 2450 | return p |
| 2451 | } |
| 2452 | |
| 2453 | func (s *IndexContext) GetOp() antlr.Token { return s.op } |
| 2454 | |
| 2455 | func (s *IndexContext) GetOpt() antlr.Token { return s.opt } |
| 2456 | |
| 2457 | func (s *IndexContext) SetOp(v antlr.Token) { s.op = v } |
| 2458 | |
| 2459 | func (s *IndexContext) SetOpt(v antlr.Token) { s.opt = v } |
| 2460 | |
| 2461 | func (s *IndexContext) GetIndex() IExprContext { return s.index } |
| 2462 | |
| 2463 | func (s *IndexContext) SetIndex(v IExprContext) { s.index = v } |
| 2464 | |
| 2465 | func (s *IndexContext) GetRuleContext() antlr.RuleContext { |
| 2466 | return s |
| 2467 | } |
| 2468 | |
| 2469 | func (s *IndexContext) Member() IMemberContext { |
| 2470 | var t antlr.RuleContext |
| 2471 | for _, ctx := range s.GetChildren() { |
| 2472 | if _, ok := ctx.(IMemberContext); ok { |
| 2473 | t = ctx.(antlr.RuleContext) |
| 2474 | break |
| 2475 | } |
| 2476 | } |
| 2477 | |
| 2478 | if t == nil { |
| 2479 | return nil |
| 2480 | } |
| 2481 | |
| 2482 | return t.(IMemberContext) |
| 2483 | } |
| 2484 | |
| 2485 | func (s *IndexContext) RPRACKET() antlr.TerminalNode { |
| 2486 | return s.GetToken(CELParserRPRACKET, 0) |
| 2487 | } |
| 2488 | |
| 2489 | func (s *IndexContext) LBRACKET() antlr.TerminalNode { |
| 2490 | return s.GetToken(CELParserLBRACKET, 0) |
| 2491 | } |
| 2492 | |
| 2493 | func (s *IndexContext) Expr() IExprContext { |
| 2494 | var t antlr.RuleContext |
| 2495 | for _, ctx := range s.GetChildren() { |
| 2496 | if _, ok := ctx.(IExprContext); ok { |
| 2497 | t = ctx.(antlr.RuleContext) |
| 2498 | break |
| 2499 | } |
| 2500 | } |
| 2501 | |
| 2502 | if t == nil { |
| 2503 | return nil |
| 2504 | } |
| 2505 | |
| 2506 | return t.(IExprContext) |
| 2507 | } |
| 2508 | |
| 2509 | func (s *IndexContext) QUESTIONMARK() antlr.TerminalNode { |
| 2510 | return s.GetToken(CELParserQUESTIONMARK, 0) |
| 2511 | } |
| 2512 | |
| 2513 | func (s *IndexContext) EnterRule(listener antlr.ParseTreeListener) { |
| 2514 | if listenerT, ok := listener.(CELListener); ok { |
| 2515 | listenerT.EnterIndex(s) |
| 2516 | } |
| 2517 | } |
| 2518 | |
| 2519 | func (s *IndexContext) ExitRule(listener antlr.ParseTreeListener) { |
| 2520 | if listenerT, ok := listener.(CELListener); ok { |
| 2521 | listenerT.ExitIndex(s) |
| 2522 | } |
| 2523 | } |
| 2524 | |
| 2525 | func (s *IndexContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { |
| 2526 | switch t := visitor.(type) { |
| 2527 | case CELVisitor: |
| 2528 | return t.VisitIndex(s) |
| 2529 | |
| 2530 | default: |
| 2531 | return t.VisitChildren(s) |
| 2532 | } |
| 2533 | } |
| 2534 | |
| 2535 | func (p *CELParser) Member() (localctx IMemberContext) { |
| 2536 | return p.member(0) |
| 2537 | } |
| 2538 | |
| 2539 | func (p *CELParser) member(_p int) (localctx IMemberContext) { |
| 2540 | var _parentctx antlr.ParserRuleContext = p.GetParserRuleContext() |
| 2541 | |
| 2542 | _parentState := p.GetState() |
| 2543 | localctx = NewMemberContext(p, p.GetParserRuleContext(), _parentState) |
| 2544 | var _prevctx IMemberContext = localctx |
| 2545 | var _ antlr.ParserRuleContext = _prevctx // TODO: To prevent unused variable warning. |
| 2546 | _startState := 14 |
| 2547 | p.EnterRecursionRule(localctx, 14, CELParserRULE_member, _p) |
| 2548 | var _la int |
| 2549 | |
| 2550 | var _alt int |
| 2551 | |
| 2552 | p.EnterOuterAlt(localctx, 1) |
| 2553 | localctx = NewPrimaryExprContext(p, localctx) |
| 2554 | p.SetParserRuleContext(localctx) |
| 2555 | _prevctx = localctx |
| 2556 | |
| 2557 | { |
| 2558 | p.SetState(102) |
| 2559 | p.Primary() |
| 2560 | } |
| 2561 | |
| 2562 | p.GetParserRuleContext().SetStop(p.GetTokenStream().LT(-1)) |
| 2563 | p.SetState(128) |
| 2564 | p.GetErrorHandler().Sync(p) |
| 2565 | if p.HasError() { |
| 2566 | goto errorExit |
| 2567 | } |
| 2568 | _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 13, p.GetParserRuleContext()) |
| 2569 | if p.HasError() { |
| 2570 | goto errorExit |
| 2571 | } |
| 2572 | for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { |
| 2573 | if _alt == 1 { |
| 2574 | if p.GetParseListeners() != nil { |
| 2575 | p.TriggerExitRuleEvent() |
| 2576 | } |
| 2577 | _prevctx = localctx |
| 2578 | p.SetState(126) |
| 2579 | p.GetErrorHandler().Sync(p) |
| 2580 | if p.HasError() { |
| 2581 | goto errorExit |
| 2582 | } |
| 2583 | |
| 2584 | switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 12, p.GetParserRuleContext()) { |
| 2585 | case 1: |
| 2586 | localctx = NewSelectContext(p, NewMemberContext(p, _parentctx, _parentState)) |
| 2587 | p.PushNewRecursionContext(localctx, _startState, CELParserRULE_member) |
| 2588 | p.SetState(104) |
| 2589 | |
| 2590 | if !(p.Precpred(p.GetParserRuleContext(), 3)) { |
| 2591 | p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 3)", "")) |
| 2592 | goto errorExit |
| 2593 | } |
| 2594 | { |
| 2595 | p.SetState(105) |
| 2596 | |
| 2597 | var _m = p.Match(CELParserDOT) |
| 2598 | |
| 2599 | localctx.(*SelectContext).op = _m |
| 2600 | if p.HasError() { |
| 2601 | // Recognition error - abort rule |
| 2602 | goto errorExit |
| 2603 | } |
| 2604 | } |
| 2605 | p.SetState(107) |
| 2606 | p.GetErrorHandler().Sync(p) |
| 2607 | if p.HasError() { |
| 2608 | goto errorExit |
| 2609 | } |
| 2610 | _la = p.GetTokenStream().LA(1) |
| 2611 | |
| 2612 | if _la == CELParserQUESTIONMARK { |
| 2613 | { |
| 2614 | p.SetState(106) |
| 2615 | |
| 2616 | var _m = p.Match(CELParserQUESTIONMARK) |
| 2617 | |
| 2618 | localctx.(*SelectContext).opt = _m |
| 2619 | if p.HasError() { |
| 2620 | // Recognition error - abort rule |
| 2621 | goto errorExit |
| 2622 | } |
| 2623 | } |
| 2624 | |
| 2625 | } |
| 2626 | { |
| 2627 | p.SetState(109) |
| 2628 | |
| 2629 | var _x = p.EscapeIdent() |
| 2630 | |
| 2631 | localctx.(*SelectContext).id = _x |
| 2632 | } |
| 2633 | |
| 2634 | case 2: |
| 2635 | localctx = NewMemberCallContext(p, NewMemberContext(p, _parentctx, _parentState)) |
| 2636 | p.PushNewRecursionContext(localctx, _startState, CELParserRULE_member) |
| 2637 | p.SetState(110) |
| 2638 | |
| 2639 | if !(p.Precpred(p.GetParserRuleContext(), 2)) { |
| 2640 | p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 2)", "")) |
| 2641 | goto errorExit |
| 2642 | } |
| 2643 | { |
| 2644 | p.SetState(111) |
| 2645 | |
| 2646 | var _m = p.Match(CELParserDOT) |
| 2647 | |
| 2648 | localctx.(*MemberCallContext).op = _m |
| 2649 | if p.HasError() { |
| 2650 | // Recognition error - abort rule |
| 2651 | goto errorExit |
| 2652 | } |
| 2653 | } |
| 2654 | { |
| 2655 | p.SetState(112) |
| 2656 | |
| 2657 | var _m = p.Match(CELParserIDENTIFIER) |
| 2658 | |
| 2659 | localctx.(*MemberCallContext).id = _m |
| 2660 | if p.HasError() { |
| 2661 | // Recognition error - abort rule |
| 2662 | goto errorExit |
| 2663 | } |
| 2664 | } |
| 2665 | { |
| 2666 | p.SetState(113) |
| 2667 | |
| 2668 | var _m = p.Match(CELParserLPAREN) |
| 2669 | |
| 2670 | localctx.(*MemberCallContext).open = _m |
| 2671 | if p.HasError() { |
| 2672 | // Recognition error - abort rule |
| 2673 | goto errorExit |
| 2674 | } |
| 2675 | } |
| 2676 | p.SetState(115) |
| 2677 | p.GetErrorHandler().Sync(p) |
| 2678 | if p.HasError() { |
| 2679 | goto errorExit |
| 2680 | } |
| 2681 | _la = p.GetTokenStream().LA(1) |
| 2682 | |
| 2683 | if (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&135762105344) != 0 { |
| 2684 | { |
| 2685 | p.SetState(114) |
| 2686 | |
| 2687 | var _x = p.ExprList() |
| 2688 | |
| 2689 | localctx.(*MemberCallContext).args = _x |
| 2690 | } |
| 2691 | |
| 2692 | } |
| 2693 | { |
| 2694 | p.SetState(117) |
| 2695 | p.Match(CELParserRPAREN) |
| 2696 | if p.HasError() { |
| 2697 | // Recognition error - abort rule |
| 2698 | goto errorExit |
| 2699 | } |
| 2700 | } |
| 2701 | |
| 2702 | case 3: |
| 2703 | localctx = NewIndexContext(p, NewMemberContext(p, _parentctx, _parentState)) |
| 2704 | p.PushNewRecursionContext(localctx, _startState, CELParserRULE_member) |
| 2705 | p.SetState(118) |
| 2706 | |
| 2707 | if !(p.Precpred(p.GetParserRuleContext(), 1)) { |
| 2708 | p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 1)", "")) |
| 2709 | goto errorExit |
| 2710 | } |
| 2711 | { |
| 2712 | p.SetState(119) |
| 2713 | |
| 2714 | var _m = p.Match(CELParserLBRACKET) |
| 2715 | |
| 2716 | localctx.(*IndexContext).op = _m |
| 2717 | if p.HasError() { |
| 2718 | // Recognition error - abort rule |
| 2719 | goto errorExit |
| 2720 | } |
| 2721 | } |
| 2722 | p.SetState(121) |
| 2723 | p.GetErrorHandler().Sync(p) |
| 2724 | if p.HasError() { |
| 2725 | goto errorExit |
| 2726 | } |
| 2727 | _la = p.GetTokenStream().LA(1) |
| 2728 | |
| 2729 | if _la == CELParserQUESTIONMARK { |
| 2730 | { |
| 2731 | p.SetState(120) |
| 2732 | |
| 2733 | var _m = p.Match(CELParserQUESTIONMARK) |
| 2734 | |
| 2735 | localctx.(*IndexContext).opt = _m |
| 2736 | if p.HasError() { |
| 2737 | // Recognition error - abort rule |
| 2738 | goto errorExit |
| 2739 | } |
| 2740 | } |
| 2741 | |
| 2742 | } |
| 2743 | { |
| 2744 | p.SetState(123) |
| 2745 | |
| 2746 | var _x = p.Expr() |
| 2747 | |
| 2748 | localctx.(*IndexContext).index = _x |
| 2749 | } |
| 2750 | { |
| 2751 | p.SetState(124) |
| 2752 | p.Match(CELParserRPRACKET) |
| 2753 | if p.HasError() { |
| 2754 | // Recognition error - abort rule |
| 2755 | goto errorExit |
| 2756 | } |
| 2757 | } |
| 2758 | |
| 2759 | case antlr.ATNInvalidAltNumber: |
| 2760 | goto errorExit |
| 2761 | } |
| 2762 | |
| 2763 | } |
| 2764 | p.SetState(130) |
| 2765 | p.GetErrorHandler().Sync(p) |
| 2766 | if p.HasError() { |
| 2767 | goto errorExit |
| 2768 | } |
| 2769 | _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 13, p.GetParserRuleContext()) |
| 2770 | if p.HasError() { |
| 2771 | goto errorExit |
| 2772 | } |
| 2773 | } |
| 2774 | |
| 2775 | errorExit: |
| 2776 | if p.HasError() { |
| 2777 | v := p.GetError() |
| 2778 | localctx.SetException(v) |
| 2779 | p.GetErrorHandler().ReportError(p, v) |
| 2780 | p.GetErrorHandler().Recover(p, v) |
| 2781 | p.SetError(nil) |
| 2782 | } |
| 2783 | p.UnrollRecursionContexts(_parentctx) |
| 2784 | return localctx |
| 2785 | goto errorExit // Trick to prevent compiler error if the label is not used |
| 2786 | } |
| 2787 | |
| 2788 | // IPrimaryContext is an interface to support dynamic dispatch. |
| 2789 | type IPrimaryContext interface { |
| 2790 | antlr.ParserRuleContext |
| 2791 | |
| 2792 | // GetParser returns the parser. |
| 2793 | GetParser() antlr.Parser |
| 2794 | // IsPrimaryContext differentiates from other interfaces. |
| 2795 | IsPrimaryContext() |
| 2796 | } |
| 2797 | |
| 2798 | type PrimaryContext struct { |
| 2799 | antlr.BaseParserRuleContext |
| 2800 | parser antlr.Parser |
| 2801 | } |
| 2802 | |
| 2803 | func NewEmptyPrimaryContext() *PrimaryContext { |
| 2804 | var p = new(PrimaryContext) |
| 2805 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) |
| 2806 | p.RuleIndex = CELParserRULE_primary |
| 2807 | return p |
| 2808 | } |
| 2809 | |
| 2810 | func InitEmptyPrimaryContext(p *PrimaryContext) { |
| 2811 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) |
| 2812 | p.RuleIndex = CELParserRULE_primary |
| 2813 | } |
| 2814 | |
| 2815 | func (*PrimaryContext) IsPrimaryContext() {} |
| 2816 | |
| 2817 | func NewPrimaryContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *PrimaryContext { |
| 2818 | var p = new(PrimaryContext) |
| 2819 | |
| 2820 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) |
| 2821 | |
| 2822 | p.parser = parser |
| 2823 | p.RuleIndex = CELParserRULE_primary |
| 2824 | |
| 2825 | return p |
| 2826 | } |
| 2827 | |
| 2828 | func (s *PrimaryContext) GetParser() antlr.Parser { return s.parser } |
| 2829 | |
| 2830 | func (s *PrimaryContext) CopyAll(ctx *PrimaryContext) { |
| 2831 | s.CopyFrom(&ctx.BaseParserRuleContext) |
| 2832 | } |
| 2833 | |
| 2834 | func (s *PrimaryContext) GetRuleContext() antlr.RuleContext { |
| 2835 | return s |
| 2836 | } |
| 2837 | |
| 2838 | func (s *PrimaryContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { |
| 2839 | return antlr.TreesStringTree(s, ruleNames, recog) |
| 2840 | } |
| 2841 | |
| 2842 | type CreateListContext struct { |
| 2843 | PrimaryContext |
| 2844 | op antlr.Token |
| 2845 | elems IListInitContext |
| 2846 | } |
| 2847 | |
| 2848 | func NewCreateListContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *CreateListContext { |
| 2849 | var p = new(CreateListContext) |
| 2850 | |
| 2851 | InitEmptyPrimaryContext(&p.PrimaryContext) |
| 2852 | p.parser = parser |
| 2853 | p.CopyAll(ctx.(*PrimaryContext)) |
| 2854 | |
| 2855 | return p |
| 2856 | } |
| 2857 | |
| 2858 | func (s *CreateListContext) GetOp() antlr.Token { return s.op } |
| 2859 | |
| 2860 | func (s *CreateListContext) SetOp(v antlr.Token) { s.op = v } |
| 2861 | |
| 2862 | func (s *CreateListContext) GetElems() IListInitContext { return s.elems } |
| 2863 | |
| 2864 | func (s *CreateListContext) SetElems(v IListInitContext) { s.elems = v } |
| 2865 | |
| 2866 | func (s *CreateListContext) GetRuleContext() antlr.RuleContext { |
| 2867 | return s |
| 2868 | } |
| 2869 | |
| 2870 | func (s *CreateListContext) RPRACKET() antlr.TerminalNode { |
| 2871 | return s.GetToken(CELParserRPRACKET, 0) |
| 2872 | } |
| 2873 | |
| 2874 | func (s *CreateListContext) LBRACKET() antlr.TerminalNode { |
| 2875 | return s.GetToken(CELParserLBRACKET, 0) |
| 2876 | } |
| 2877 | |
| 2878 | func (s *CreateListContext) COMMA() antlr.TerminalNode { |
| 2879 | return s.GetToken(CELParserCOMMA, 0) |
| 2880 | } |
| 2881 | |
| 2882 | func (s *CreateListContext) ListInit() IListInitContext { |
| 2883 | var t antlr.RuleContext |
| 2884 | for _, ctx := range s.GetChildren() { |
| 2885 | if _, ok := ctx.(IListInitContext); ok { |
| 2886 | t = ctx.(antlr.RuleContext) |
| 2887 | break |
| 2888 | } |
| 2889 | } |
| 2890 | |
| 2891 | if t == nil { |
| 2892 | return nil |
| 2893 | } |
| 2894 | |
| 2895 | return t.(IListInitContext) |
| 2896 | } |
| 2897 | |
| 2898 | func (s *CreateListContext) EnterRule(listener antlr.ParseTreeListener) { |
| 2899 | if listenerT, ok := listener.(CELListener); ok { |
| 2900 | listenerT.EnterCreateList(s) |
| 2901 | } |
| 2902 | } |
| 2903 | |
| 2904 | func (s *CreateListContext) ExitRule(listener antlr.ParseTreeListener) { |
| 2905 | if listenerT, ok := listener.(CELListener); ok { |
| 2906 | listenerT.ExitCreateList(s) |
| 2907 | } |
| 2908 | } |
| 2909 | |
| 2910 | func (s *CreateListContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { |
| 2911 | switch t := visitor.(type) { |
| 2912 | case CELVisitor: |
| 2913 | return t.VisitCreateList(s) |
| 2914 | |
| 2915 | default: |
| 2916 | return t.VisitChildren(s) |
| 2917 | } |
| 2918 | } |
| 2919 | |
| 2920 | type IdentContext struct { |
| 2921 | PrimaryContext |
| 2922 | leadingDot antlr.Token |
| 2923 | id antlr.Token |
| 2924 | } |
| 2925 | |
| 2926 | func NewIdentContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *IdentContext { |
| 2927 | var p = new(IdentContext) |
| 2928 | |
| 2929 | InitEmptyPrimaryContext(&p.PrimaryContext) |
| 2930 | p.parser = parser |
| 2931 | p.CopyAll(ctx.(*PrimaryContext)) |
| 2932 | |
| 2933 | return p |
| 2934 | } |
| 2935 | |
| 2936 | func (s *IdentContext) GetLeadingDot() antlr.Token { return s.leadingDot } |
| 2937 | |
| 2938 | func (s *IdentContext) GetId() antlr.Token { return s.id } |
| 2939 | |
| 2940 | func (s *IdentContext) SetLeadingDot(v antlr.Token) { s.leadingDot = v } |
| 2941 | |
| 2942 | func (s *IdentContext) SetId(v antlr.Token) { s.id = v } |
| 2943 | |
| 2944 | func (s *IdentContext) GetRuleContext() antlr.RuleContext { |
| 2945 | return s |
| 2946 | } |
| 2947 | |
| 2948 | func (s *IdentContext) IDENTIFIER() antlr.TerminalNode { |
| 2949 | return s.GetToken(CELParserIDENTIFIER, 0) |
| 2950 | } |
| 2951 | |
| 2952 | func (s *IdentContext) DOT() antlr.TerminalNode { |
| 2953 | return s.GetToken(CELParserDOT, 0) |
| 2954 | } |
| 2955 | |
| 2956 | func (s *IdentContext) EnterRule(listener antlr.ParseTreeListener) { |
| 2957 | if listenerT, ok := listener.(CELListener); ok { |
| 2958 | listenerT.EnterIdent(s) |
| 2959 | } |
| 2960 | } |
| 2961 | |
| 2962 | func (s *IdentContext) ExitRule(listener antlr.ParseTreeListener) { |
| 2963 | if listenerT, ok := listener.(CELListener); ok { |
| 2964 | listenerT.ExitIdent(s) |
| 2965 | } |
| 2966 | } |
| 2967 | |
| 2968 | func (s *IdentContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { |
| 2969 | switch t := visitor.(type) { |
| 2970 | case CELVisitor: |
| 2971 | return t.VisitIdent(s) |
| 2972 | |
| 2973 | default: |
| 2974 | return t.VisitChildren(s) |
| 2975 | } |
| 2976 | } |
| 2977 | |
| 2978 | type CreateStructContext struct { |
| 2979 | PrimaryContext |
| 2980 | op antlr.Token |
| 2981 | entries IMapInitializerListContext |
| 2982 | } |
| 2983 | |
| 2984 | func NewCreateStructContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *CreateStructContext { |
| 2985 | var p = new(CreateStructContext) |
| 2986 | |
| 2987 | InitEmptyPrimaryContext(&p.PrimaryContext) |
| 2988 | p.parser = parser |
| 2989 | p.CopyAll(ctx.(*PrimaryContext)) |
| 2990 | |
| 2991 | return p |
| 2992 | } |
| 2993 | |
| 2994 | func (s *CreateStructContext) GetOp() antlr.Token { return s.op } |
| 2995 | |
| 2996 | func (s *CreateStructContext) SetOp(v antlr.Token) { s.op = v } |
| 2997 | |
| 2998 | func (s *CreateStructContext) GetEntries() IMapInitializerListContext { return s.entries } |
| 2999 | |
| 3000 | func (s *CreateStructContext) SetEntries(v IMapInitializerListContext) { s.entries = v } |
| 3001 | |
| 3002 | func (s *CreateStructContext) GetRuleContext() antlr.RuleContext { |
| 3003 | return s |
| 3004 | } |
| 3005 | |
| 3006 | func (s *CreateStructContext) RBRACE() antlr.TerminalNode { |
| 3007 | return s.GetToken(CELParserRBRACE, 0) |
| 3008 | } |
| 3009 | |
| 3010 | func (s *CreateStructContext) LBRACE() antlr.TerminalNode { |
| 3011 | return s.GetToken(CELParserLBRACE, 0) |
| 3012 | } |
| 3013 | |
| 3014 | func (s *CreateStructContext) COMMA() antlr.TerminalNode { |
| 3015 | return s.GetToken(CELParserCOMMA, 0) |
| 3016 | } |
| 3017 | |
| 3018 | func (s *CreateStructContext) MapInitializerList() IMapInitializerListContext { |
| 3019 | var t antlr.RuleContext |
| 3020 | for _, ctx := range s.GetChildren() { |
| 3021 | if _, ok := ctx.(IMapInitializerListContext); ok { |
| 3022 | t = ctx.(antlr.RuleContext) |
| 3023 | break |
| 3024 | } |
| 3025 | } |
| 3026 | |
| 3027 | if t == nil { |
| 3028 | return nil |
| 3029 | } |
| 3030 | |
| 3031 | return t.(IMapInitializerListContext) |
| 3032 | } |
| 3033 | |
| 3034 | func (s *CreateStructContext) EnterRule(listener antlr.ParseTreeListener) { |
| 3035 | if listenerT, ok := listener.(CELListener); ok { |
| 3036 | listenerT.EnterCreateStruct(s) |
| 3037 | } |
| 3038 | } |
| 3039 | |
| 3040 | func (s *CreateStructContext) ExitRule(listener antlr.ParseTreeListener) { |
| 3041 | if listenerT, ok := listener.(CELListener); ok { |
| 3042 | listenerT.ExitCreateStruct(s) |
| 3043 | } |
| 3044 | } |
| 3045 | |
| 3046 | func (s *CreateStructContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { |
| 3047 | switch t := visitor.(type) { |
| 3048 | case CELVisitor: |
| 3049 | return t.VisitCreateStruct(s) |
| 3050 | |
| 3051 | default: |
| 3052 | return t.VisitChildren(s) |
| 3053 | } |
| 3054 | } |
| 3055 | |
| 3056 | type ConstantLiteralContext struct { |
| 3057 | PrimaryContext |
| 3058 | } |
| 3059 | |
| 3060 | func NewConstantLiteralContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *ConstantLiteralContext { |
| 3061 | var p = new(ConstantLiteralContext) |
| 3062 | |
| 3063 | InitEmptyPrimaryContext(&p.PrimaryContext) |
| 3064 | p.parser = parser |
| 3065 | p.CopyAll(ctx.(*PrimaryContext)) |
| 3066 | |
| 3067 | return p |
| 3068 | } |
| 3069 | |
| 3070 | func (s *ConstantLiteralContext) GetRuleContext() antlr.RuleContext { |
| 3071 | return s |
| 3072 | } |
| 3073 | |
| 3074 | func (s *ConstantLiteralContext) Literal() ILiteralContext { |
| 3075 | var t antlr.RuleContext |
| 3076 | for _, ctx := range s.GetChildren() { |
| 3077 | if _, ok := ctx.(ILiteralContext); ok { |
| 3078 | t = ctx.(antlr.RuleContext) |
| 3079 | break |
| 3080 | } |
| 3081 | } |
| 3082 | |
| 3083 | if t == nil { |
| 3084 | return nil |
| 3085 | } |
| 3086 | |
| 3087 | return t.(ILiteralContext) |
| 3088 | } |
| 3089 | |
| 3090 | func (s *ConstantLiteralContext) EnterRule(listener antlr.ParseTreeListener) { |
| 3091 | if listenerT, ok := listener.(CELListener); ok { |
| 3092 | listenerT.EnterConstantLiteral(s) |
| 3093 | } |
| 3094 | } |
| 3095 | |
| 3096 | func (s *ConstantLiteralContext) ExitRule(listener antlr.ParseTreeListener) { |
| 3097 | if listenerT, ok := listener.(CELListener); ok { |
| 3098 | listenerT.ExitConstantLiteral(s) |
| 3099 | } |
| 3100 | } |
| 3101 | |
| 3102 | func (s *ConstantLiteralContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { |
| 3103 | switch t := visitor.(type) { |
| 3104 | case CELVisitor: |
| 3105 | return t.VisitConstantLiteral(s) |
| 3106 | |
| 3107 | default: |
| 3108 | return t.VisitChildren(s) |
| 3109 | } |
| 3110 | } |
| 3111 | |
| 3112 | type NestedContext struct { |
| 3113 | PrimaryContext |
| 3114 | e IExprContext |
| 3115 | } |
| 3116 | |
| 3117 | func NewNestedContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *NestedContext { |
| 3118 | var p = new(NestedContext) |
| 3119 | |
| 3120 | InitEmptyPrimaryContext(&p.PrimaryContext) |
| 3121 | p.parser = parser |
| 3122 | p.CopyAll(ctx.(*PrimaryContext)) |
| 3123 | |
| 3124 | return p |
| 3125 | } |
| 3126 | |
| 3127 | func (s *NestedContext) GetE() IExprContext { return s.e } |
| 3128 | |
| 3129 | func (s *NestedContext) SetE(v IExprContext) { s.e = v } |
| 3130 | |
| 3131 | func (s *NestedContext) GetRuleContext() antlr.RuleContext { |
| 3132 | return s |
| 3133 | } |
| 3134 | |
| 3135 | func (s *NestedContext) LPAREN() antlr.TerminalNode { |
| 3136 | return s.GetToken(CELParserLPAREN, 0) |
| 3137 | } |
| 3138 | |
| 3139 | func (s *NestedContext) RPAREN() antlr.TerminalNode { |
| 3140 | return s.GetToken(CELParserRPAREN, 0) |
| 3141 | } |
| 3142 | |
| 3143 | func (s *NestedContext) Expr() IExprContext { |
| 3144 | var t antlr.RuleContext |
| 3145 | for _, ctx := range s.GetChildren() { |
| 3146 | if _, ok := ctx.(IExprContext); ok { |
| 3147 | t = ctx.(antlr.RuleContext) |
| 3148 | break |
| 3149 | } |
| 3150 | } |
| 3151 | |
| 3152 | if t == nil { |
| 3153 | return nil |
| 3154 | } |
| 3155 | |
| 3156 | return t.(IExprContext) |
| 3157 | } |
| 3158 | |
| 3159 | func (s *NestedContext) EnterRule(listener antlr.ParseTreeListener) { |
| 3160 | if listenerT, ok := listener.(CELListener); ok { |
| 3161 | listenerT.EnterNested(s) |
| 3162 | } |
| 3163 | } |
| 3164 | |
| 3165 | func (s *NestedContext) ExitRule(listener antlr.ParseTreeListener) { |
| 3166 | if listenerT, ok := listener.(CELListener); ok { |
| 3167 | listenerT.ExitNested(s) |
| 3168 | } |
| 3169 | } |
| 3170 | |
| 3171 | func (s *NestedContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { |
| 3172 | switch t := visitor.(type) { |
| 3173 | case CELVisitor: |
| 3174 | return t.VisitNested(s) |
| 3175 | |
| 3176 | default: |
| 3177 | return t.VisitChildren(s) |
| 3178 | } |
| 3179 | } |
| 3180 | |
| 3181 | type CreateMessageContext struct { |
| 3182 | PrimaryContext |
| 3183 | leadingDot antlr.Token |
| 3184 | _IDENTIFIER antlr.Token |
| 3185 | ids []antlr.Token |
| 3186 | s16 antlr.Token |
| 3187 | ops []antlr.Token |
| 3188 | op antlr.Token |
| 3189 | entries IFieldInitializerListContext |
| 3190 | } |
| 3191 | |
| 3192 | func NewCreateMessageContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *CreateMessageContext { |
| 3193 | var p = new(CreateMessageContext) |
| 3194 | |
| 3195 | InitEmptyPrimaryContext(&p.PrimaryContext) |
| 3196 | p.parser = parser |
| 3197 | p.CopyAll(ctx.(*PrimaryContext)) |
| 3198 | |
| 3199 | return p |
| 3200 | } |
| 3201 | |
| 3202 | func (s *CreateMessageContext) GetLeadingDot() antlr.Token { return s.leadingDot } |
| 3203 | |
| 3204 | func (s *CreateMessageContext) Get_IDENTIFIER() antlr.Token { return s._IDENTIFIER } |
| 3205 | |
| 3206 | func (s *CreateMessageContext) GetS16() antlr.Token { return s.s16 } |
| 3207 | |
| 3208 | func (s *CreateMessageContext) GetOp() antlr.Token { return s.op } |
| 3209 | |
| 3210 | func (s *CreateMessageContext) SetLeadingDot(v antlr.Token) { s.leadingDot = v } |
| 3211 | |
| 3212 | func (s *CreateMessageContext) Set_IDENTIFIER(v antlr.Token) { s._IDENTIFIER = v } |
| 3213 | |
| 3214 | func (s *CreateMessageContext) SetS16(v antlr.Token) { s.s16 = v } |
| 3215 | |
| 3216 | func (s *CreateMessageContext) SetOp(v antlr.Token) { s.op = v } |
| 3217 | |
| 3218 | func (s *CreateMessageContext) GetIds() []antlr.Token { return s.ids } |
| 3219 | |
| 3220 | func (s *CreateMessageContext) GetOps() []antlr.Token { return s.ops } |
| 3221 | |
| 3222 | func (s *CreateMessageContext) SetIds(v []antlr.Token) { s.ids = v } |
| 3223 | |
| 3224 | func (s *CreateMessageContext) SetOps(v []antlr.Token) { s.ops = v } |
| 3225 | |
| 3226 | func (s *CreateMessageContext) GetEntries() IFieldInitializerListContext { return s.entries } |
| 3227 | |
| 3228 | func (s *CreateMessageContext) SetEntries(v IFieldInitializerListContext) { s.entries = v } |
| 3229 | |
| 3230 | func (s *CreateMessageContext) GetRuleContext() antlr.RuleContext { |
| 3231 | return s |
| 3232 | } |
| 3233 | |
| 3234 | func (s *CreateMessageContext) RBRACE() antlr.TerminalNode { |
| 3235 | return s.GetToken(CELParserRBRACE, 0) |
| 3236 | } |
| 3237 | |
| 3238 | func (s *CreateMessageContext) AllIDENTIFIER() []antlr.TerminalNode { |
| 3239 | return s.GetTokens(CELParserIDENTIFIER) |
| 3240 | } |
| 3241 | |
| 3242 | func (s *CreateMessageContext) IDENTIFIER(i int) antlr.TerminalNode { |
| 3243 | return s.GetToken(CELParserIDENTIFIER, i) |
| 3244 | } |
| 3245 | |
| 3246 | func (s *CreateMessageContext) LBRACE() antlr.TerminalNode { |
| 3247 | return s.GetToken(CELParserLBRACE, 0) |
| 3248 | } |
| 3249 | |
| 3250 | func (s *CreateMessageContext) COMMA() antlr.TerminalNode { |
| 3251 | return s.GetToken(CELParserCOMMA, 0) |
| 3252 | } |
| 3253 | |
| 3254 | func (s *CreateMessageContext) AllDOT() []antlr.TerminalNode { |
| 3255 | return s.GetTokens(CELParserDOT) |
| 3256 | } |
| 3257 | |
| 3258 | func (s *CreateMessageContext) DOT(i int) antlr.TerminalNode { |
| 3259 | return s.GetToken(CELParserDOT, i) |
| 3260 | } |
| 3261 | |
| 3262 | func (s *CreateMessageContext) FieldInitializerList() IFieldInitializerListContext { |
| 3263 | var t antlr.RuleContext |
| 3264 | for _, ctx := range s.GetChildren() { |
| 3265 | if _, ok := ctx.(IFieldInitializerListContext); ok { |
| 3266 | t = ctx.(antlr.RuleContext) |
| 3267 | break |
| 3268 | } |
| 3269 | } |
| 3270 | |
| 3271 | if t == nil { |
| 3272 | return nil |
| 3273 | } |
| 3274 | |
| 3275 | return t.(IFieldInitializerListContext) |
| 3276 | } |
| 3277 | |
| 3278 | func (s *CreateMessageContext) EnterRule(listener antlr.ParseTreeListener) { |
| 3279 | if listenerT, ok := listener.(CELListener); ok { |
| 3280 | listenerT.EnterCreateMessage(s) |
| 3281 | } |
| 3282 | } |
| 3283 | |
| 3284 | func (s *CreateMessageContext) ExitRule(listener antlr.ParseTreeListener) { |
| 3285 | if listenerT, ok := listener.(CELListener); ok { |
| 3286 | listenerT.ExitCreateMessage(s) |
| 3287 | } |
| 3288 | } |
| 3289 | |
| 3290 | func (s *CreateMessageContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { |
| 3291 | switch t := visitor.(type) { |
| 3292 | case CELVisitor: |
| 3293 | return t.VisitCreateMessage(s) |
| 3294 | |
| 3295 | default: |
| 3296 | return t.VisitChildren(s) |
| 3297 | } |
| 3298 | } |
| 3299 | |
| 3300 | type GlobalCallContext struct { |
| 3301 | PrimaryContext |
| 3302 | leadingDot antlr.Token |
| 3303 | id antlr.Token |
| 3304 | op antlr.Token |
| 3305 | args IExprListContext |
| 3306 | } |
| 3307 | |
| 3308 | func NewGlobalCallContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *GlobalCallContext { |
| 3309 | var p = new(GlobalCallContext) |
| 3310 | |
| 3311 | InitEmptyPrimaryContext(&p.PrimaryContext) |
| 3312 | p.parser = parser |
| 3313 | p.CopyAll(ctx.(*PrimaryContext)) |
| 3314 | |
| 3315 | return p |
| 3316 | } |
| 3317 | |
| 3318 | func (s *GlobalCallContext) GetLeadingDot() antlr.Token { return s.leadingDot } |
| 3319 | |
| 3320 | func (s *GlobalCallContext) GetId() antlr.Token { return s.id } |
| 3321 | |
| 3322 | func (s *GlobalCallContext) GetOp() antlr.Token { return s.op } |
| 3323 | |
| 3324 | func (s *GlobalCallContext) SetLeadingDot(v antlr.Token) { s.leadingDot = v } |
| 3325 | |
| 3326 | func (s *GlobalCallContext) SetId(v antlr.Token) { s.id = v } |
| 3327 | |
| 3328 | func (s *GlobalCallContext) SetOp(v antlr.Token) { s.op = v } |
| 3329 | |
| 3330 | func (s *GlobalCallContext) GetArgs() IExprListContext { return s.args } |
| 3331 | |
| 3332 | func (s *GlobalCallContext) SetArgs(v IExprListContext) { s.args = v } |
| 3333 | |
| 3334 | func (s *GlobalCallContext) GetRuleContext() antlr.RuleContext { |
| 3335 | return s |
| 3336 | } |
| 3337 | |
| 3338 | func (s *GlobalCallContext) IDENTIFIER() antlr.TerminalNode { |
| 3339 | return s.GetToken(CELParserIDENTIFIER, 0) |
| 3340 | } |
| 3341 | |
| 3342 | func (s *GlobalCallContext) RPAREN() antlr.TerminalNode { |
| 3343 | return s.GetToken(CELParserRPAREN, 0) |
| 3344 | } |
| 3345 | |
| 3346 | func (s *GlobalCallContext) LPAREN() antlr.TerminalNode { |
| 3347 | return s.GetToken(CELParserLPAREN, 0) |
| 3348 | } |
| 3349 | |
| 3350 | func (s *GlobalCallContext) DOT() antlr.TerminalNode { |
| 3351 | return s.GetToken(CELParserDOT, 0) |
| 3352 | } |
| 3353 | |
| 3354 | func (s *GlobalCallContext) ExprList() IExprListContext { |
| 3355 | var t antlr.RuleContext |
| 3356 | for _, ctx := range s.GetChildren() { |
| 3357 | if _, ok := ctx.(IExprListContext); ok { |
| 3358 | t = ctx.(antlr.RuleContext) |
| 3359 | break |
| 3360 | } |
| 3361 | } |
| 3362 | |
| 3363 | if t == nil { |
| 3364 | return nil |
| 3365 | } |
| 3366 | |
| 3367 | return t.(IExprListContext) |
| 3368 | } |
| 3369 | |
| 3370 | func (s *GlobalCallContext) EnterRule(listener antlr.ParseTreeListener) { |
| 3371 | if listenerT, ok := listener.(CELListener); ok { |
| 3372 | listenerT.EnterGlobalCall(s) |
| 3373 | } |
| 3374 | } |
| 3375 | |
| 3376 | func (s *GlobalCallContext) ExitRule(listener antlr.ParseTreeListener) { |
| 3377 | if listenerT, ok := listener.(CELListener); ok { |
| 3378 | listenerT.ExitGlobalCall(s) |
| 3379 | } |
| 3380 | } |
| 3381 | |
| 3382 | func (s *GlobalCallContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { |
| 3383 | switch t := visitor.(type) { |
| 3384 | case CELVisitor: |
| 3385 | return t.VisitGlobalCall(s) |
| 3386 | |
| 3387 | default: |
| 3388 | return t.VisitChildren(s) |
| 3389 | } |
| 3390 | } |
| 3391 | |
| 3392 | func (p *CELParser) Primary() (localctx IPrimaryContext) { |
| 3393 | localctx = NewPrimaryContext(p, p.GetParserRuleContext(), p.GetState()) |
| 3394 | p.EnterRule(localctx, 16, CELParserRULE_primary) |
| 3395 | var _la int |
| 3396 | |
| 3397 | p.SetState(184) |
| 3398 | p.GetErrorHandler().Sync(p) |
| 3399 | if p.HasError() { |
| 3400 | goto errorExit |
| 3401 | } |
| 3402 | |
| 3403 | switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 25, p.GetParserRuleContext()) { |
| 3404 | case 1: |
| 3405 | localctx = NewIdentContext(p, localctx) |
| 3406 | p.EnterOuterAlt(localctx, 1) |
| 3407 | p.SetState(132) |
| 3408 | p.GetErrorHandler().Sync(p) |
| 3409 | if p.HasError() { |
| 3410 | goto errorExit |
| 3411 | } |
| 3412 | _la = p.GetTokenStream().LA(1) |
| 3413 | |
| 3414 | if _la == CELParserDOT { |
| 3415 | { |
| 3416 | p.SetState(131) |
| 3417 | |
| 3418 | var _m = p.Match(CELParserDOT) |
| 3419 | |
| 3420 | localctx.(*IdentContext).leadingDot = _m |
| 3421 | if p.HasError() { |
| 3422 | // Recognition error - abort rule |
| 3423 | goto errorExit |
| 3424 | } |
| 3425 | } |
| 3426 | |
| 3427 | } |
| 3428 | { |
| 3429 | p.SetState(134) |
| 3430 | |
| 3431 | var _m = p.Match(CELParserIDENTIFIER) |
| 3432 | |
| 3433 | localctx.(*IdentContext).id = _m |
| 3434 | if p.HasError() { |
| 3435 | // Recognition error - abort rule |
| 3436 | goto errorExit |
| 3437 | } |
| 3438 | } |
| 3439 | |
| 3440 | case 2: |
| 3441 | localctx = NewGlobalCallContext(p, localctx) |
| 3442 | p.EnterOuterAlt(localctx, 2) |
| 3443 | p.SetState(136) |
| 3444 | p.GetErrorHandler().Sync(p) |
| 3445 | if p.HasError() { |
| 3446 | goto errorExit |
| 3447 | } |
| 3448 | _la = p.GetTokenStream().LA(1) |
| 3449 | |
| 3450 | if _la == CELParserDOT { |
| 3451 | { |
| 3452 | p.SetState(135) |
| 3453 | |
| 3454 | var _m = p.Match(CELParserDOT) |
| 3455 | |
| 3456 | localctx.(*GlobalCallContext).leadingDot = _m |
| 3457 | if p.HasError() { |
| 3458 | // Recognition error - abort rule |
| 3459 | goto errorExit |
| 3460 | } |
| 3461 | } |
| 3462 | |
| 3463 | } |
| 3464 | { |
| 3465 | p.SetState(138) |
| 3466 | |
| 3467 | var _m = p.Match(CELParserIDENTIFIER) |
| 3468 | |
| 3469 | localctx.(*GlobalCallContext).id = _m |
| 3470 | if p.HasError() { |
| 3471 | // Recognition error - abort rule |
| 3472 | goto errorExit |
| 3473 | } |
| 3474 | } |
| 3475 | |
| 3476 | { |
| 3477 | p.SetState(139) |
| 3478 | |
| 3479 | var _m = p.Match(CELParserLPAREN) |
| 3480 | |
| 3481 | localctx.(*GlobalCallContext).op = _m |
| 3482 | if p.HasError() { |
| 3483 | // Recognition error - abort rule |
| 3484 | goto errorExit |
| 3485 | } |
| 3486 | } |
| 3487 | p.SetState(141) |
| 3488 | p.GetErrorHandler().Sync(p) |
| 3489 | if p.HasError() { |
| 3490 | goto errorExit |
| 3491 | } |
| 3492 | _la = p.GetTokenStream().LA(1) |
| 3493 | |
| 3494 | if (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&135762105344) != 0 { |
| 3495 | { |
| 3496 | p.SetState(140) |
| 3497 | |
| 3498 | var _x = p.ExprList() |
| 3499 | |
| 3500 | localctx.(*GlobalCallContext).args = _x |
| 3501 | } |
| 3502 | |
| 3503 | } |
| 3504 | { |
| 3505 | p.SetState(143) |
| 3506 | p.Match(CELParserRPAREN) |
| 3507 | if p.HasError() { |
| 3508 | // Recognition error - abort rule |
| 3509 | goto errorExit |
| 3510 | } |
| 3511 | } |
| 3512 | |
| 3513 | case 3: |
| 3514 | localctx = NewNestedContext(p, localctx) |
| 3515 | p.EnterOuterAlt(localctx, 3) |
| 3516 | { |
| 3517 | p.SetState(144) |
| 3518 | p.Match(CELParserLPAREN) |
| 3519 | if p.HasError() { |
| 3520 | // Recognition error - abort rule |
| 3521 | goto errorExit |
| 3522 | } |
| 3523 | } |
| 3524 | { |
| 3525 | p.SetState(145) |
| 3526 | |
| 3527 | var _x = p.Expr() |
| 3528 | |
| 3529 | localctx.(*NestedContext).e = _x |
| 3530 | } |
| 3531 | { |
| 3532 | p.SetState(146) |
| 3533 | p.Match(CELParserRPAREN) |
| 3534 | if p.HasError() { |
| 3535 | // Recognition error - abort rule |
| 3536 | goto errorExit |
| 3537 | } |
| 3538 | } |
| 3539 | |
| 3540 | case 4: |
| 3541 | localctx = NewCreateListContext(p, localctx) |
| 3542 | p.EnterOuterAlt(localctx, 4) |
| 3543 | { |
| 3544 | p.SetState(148) |
| 3545 | |
| 3546 | var _m = p.Match(CELParserLBRACKET) |
| 3547 | |
| 3548 | localctx.(*CreateListContext).op = _m |
| 3549 | if p.HasError() { |
| 3550 | // Recognition error - abort rule |
| 3551 | goto errorExit |
| 3552 | } |
| 3553 | } |
| 3554 | p.SetState(150) |
| 3555 | p.GetErrorHandler().Sync(p) |
| 3556 | if p.HasError() { |
| 3557 | goto errorExit |
| 3558 | } |
| 3559 | _la = p.GetTokenStream().LA(1) |
| 3560 | |
| 3561 | if (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&135763153920) != 0 { |
| 3562 | { |
| 3563 | p.SetState(149) |
| 3564 | |
| 3565 | var _x = p.ListInit() |
| 3566 | |
| 3567 | localctx.(*CreateListContext).elems = _x |
| 3568 | } |
| 3569 | |
| 3570 | } |
| 3571 | p.SetState(153) |
| 3572 | p.GetErrorHandler().Sync(p) |
| 3573 | if p.HasError() { |
| 3574 | goto errorExit |
| 3575 | } |
| 3576 | _la = p.GetTokenStream().LA(1) |
| 3577 | |
| 3578 | if _la == CELParserCOMMA { |
| 3579 | { |
| 3580 | p.SetState(152) |
| 3581 | p.Match(CELParserCOMMA) |
| 3582 | if p.HasError() { |
| 3583 | // Recognition error - abort rule |
| 3584 | goto errorExit |
| 3585 | } |
| 3586 | } |
| 3587 | |
| 3588 | } |
| 3589 | { |
| 3590 | p.SetState(155) |
| 3591 | p.Match(CELParserRPRACKET) |
| 3592 | if p.HasError() { |
| 3593 | // Recognition error - abort rule |
| 3594 | goto errorExit |
| 3595 | } |
| 3596 | } |
| 3597 | |
| 3598 | case 5: |
| 3599 | localctx = NewCreateStructContext(p, localctx) |
| 3600 | p.EnterOuterAlt(localctx, 5) |
| 3601 | { |
| 3602 | p.SetState(156) |
| 3603 | |
| 3604 | var _m = p.Match(CELParserLBRACE) |
| 3605 | |
| 3606 | localctx.(*CreateStructContext).op = _m |
| 3607 | if p.HasError() { |
| 3608 | // Recognition error - abort rule |
| 3609 | goto errorExit |
| 3610 | } |
| 3611 | } |
| 3612 | p.SetState(158) |
| 3613 | p.GetErrorHandler().Sync(p) |
| 3614 | if p.HasError() { |
| 3615 | goto errorExit |
| 3616 | } |
| 3617 | _la = p.GetTokenStream().LA(1) |
| 3618 | |
| 3619 | if (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&135763153920) != 0 { |
| 3620 | { |
| 3621 | p.SetState(157) |
| 3622 | |
| 3623 | var _x = p.MapInitializerList() |
| 3624 | |
| 3625 | localctx.(*CreateStructContext).entries = _x |
| 3626 | } |
| 3627 | |
| 3628 | } |
| 3629 | p.SetState(161) |
| 3630 | p.GetErrorHandler().Sync(p) |
| 3631 | if p.HasError() { |
| 3632 | goto errorExit |
| 3633 | } |
| 3634 | _la = p.GetTokenStream().LA(1) |
| 3635 | |
| 3636 | if _la == CELParserCOMMA { |
| 3637 | { |
| 3638 | p.SetState(160) |
| 3639 | p.Match(CELParserCOMMA) |
| 3640 | if p.HasError() { |
| 3641 | // Recognition error - abort rule |
| 3642 | goto errorExit |
| 3643 | } |
| 3644 | } |
| 3645 | |
| 3646 | } |
| 3647 | { |
| 3648 | p.SetState(163) |
| 3649 | p.Match(CELParserRBRACE) |
| 3650 | if p.HasError() { |
| 3651 | // Recognition error - abort rule |
| 3652 | goto errorExit |
| 3653 | } |
| 3654 | } |
| 3655 | |
| 3656 | case 6: |
| 3657 | localctx = NewCreateMessageContext(p, localctx) |
| 3658 | p.EnterOuterAlt(localctx, 6) |
| 3659 | p.SetState(165) |
| 3660 | p.GetErrorHandler().Sync(p) |
| 3661 | if p.HasError() { |
| 3662 | goto errorExit |
| 3663 | } |
| 3664 | _la = p.GetTokenStream().LA(1) |
| 3665 | |
| 3666 | if _la == CELParserDOT { |
| 3667 | { |
| 3668 | p.SetState(164) |
| 3669 | |
| 3670 | var _m = p.Match(CELParserDOT) |
| 3671 | |
| 3672 | localctx.(*CreateMessageContext).leadingDot = _m |
| 3673 | if p.HasError() { |
| 3674 | // Recognition error - abort rule |
| 3675 | goto errorExit |
| 3676 | } |
| 3677 | } |
| 3678 | |
| 3679 | } |
| 3680 | { |
| 3681 | p.SetState(167) |
| 3682 | |
| 3683 | var _m = p.Match(CELParserIDENTIFIER) |
| 3684 | |
| 3685 | localctx.(*CreateMessageContext)._IDENTIFIER = _m |
| 3686 | if p.HasError() { |
| 3687 | // Recognition error - abort rule |
| 3688 | goto errorExit |
| 3689 | } |
| 3690 | } |
| 3691 | localctx.(*CreateMessageContext).ids = append(localctx.(*CreateMessageContext).ids, localctx.(*CreateMessageContext)._IDENTIFIER) |
| 3692 | p.SetState(172) |
| 3693 | p.GetErrorHandler().Sync(p) |
| 3694 | if p.HasError() { |
| 3695 | goto errorExit |
| 3696 | } |
| 3697 | _la = p.GetTokenStream().LA(1) |
| 3698 | |
| 3699 | for _la == CELParserDOT { |
| 3700 | { |
| 3701 | p.SetState(168) |
| 3702 | |
| 3703 | var _m = p.Match(CELParserDOT) |
| 3704 | |
| 3705 | localctx.(*CreateMessageContext).s16 = _m |
| 3706 | if p.HasError() { |
| 3707 | // Recognition error - abort rule |
| 3708 | goto errorExit |
| 3709 | } |
| 3710 | } |
| 3711 | localctx.(*CreateMessageContext).ops = append(localctx.(*CreateMessageContext).ops, localctx.(*CreateMessageContext).s16) |
| 3712 | { |
| 3713 | p.SetState(169) |
| 3714 | |
| 3715 | var _m = p.Match(CELParserIDENTIFIER) |
| 3716 | |
| 3717 | localctx.(*CreateMessageContext)._IDENTIFIER = _m |
| 3718 | if p.HasError() { |
| 3719 | // Recognition error - abort rule |
| 3720 | goto errorExit |
| 3721 | } |
| 3722 | } |
| 3723 | localctx.(*CreateMessageContext).ids = append(localctx.(*CreateMessageContext).ids, localctx.(*CreateMessageContext)._IDENTIFIER) |
| 3724 | |
| 3725 | p.SetState(174) |
| 3726 | p.GetErrorHandler().Sync(p) |
| 3727 | if p.HasError() { |
| 3728 | goto errorExit |
| 3729 | } |
| 3730 | _la = p.GetTokenStream().LA(1) |
| 3731 | } |
| 3732 | { |
| 3733 | p.SetState(175) |
| 3734 | |
| 3735 | var _m = p.Match(CELParserLBRACE) |
| 3736 | |
| 3737 | localctx.(*CreateMessageContext).op = _m |
| 3738 | if p.HasError() { |
| 3739 | // Recognition error - abort rule |
| 3740 | goto errorExit |
| 3741 | } |
| 3742 | } |
| 3743 | p.SetState(177) |
| 3744 | p.GetErrorHandler().Sync(p) |
| 3745 | if p.HasError() { |
| 3746 | goto errorExit |
| 3747 | } |
| 3748 | _la = p.GetTokenStream().LA(1) |
| 3749 | |
| 3750 | if (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&206159478784) != 0 { |
| 3751 | { |
| 3752 | p.SetState(176) |
| 3753 | |
| 3754 | var _x = p.FieldInitializerList() |
| 3755 | |
| 3756 | localctx.(*CreateMessageContext).entries = _x |
| 3757 | } |
| 3758 | |
| 3759 | } |
| 3760 | p.SetState(180) |
| 3761 | p.GetErrorHandler().Sync(p) |
| 3762 | if p.HasError() { |
| 3763 | goto errorExit |
| 3764 | } |
| 3765 | _la = p.GetTokenStream().LA(1) |
| 3766 | |
| 3767 | if _la == CELParserCOMMA { |
| 3768 | { |
| 3769 | p.SetState(179) |
| 3770 | p.Match(CELParserCOMMA) |
| 3771 | if p.HasError() { |
| 3772 | // Recognition error - abort rule |
| 3773 | goto errorExit |
| 3774 | } |
| 3775 | } |
| 3776 | |
| 3777 | } |
| 3778 | { |
| 3779 | p.SetState(182) |
| 3780 | p.Match(CELParserRBRACE) |
| 3781 | if p.HasError() { |
| 3782 | // Recognition error - abort rule |
| 3783 | goto errorExit |
| 3784 | } |
| 3785 | } |
| 3786 | |
| 3787 | case 7: |
| 3788 | localctx = NewConstantLiteralContext(p, localctx) |
| 3789 | p.EnterOuterAlt(localctx, 7) |
| 3790 | { |
| 3791 | p.SetState(183) |
| 3792 | p.Literal() |
| 3793 | } |
| 3794 | |
| 3795 | case antlr.ATNInvalidAltNumber: |
| 3796 | goto errorExit |
| 3797 | } |
| 3798 | |
| 3799 | errorExit: |
| 3800 | if p.HasError() { |
| 3801 | v := p.GetError() |
| 3802 | localctx.SetException(v) |
| 3803 | p.GetErrorHandler().ReportError(p, v) |
| 3804 | p.GetErrorHandler().Recover(p, v) |
| 3805 | p.SetError(nil) |
| 3806 | } |
| 3807 | p.ExitRule() |
| 3808 | return localctx |
| 3809 | goto errorExit // Trick to prevent compiler error if the label is not used |
| 3810 | } |
| 3811 | |
| 3812 | // IExprListContext is an interface to support dynamic dispatch. |
| 3813 | type IExprListContext interface { |
| 3814 | antlr.ParserRuleContext |
| 3815 | |
| 3816 | // GetParser returns the parser. |
| 3817 | GetParser() antlr.Parser |
| 3818 | |
| 3819 | // Get_expr returns the _expr rule contexts. |
| 3820 | Get_expr() IExprContext |
| 3821 | |
| 3822 | // Set_expr sets the _expr rule contexts. |
| 3823 | Set_expr(IExprContext) |
| 3824 | |
| 3825 | // GetE returns the e rule context list. |
| 3826 | GetE() []IExprContext |
| 3827 | |
| 3828 | // SetE sets the e rule context list. |
| 3829 | SetE([]IExprContext) |
| 3830 | |
| 3831 | // Getter signatures |
| 3832 | AllExpr() []IExprContext |
| 3833 | Expr(i int) IExprContext |
| 3834 | AllCOMMA() []antlr.TerminalNode |
| 3835 | COMMA(i int) antlr.TerminalNode |
| 3836 | |
| 3837 | // IsExprListContext differentiates from other interfaces. |
| 3838 | IsExprListContext() |
| 3839 | } |
| 3840 | |
| 3841 | type ExprListContext struct { |
| 3842 | antlr.BaseParserRuleContext |
| 3843 | parser antlr.Parser |
| 3844 | _expr IExprContext |
| 3845 | e []IExprContext |
| 3846 | } |
| 3847 | |
| 3848 | func NewEmptyExprListContext() *ExprListContext { |
| 3849 | var p = new(ExprListContext) |
| 3850 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) |
| 3851 | p.RuleIndex = CELParserRULE_exprList |
| 3852 | return p |
| 3853 | } |
| 3854 | |
| 3855 | func InitEmptyExprListContext(p *ExprListContext) { |
| 3856 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) |
| 3857 | p.RuleIndex = CELParserRULE_exprList |
| 3858 | } |
| 3859 | |
| 3860 | func (*ExprListContext) IsExprListContext() {} |
| 3861 | |
| 3862 | func NewExprListContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ExprListContext { |
| 3863 | var p = new(ExprListContext) |
| 3864 | |
| 3865 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) |
| 3866 | |
| 3867 | p.parser = parser |
| 3868 | p.RuleIndex = CELParserRULE_exprList |
| 3869 | |
| 3870 | return p |
| 3871 | } |
| 3872 | |
| 3873 | func (s *ExprListContext) GetParser() antlr.Parser { return s.parser } |
| 3874 | |
| 3875 | func (s *ExprListContext) Get_expr() IExprContext { return s._expr } |
| 3876 | |
| 3877 | func (s *ExprListContext) Set_expr(v IExprContext) { s._expr = v } |
| 3878 | |
| 3879 | func (s *ExprListContext) GetE() []IExprContext { return s.e } |
| 3880 | |
| 3881 | func (s *ExprListContext) SetE(v []IExprContext) { s.e = v } |
| 3882 | |
| 3883 | func (s *ExprListContext) AllExpr() []IExprContext { |
| 3884 | children := s.GetChildren() |
| 3885 | len := 0 |
| 3886 | for _, ctx := range children { |
| 3887 | if _, ok := ctx.(IExprContext); ok { |
| 3888 | len++ |
| 3889 | } |
| 3890 | } |
| 3891 | |
| 3892 | tst := make([]IExprContext, len) |
| 3893 | i := 0 |
| 3894 | for _, ctx := range children { |
| 3895 | if t, ok := ctx.(IExprContext); ok { |
| 3896 | tst[i] = t.(IExprContext) |
| 3897 | i++ |
| 3898 | } |
| 3899 | } |
| 3900 | |
| 3901 | return tst |
| 3902 | } |
| 3903 | |
| 3904 | func (s *ExprListContext) Expr(i int) IExprContext { |
| 3905 | var t antlr.RuleContext |
| 3906 | j := 0 |
| 3907 | for _, ctx := range s.GetChildren() { |
| 3908 | if _, ok := ctx.(IExprContext); ok { |
| 3909 | if j == i { |
| 3910 | t = ctx.(antlr.RuleContext) |
| 3911 | break |
| 3912 | } |
| 3913 | j++ |
| 3914 | } |
| 3915 | } |
| 3916 | |
| 3917 | if t == nil { |
| 3918 | return nil |
| 3919 | } |
| 3920 | |
| 3921 | return t.(IExprContext) |
| 3922 | } |
| 3923 | |
| 3924 | func (s *ExprListContext) AllCOMMA() []antlr.TerminalNode { |
| 3925 | return s.GetTokens(CELParserCOMMA) |
| 3926 | } |
| 3927 | |
| 3928 | func (s *ExprListContext) COMMA(i int) antlr.TerminalNode { |
| 3929 | return s.GetToken(CELParserCOMMA, i) |
| 3930 | } |
| 3931 | |
| 3932 | func (s *ExprListContext) GetRuleContext() antlr.RuleContext { |
| 3933 | return s |
| 3934 | } |
| 3935 | |
| 3936 | func (s *ExprListContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { |
| 3937 | return antlr.TreesStringTree(s, ruleNames, recog) |
| 3938 | } |
| 3939 | |
| 3940 | func (s *ExprListContext) EnterRule(listener antlr.ParseTreeListener) { |
| 3941 | if listenerT, ok := listener.(CELListener); ok { |
| 3942 | listenerT.EnterExprList(s) |
| 3943 | } |
| 3944 | } |
| 3945 | |
| 3946 | func (s *ExprListContext) ExitRule(listener antlr.ParseTreeListener) { |
| 3947 | if listenerT, ok := listener.(CELListener); ok { |
| 3948 | listenerT.ExitExprList(s) |
| 3949 | } |
| 3950 | } |
| 3951 | |
| 3952 | func (s *ExprListContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { |
| 3953 | switch t := visitor.(type) { |
| 3954 | case CELVisitor: |
| 3955 | return t.VisitExprList(s) |
| 3956 | |
| 3957 | default: |
| 3958 | return t.VisitChildren(s) |
| 3959 | } |
| 3960 | } |
| 3961 | |
| 3962 | func (p *CELParser) ExprList() (localctx IExprListContext) { |
| 3963 | localctx = NewExprListContext(p, p.GetParserRuleContext(), p.GetState()) |
| 3964 | p.EnterRule(localctx, 18, CELParserRULE_exprList) |
| 3965 | var _la int |
| 3966 | |
| 3967 | p.EnterOuterAlt(localctx, 1) |
| 3968 | { |
| 3969 | p.SetState(186) |
| 3970 | |
| 3971 | var _x = p.Expr() |
| 3972 | |
| 3973 | localctx.(*ExprListContext)._expr = _x |
| 3974 | } |
| 3975 | localctx.(*ExprListContext).e = append(localctx.(*ExprListContext).e, localctx.(*ExprListContext)._expr) |
| 3976 | p.SetState(191) |
| 3977 | p.GetErrorHandler().Sync(p) |
| 3978 | if p.HasError() { |
| 3979 | goto errorExit |
| 3980 | } |
| 3981 | _la = p.GetTokenStream().LA(1) |
| 3982 | |
| 3983 | for _la == CELParserCOMMA { |
| 3984 | { |
| 3985 | p.SetState(187) |
| 3986 | p.Match(CELParserCOMMA) |
| 3987 | if p.HasError() { |
| 3988 | // Recognition error - abort rule |
| 3989 | goto errorExit |
| 3990 | } |
| 3991 | } |
| 3992 | { |
| 3993 | p.SetState(188) |
| 3994 | |
| 3995 | var _x = p.Expr() |
| 3996 | |
| 3997 | localctx.(*ExprListContext)._expr = _x |
| 3998 | } |
| 3999 | localctx.(*ExprListContext).e = append(localctx.(*ExprListContext).e, localctx.(*ExprListContext)._expr) |
| 4000 | |
| 4001 | p.SetState(193) |
| 4002 | p.GetErrorHandler().Sync(p) |
| 4003 | if p.HasError() { |
| 4004 | goto errorExit |
| 4005 | } |
| 4006 | _la = p.GetTokenStream().LA(1) |
| 4007 | } |
| 4008 | |
| 4009 | errorExit: |
| 4010 | if p.HasError() { |
| 4011 | v := p.GetError() |
| 4012 | localctx.SetException(v) |
| 4013 | p.GetErrorHandler().ReportError(p, v) |
| 4014 | p.GetErrorHandler().Recover(p, v) |
| 4015 | p.SetError(nil) |
| 4016 | } |
| 4017 | p.ExitRule() |
| 4018 | return localctx |
| 4019 | goto errorExit // Trick to prevent compiler error if the label is not used |
| 4020 | } |
| 4021 | |
| 4022 | // IListInitContext is an interface to support dynamic dispatch. |
| 4023 | type IListInitContext interface { |
| 4024 | antlr.ParserRuleContext |
| 4025 | |
| 4026 | // GetParser returns the parser. |
| 4027 | GetParser() antlr.Parser |
| 4028 | |
| 4029 | // Get_optExpr returns the _optExpr rule contexts. |
| 4030 | Get_optExpr() IOptExprContext |
| 4031 | |
| 4032 | // Set_optExpr sets the _optExpr rule contexts. |
| 4033 | Set_optExpr(IOptExprContext) |
| 4034 | |
| 4035 | // GetElems returns the elems rule context list. |
| 4036 | GetElems() []IOptExprContext |
| 4037 | |
| 4038 | // SetElems sets the elems rule context list. |
| 4039 | SetElems([]IOptExprContext) |
| 4040 | |
| 4041 | // Getter signatures |
| 4042 | AllOptExpr() []IOptExprContext |
| 4043 | OptExpr(i int) IOptExprContext |
| 4044 | AllCOMMA() []antlr.TerminalNode |
| 4045 | COMMA(i int) antlr.TerminalNode |
| 4046 | |
| 4047 | // IsListInitContext differentiates from other interfaces. |
| 4048 | IsListInitContext() |
| 4049 | } |
| 4050 | |
| 4051 | type ListInitContext struct { |
| 4052 | antlr.BaseParserRuleContext |
| 4053 | parser antlr.Parser |
| 4054 | _optExpr IOptExprContext |
| 4055 | elems []IOptExprContext |
| 4056 | } |
| 4057 | |
| 4058 | func NewEmptyListInitContext() *ListInitContext { |
| 4059 | var p = new(ListInitContext) |
| 4060 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) |
| 4061 | p.RuleIndex = CELParserRULE_listInit |
| 4062 | return p |
| 4063 | } |
| 4064 | |
| 4065 | func InitEmptyListInitContext(p *ListInitContext) { |
| 4066 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) |
| 4067 | p.RuleIndex = CELParserRULE_listInit |
| 4068 | } |
| 4069 | |
| 4070 | func (*ListInitContext) IsListInitContext() {} |
| 4071 | |
| 4072 | func NewListInitContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ListInitContext { |
| 4073 | var p = new(ListInitContext) |
| 4074 | |
| 4075 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) |
| 4076 | |
| 4077 | p.parser = parser |
| 4078 | p.RuleIndex = CELParserRULE_listInit |
| 4079 | |
| 4080 | return p |
| 4081 | } |
| 4082 | |
| 4083 | func (s *ListInitContext) GetParser() antlr.Parser { return s.parser } |
| 4084 | |
| 4085 | func (s *ListInitContext) Get_optExpr() IOptExprContext { return s._optExpr } |
| 4086 | |
| 4087 | func (s *ListInitContext) Set_optExpr(v IOptExprContext) { s._optExpr = v } |
| 4088 | |
| 4089 | func (s *ListInitContext) GetElems() []IOptExprContext { return s.elems } |
| 4090 | |
| 4091 | func (s *ListInitContext) SetElems(v []IOptExprContext) { s.elems = v } |
| 4092 | |
| 4093 | func (s *ListInitContext) AllOptExpr() []IOptExprContext { |
| 4094 | children := s.GetChildren() |
| 4095 | len := 0 |
| 4096 | for _, ctx := range children { |
| 4097 | if _, ok := ctx.(IOptExprContext); ok { |
| 4098 | len++ |
| 4099 | } |
| 4100 | } |
| 4101 | |
| 4102 | tst := make([]IOptExprContext, len) |
| 4103 | i := 0 |
| 4104 | for _, ctx := range children { |
| 4105 | if t, ok := ctx.(IOptExprContext); ok { |
| 4106 | tst[i] = t.(IOptExprContext) |
| 4107 | i++ |
| 4108 | } |
| 4109 | } |
| 4110 | |
| 4111 | return tst |
| 4112 | } |
| 4113 | |
| 4114 | func (s *ListInitContext) OptExpr(i int) IOptExprContext { |
| 4115 | var t antlr.RuleContext |
| 4116 | j := 0 |
| 4117 | for _, ctx := range s.GetChildren() { |
| 4118 | if _, ok := ctx.(IOptExprContext); ok { |
| 4119 | if j == i { |
| 4120 | t = ctx.(antlr.RuleContext) |
| 4121 | break |
| 4122 | } |
| 4123 | j++ |
| 4124 | } |
| 4125 | } |
| 4126 | |
| 4127 | if t == nil { |
| 4128 | return nil |
| 4129 | } |
| 4130 | |
| 4131 | return t.(IOptExprContext) |
| 4132 | } |
| 4133 | |
| 4134 | func (s *ListInitContext) AllCOMMA() []antlr.TerminalNode { |
| 4135 | return s.GetTokens(CELParserCOMMA) |
| 4136 | } |
| 4137 | |
| 4138 | func (s *ListInitContext) COMMA(i int) antlr.TerminalNode { |
| 4139 | return s.GetToken(CELParserCOMMA, i) |
| 4140 | } |
| 4141 | |
| 4142 | func (s *ListInitContext) GetRuleContext() antlr.RuleContext { |
| 4143 | return s |
| 4144 | } |
| 4145 | |
| 4146 | func (s *ListInitContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { |
| 4147 | return antlr.TreesStringTree(s, ruleNames, recog) |
| 4148 | } |
| 4149 | |
| 4150 | func (s *ListInitContext) EnterRule(listener antlr.ParseTreeListener) { |
| 4151 | if listenerT, ok := listener.(CELListener); ok { |
| 4152 | listenerT.EnterListInit(s) |
| 4153 | } |
| 4154 | } |
| 4155 | |
| 4156 | func (s *ListInitContext) ExitRule(listener antlr.ParseTreeListener) { |
| 4157 | if listenerT, ok := listener.(CELListener); ok { |
| 4158 | listenerT.ExitListInit(s) |
| 4159 | } |
| 4160 | } |
| 4161 | |
| 4162 | func (s *ListInitContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { |
| 4163 | switch t := visitor.(type) { |
| 4164 | case CELVisitor: |
| 4165 | return t.VisitListInit(s) |
| 4166 | |
| 4167 | default: |
| 4168 | return t.VisitChildren(s) |
| 4169 | } |
| 4170 | } |
| 4171 | |
| 4172 | func (p *CELParser) ListInit() (localctx IListInitContext) { |
| 4173 | localctx = NewListInitContext(p, p.GetParserRuleContext(), p.GetState()) |
| 4174 | p.EnterRule(localctx, 20, CELParserRULE_listInit) |
| 4175 | var _alt int |
| 4176 | |
| 4177 | p.EnterOuterAlt(localctx, 1) |
| 4178 | { |
| 4179 | p.SetState(194) |
| 4180 | |
| 4181 | var _x = p.OptExpr() |
| 4182 | |
| 4183 | localctx.(*ListInitContext)._optExpr = _x |
| 4184 | } |
| 4185 | localctx.(*ListInitContext).elems = append(localctx.(*ListInitContext).elems, localctx.(*ListInitContext)._optExpr) |
| 4186 | p.SetState(199) |
| 4187 | p.GetErrorHandler().Sync(p) |
| 4188 | if p.HasError() { |
| 4189 | goto errorExit |
| 4190 | } |
| 4191 | _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 27, p.GetParserRuleContext()) |
| 4192 | if p.HasError() { |
| 4193 | goto errorExit |
| 4194 | } |
| 4195 | for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { |
| 4196 | if _alt == 1 { |
| 4197 | { |
| 4198 | p.SetState(195) |
| 4199 | p.Match(CELParserCOMMA) |
| 4200 | if p.HasError() { |
| 4201 | // Recognition error - abort rule |
| 4202 | goto errorExit |
| 4203 | } |
| 4204 | } |
| 4205 | { |
| 4206 | p.SetState(196) |
| 4207 | |
| 4208 | var _x = p.OptExpr() |
| 4209 | |
| 4210 | localctx.(*ListInitContext)._optExpr = _x |
| 4211 | } |
| 4212 | localctx.(*ListInitContext).elems = append(localctx.(*ListInitContext).elems, localctx.(*ListInitContext)._optExpr) |
| 4213 | |
| 4214 | } |
| 4215 | p.SetState(201) |
| 4216 | p.GetErrorHandler().Sync(p) |
| 4217 | if p.HasError() { |
| 4218 | goto errorExit |
| 4219 | } |
| 4220 | _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 27, p.GetParserRuleContext()) |
| 4221 | if p.HasError() { |
| 4222 | goto errorExit |
| 4223 | } |
| 4224 | } |
| 4225 | |
| 4226 | errorExit: |
| 4227 | if p.HasError() { |
| 4228 | v := p.GetError() |
| 4229 | localctx.SetException(v) |
| 4230 | p.GetErrorHandler().ReportError(p, v) |
| 4231 | p.GetErrorHandler().Recover(p, v) |
| 4232 | p.SetError(nil) |
| 4233 | } |
| 4234 | p.ExitRule() |
| 4235 | return localctx |
| 4236 | goto errorExit // Trick to prevent compiler error if the label is not used |
| 4237 | } |
| 4238 | |
| 4239 | // IFieldInitializerListContext is an interface to support dynamic dispatch. |
| 4240 | type IFieldInitializerListContext interface { |
| 4241 | antlr.ParserRuleContext |
| 4242 | |
| 4243 | // GetParser returns the parser. |
| 4244 | GetParser() antlr.Parser |
| 4245 | |
| 4246 | // GetS21 returns the s21 token. |
| 4247 | GetS21() antlr.Token |
| 4248 | |
| 4249 | // SetS21 sets the s21 token. |
| 4250 | SetS21(antlr.Token) |
| 4251 | |
| 4252 | // GetCols returns the cols token list. |
| 4253 | GetCols() []antlr.Token |
| 4254 | |
| 4255 | // SetCols sets the cols token list. |
| 4256 | SetCols([]antlr.Token) |
| 4257 | |
| 4258 | // Get_optField returns the _optField rule contexts. |
| 4259 | Get_optField() IOptFieldContext |
| 4260 | |
| 4261 | // Get_expr returns the _expr rule contexts. |
| 4262 | Get_expr() IExprContext |
| 4263 | |
| 4264 | // Set_optField sets the _optField rule contexts. |
| 4265 | Set_optField(IOptFieldContext) |
| 4266 | |
| 4267 | // Set_expr sets the _expr rule contexts. |
| 4268 | Set_expr(IExprContext) |
| 4269 | |
| 4270 | // GetFields returns the fields rule context list. |
| 4271 | GetFields() []IOptFieldContext |
| 4272 | |
| 4273 | // GetValues returns the values rule context list. |
| 4274 | GetValues() []IExprContext |
| 4275 | |
| 4276 | // SetFields sets the fields rule context list. |
| 4277 | SetFields([]IOptFieldContext) |
| 4278 | |
| 4279 | // SetValues sets the values rule context list. |
| 4280 | SetValues([]IExprContext) |
| 4281 | |
| 4282 | // Getter signatures |
| 4283 | AllOptField() []IOptFieldContext |
| 4284 | OptField(i int) IOptFieldContext |
| 4285 | AllCOLON() []antlr.TerminalNode |
| 4286 | COLON(i int) antlr.TerminalNode |
| 4287 | AllExpr() []IExprContext |
| 4288 | Expr(i int) IExprContext |
| 4289 | AllCOMMA() []antlr.TerminalNode |
| 4290 | COMMA(i int) antlr.TerminalNode |
| 4291 | |
| 4292 | // IsFieldInitializerListContext differentiates from other interfaces. |
| 4293 | IsFieldInitializerListContext() |
| 4294 | } |
| 4295 | |
| 4296 | type FieldInitializerListContext struct { |
| 4297 | antlr.BaseParserRuleContext |
| 4298 | parser antlr.Parser |
| 4299 | _optField IOptFieldContext |
| 4300 | fields []IOptFieldContext |
| 4301 | s21 antlr.Token |
| 4302 | cols []antlr.Token |
| 4303 | _expr IExprContext |
| 4304 | values []IExprContext |
| 4305 | } |
| 4306 | |
| 4307 | func NewEmptyFieldInitializerListContext() *FieldInitializerListContext { |
| 4308 | var p = new(FieldInitializerListContext) |
| 4309 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) |
| 4310 | p.RuleIndex = CELParserRULE_fieldInitializerList |
| 4311 | return p |
| 4312 | } |
| 4313 | |
| 4314 | func InitEmptyFieldInitializerListContext(p *FieldInitializerListContext) { |
| 4315 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) |
| 4316 | p.RuleIndex = CELParserRULE_fieldInitializerList |
| 4317 | } |
| 4318 | |
| 4319 | func (*FieldInitializerListContext) IsFieldInitializerListContext() {} |
| 4320 | |
| 4321 | func NewFieldInitializerListContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *FieldInitializerListContext { |
| 4322 | var p = new(FieldInitializerListContext) |
| 4323 | |
| 4324 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) |
| 4325 | |
| 4326 | p.parser = parser |
| 4327 | p.RuleIndex = CELParserRULE_fieldInitializerList |
| 4328 | |
| 4329 | return p |
| 4330 | } |
| 4331 | |
| 4332 | func (s *FieldInitializerListContext) GetParser() antlr.Parser { return s.parser } |
| 4333 | |
| 4334 | func (s *FieldInitializerListContext) GetS21() antlr.Token { return s.s21 } |
| 4335 | |
| 4336 | func (s *FieldInitializerListContext) SetS21(v antlr.Token) { s.s21 = v } |
| 4337 | |
| 4338 | func (s *FieldInitializerListContext) GetCols() []antlr.Token { return s.cols } |
| 4339 | |
| 4340 | func (s *FieldInitializerListContext) SetCols(v []antlr.Token) { s.cols = v } |
| 4341 | |
| 4342 | func (s *FieldInitializerListContext) Get_optField() IOptFieldContext { return s._optField } |
| 4343 | |
| 4344 | func (s *FieldInitializerListContext) Get_expr() IExprContext { return s._expr } |
| 4345 | |
| 4346 | func (s *FieldInitializerListContext) Set_optField(v IOptFieldContext) { s._optField = v } |
| 4347 | |
| 4348 | func (s *FieldInitializerListContext) Set_expr(v IExprContext) { s._expr = v } |
| 4349 | |
| 4350 | func (s *FieldInitializerListContext) GetFields() []IOptFieldContext { return s.fields } |
| 4351 | |
| 4352 | func (s *FieldInitializerListContext) GetValues() []IExprContext { return s.values } |
| 4353 | |
| 4354 | func (s *FieldInitializerListContext) SetFields(v []IOptFieldContext) { s.fields = v } |
| 4355 | |
| 4356 | func (s *FieldInitializerListContext) SetValues(v []IExprContext) { s.values = v } |
| 4357 | |
| 4358 | func (s *FieldInitializerListContext) AllOptField() []IOptFieldContext { |
| 4359 | children := s.GetChildren() |
| 4360 | len := 0 |
| 4361 | for _, ctx := range children { |
| 4362 | if _, ok := ctx.(IOptFieldContext); ok { |
| 4363 | len++ |
| 4364 | } |
| 4365 | } |
| 4366 | |
| 4367 | tst := make([]IOptFieldContext, len) |
| 4368 | i := 0 |
| 4369 | for _, ctx := range children { |
| 4370 | if t, ok := ctx.(IOptFieldContext); ok { |
| 4371 | tst[i] = t.(IOptFieldContext) |
| 4372 | i++ |
| 4373 | } |
| 4374 | } |
| 4375 | |
| 4376 | return tst |
| 4377 | } |
| 4378 | |
| 4379 | func (s *FieldInitializerListContext) OptField(i int) IOptFieldContext { |
| 4380 | var t antlr.RuleContext |
| 4381 | j := 0 |
| 4382 | for _, ctx := range s.GetChildren() { |
| 4383 | if _, ok := ctx.(IOptFieldContext); ok { |
| 4384 | if j == i { |
| 4385 | t = ctx.(antlr.RuleContext) |
| 4386 | break |
| 4387 | } |
| 4388 | j++ |
| 4389 | } |
| 4390 | } |
| 4391 | |
| 4392 | if t == nil { |
| 4393 | return nil |
| 4394 | } |
| 4395 | |
| 4396 | return t.(IOptFieldContext) |
| 4397 | } |
| 4398 | |
| 4399 | func (s *FieldInitializerListContext) AllCOLON() []antlr.TerminalNode { |
| 4400 | return s.GetTokens(CELParserCOLON) |
| 4401 | } |
| 4402 | |
| 4403 | func (s *FieldInitializerListContext) COLON(i int) antlr.TerminalNode { |
| 4404 | return s.GetToken(CELParserCOLON, i) |
| 4405 | } |
| 4406 | |
| 4407 | func (s *FieldInitializerListContext) AllExpr() []IExprContext { |
| 4408 | children := s.GetChildren() |
| 4409 | len := 0 |
| 4410 | for _, ctx := range children { |
| 4411 | if _, ok := ctx.(IExprContext); ok { |
| 4412 | len++ |
| 4413 | } |
| 4414 | } |
| 4415 | |
| 4416 | tst := make([]IExprContext, len) |
| 4417 | i := 0 |
| 4418 | for _, ctx := range children { |
| 4419 | if t, ok := ctx.(IExprContext); ok { |
| 4420 | tst[i] = t.(IExprContext) |
| 4421 | i++ |
| 4422 | } |
| 4423 | } |
| 4424 | |
| 4425 | return tst |
| 4426 | } |
| 4427 | |
| 4428 | func (s *FieldInitializerListContext) Expr(i int) IExprContext { |
| 4429 | var t antlr.RuleContext |
| 4430 | j := 0 |
| 4431 | for _, ctx := range s.GetChildren() { |
| 4432 | if _, ok := ctx.(IExprContext); ok { |
| 4433 | if j == i { |
| 4434 | t = ctx.(antlr.RuleContext) |
| 4435 | break |
| 4436 | } |
| 4437 | j++ |
| 4438 | } |
| 4439 | } |
| 4440 | |
| 4441 | if t == nil { |
| 4442 | return nil |
| 4443 | } |
| 4444 | |
| 4445 | return t.(IExprContext) |
| 4446 | } |
| 4447 | |
| 4448 | func (s *FieldInitializerListContext) AllCOMMA() []antlr.TerminalNode { |
| 4449 | return s.GetTokens(CELParserCOMMA) |
| 4450 | } |
| 4451 | |
| 4452 | func (s *FieldInitializerListContext) COMMA(i int) antlr.TerminalNode { |
| 4453 | return s.GetToken(CELParserCOMMA, i) |
| 4454 | } |
| 4455 | |
| 4456 | func (s *FieldInitializerListContext) GetRuleContext() antlr.RuleContext { |
| 4457 | return s |
| 4458 | } |
| 4459 | |
| 4460 | func (s *FieldInitializerListContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { |
| 4461 | return antlr.TreesStringTree(s, ruleNames, recog) |
| 4462 | } |
| 4463 | |
| 4464 | func (s *FieldInitializerListContext) EnterRule(listener antlr.ParseTreeListener) { |
| 4465 | if listenerT, ok := listener.(CELListener); ok { |
| 4466 | listenerT.EnterFieldInitializerList(s) |
| 4467 | } |
| 4468 | } |
| 4469 | |
| 4470 | func (s *FieldInitializerListContext) ExitRule(listener antlr.ParseTreeListener) { |
| 4471 | if listenerT, ok := listener.(CELListener); ok { |
| 4472 | listenerT.ExitFieldInitializerList(s) |
| 4473 | } |
| 4474 | } |
| 4475 | |
| 4476 | func (s *FieldInitializerListContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { |
| 4477 | switch t := visitor.(type) { |
| 4478 | case CELVisitor: |
| 4479 | return t.VisitFieldInitializerList(s) |
| 4480 | |
| 4481 | default: |
| 4482 | return t.VisitChildren(s) |
| 4483 | } |
| 4484 | } |
| 4485 | |
| 4486 | func (p *CELParser) FieldInitializerList() (localctx IFieldInitializerListContext) { |
| 4487 | localctx = NewFieldInitializerListContext(p, p.GetParserRuleContext(), p.GetState()) |
| 4488 | p.EnterRule(localctx, 22, CELParserRULE_fieldInitializerList) |
| 4489 | var _alt int |
| 4490 | |
| 4491 | p.EnterOuterAlt(localctx, 1) |
| 4492 | { |
| 4493 | p.SetState(202) |
| 4494 | |
| 4495 | var _x = p.OptField() |
| 4496 | |
| 4497 | localctx.(*FieldInitializerListContext)._optField = _x |
| 4498 | } |
| 4499 | localctx.(*FieldInitializerListContext).fields = append(localctx.(*FieldInitializerListContext).fields, localctx.(*FieldInitializerListContext)._optField) |
| 4500 | { |
| 4501 | p.SetState(203) |
| 4502 | |
| 4503 | var _m = p.Match(CELParserCOLON) |
| 4504 | |
| 4505 | localctx.(*FieldInitializerListContext).s21 = _m |
| 4506 | if p.HasError() { |
| 4507 | // Recognition error - abort rule |
| 4508 | goto errorExit |
| 4509 | } |
| 4510 | } |
| 4511 | localctx.(*FieldInitializerListContext).cols = append(localctx.(*FieldInitializerListContext).cols, localctx.(*FieldInitializerListContext).s21) |
| 4512 | { |
| 4513 | p.SetState(204) |
| 4514 | |
| 4515 | var _x = p.Expr() |
| 4516 | |
| 4517 | localctx.(*FieldInitializerListContext)._expr = _x |
| 4518 | } |
| 4519 | localctx.(*FieldInitializerListContext).values = append(localctx.(*FieldInitializerListContext).values, localctx.(*FieldInitializerListContext)._expr) |
| 4520 | p.SetState(212) |
| 4521 | p.GetErrorHandler().Sync(p) |
| 4522 | if p.HasError() { |
| 4523 | goto errorExit |
| 4524 | } |
| 4525 | _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 28, p.GetParserRuleContext()) |
| 4526 | if p.HasError() { |
| 4527 | goto errorExit |
| 4528 | } |
| 4529 | for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { |
| 4530 | if _alt == 1 { |
| 4531 | { |
| 4532 | p.SetState(205) |
| 4533 | p.Match(CELParserCOMMA) |
| 4534 | if p.HasError() { |
| 4535 | // Recognition error - abort rule |
| 4536 | goto errorExit |
| 4537 | } |
| 4538 | } |
| 4539 | { |
| 4540 | p.SetState(206) |
| 4541 | |
| 4542 | var _x = p.OptField() |
| 4543 | |
| 4544 | localctx.(*FieldInitializerListContext)._optField = _x |
| 4545 | } |
| 4546 | localctx.(*FieldInitializerListContext).fields = append(localctx.(*FieldInitializerListContext).fields, localctx.(*FieldInitializerListContext)._optField) |
| 4547 | { |
| 4548 | p.SetState(207) |
| 4549 | |
| 4550 | var _m = p.Match(CELParserCOLON) |
| 4551 | |
| 4552 | localctx.(*FieldInitializerListContext).s21 = _m |
| 4553 | if p.HasError() { |
| 4554 | // Recognition error - abort rule |
| 4555 | goto errorExit |
| 4556 | } |
| 4557 | } |
| 4558 | localctx.(*FieldInitializerListContext).cols = append(localctx.(*FieldInitializerListContext).cols, localctx.(*FieldInitializerListContext).s21) |
| 4559 | { |
| 4560 | p.SetState(208) |
| 4561 | |
| 4562 | var _x = p.Expr() |
| 4563 | |
| 4564 | localctx.(*FieldInitializerListContext)._expr = _x |
| 4565 | } |
| 4566 | localctx.(*FieldInitializerListContext).values = append(localctx.(*FieldInitializerListContext).values, localctx.(*FieldInitializerListContext)._expr) |
| 4567 | |
| 4568 | } |
| 4569 | p.SetState(214) |
| 4570 | p.GetErrorHandler().Sync(p) |
| 4571 | if p.HasError() { |
| 4572 | goto errorExit |
| 4573 | } |
| 4574 | _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 28, p.GetParserRuleContext()) |
| 4575 | if p.HasError() { |
| 4576 | goto errorExit |
| 4577 | } |
| 4578 | } |
| 4579 | |
| 4580 | errorExit: |
| 4581 | if p.HasError() { |
| 4582 | v := p.GetError() |
| 4583 | localctx.SetException(v) |
| 4584 | p.GetErrorHandler().ReportError(p, v) |
| 4585 | p.GetErrorHandler().Recover(p, v) |
| 4586 | p.SetError(nil) |
| 4587 | } |
| 4588 | p.ExitRule() |
| 4589 | return localctx |
| 4590 | goto errorExit // Trick to prevent compiler error if the label is not used |
| 4591 | } |
| 4592 | |
| 4593 | // IOptFieldContext is an interface to support dynamic dispatch. |
| 4594 | type IOptFieldContext interface { |
| 4595 | antlr.ParserRuleContext |
| 4596 | |
| 4597 | // GetParser returns the parser. |
| 4598 | GetParser() antlr.Parser |
| 4599 | |
| 4600 | // GetOpt returns the opt token. |
| 4601 | GetOpt() antlr.Token |
| 4602 | |
| 4603 | // SetOpt sets the opt token. |
| 4604 | SetOpt(antlr.Token) |
| 4605 | |
| 4606 | // Getter signatures |
| 4607 | EscapeIdent() IEscapeIdentContext |
| 4608 | QUESTIONMARK() antlr.TerminalNode |
| 4609 | |
| 4610 | // IsOptFieldContext differentiates from other interfaces. |
| 4611 | IsOptFieldContext() |
| 4612 | } |
| 4613 | |
| 4614 | type OptFieldContext struct { |
| 4615 | antlr.BaseParserRuleContext |
| 4616 | parser antlr.Parser |
| 4617 | opt antlr.Token |
| 4618 | } |
| 4619 | |
| 4620 | func NewEmptyOptFieldContext() *OptFieldContext { |
| 4621 | var p = new(OptFieldContext) |
| 4622 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) |
| 4623 | p.RuleIndex = CELParserRULE_optField |
| 4624 | return p |
| 4625 | } |
| 4626 | |
| 4627 | func InitEmptyOptFieldContext(p *OptFieldContext) { |
| 4628 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) |
| 4629 | p.RuleIndex = CELParserRULE_optField |
| 4630 | } |
| 4631 | |
| 4632 | func (*OptFieldContext) IsOptFieldContext() {} |
| 4633 | |
| 4634 | func NewOptFieldContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *OptFieldContext { |
| 4635 | var p = new(OptFieldContext) |
| 4636 | |
| 4637 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) |
| 4638 | |
| 4639 | p.parser = parser |
| 4640 | p.RuleIndex = CELParserRULE_optField |
| 4641 | |
| 4642 | return p |
| 4643 | } |
| 4644 | |
| 4645 | func (s *OptFieldContext) GetParser() antlr.Parser { return s.parser } |
| 4646 | |
| 4647 | func (s *OptFieldContext) GetOpt() antlr.Token { return s.opt } |
| 4648 | |
| 4649 | func (s *OptFieldContext) SetOpt(v antlr.Token) { s.opt = v } |
| 4650 | |
| 4651 | func (s *OptFieldContext) EscapeIdent() IEscapeIdentContext { |
| 4652 | var t antlr.RuleContext |
| 4653 | for _, ctx := range s.GetChildren() { |
| 4654 | if _, ok := ctx.(IEscapeIdentContext); ok { |
| 4655 | t = ctx.(antlr.RuleContext) |
| 4656 | break |
| 4657 | } |
| 4658 | } |
| 4659 | |
| 4660 | if t == nil { |
| 4661 | return nil |
| 4662 | } |
| 4663 | |
| 4664 | return t.(IEscapeIdentContext) |
| 4665 | } |
| 4666 | |
| 4667 | func (s *OptFieldContext) QUESTIONMARK() antlr.TerminalNode { |
| 4668 | return s.GetToken(CELParserQUESTIONMARK, 0) |
| 4669 | } |
| 4670 | |
| 4671 | func (s *OptFieldContext) GetRuleContext() antlr.RuleContext { |
| 4672 | return s |
| 4673 | } |
| 4674 | |
| 4675 | func (s *OptFieldContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { |
| 4676 | return antlr.TreesStringTree(s, ruleNames, recog) |
| 4677 | } |
| 4678 | |
| 4679 | func (s *OptFieldContext) EnterRule(listener antlr.ParseTreeListener) { |
| 4680 | if listenerT, ok := listener.(CELListener); ok { |
| 4681 | listenerT.EnterOptField(s) |
| 4682 | } |
| 4683 | } |
| 4684 | |
| 4685 | func (s *OptFieldContext) ExitRule(listener antlr.ParseTreeListener) { |
| 4686 | if listenerT, ok := listener.(CELListener); ok { |
| 4687 | listenerT.ExitOptField(s) |
| 4688 | } |
| 4689 | } |
| 4690 | |
| 4691 | func (s *OptFieldContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { |
| 4692 | switch t := visitor.(type) { |
| 4693 | case CELVisitor: |
| 4694 | return t.VisitOptField(s) |
| 4695 | |
| 4696 | default: |
| 4697 | return t.VisitChildren(s) |
| 4698 | } |
| 4699 | } |
| 4700 | |
| 4701 | func (p *CELParser) OptField() (localctx IOptFieldContext) { |
| 4702 | localctx = NewOptFieldContext(p, p.GetParserRuleContext(), p.GetState()) |
| 4703 | p.EnterRule(localctx, 24, CELParserRULE_optField) |
| 4704 | var _la int |
| 4705 | |
| 4706 | p.EnterOuterAlt(localctx, 1) |
| 4707 | p.SetState(216) |
| 4708 | p.GetErrorHandler().Sync(p) |
| 4709 | if p.HasError() { |
| 4710 | goto errorExit |
| 4711 | } |
| 4712 | _la = p.GetTokenStream().LA(1) |
| 4713 | |
| 4714 | if _la == CELParserQUESTIONMARK { |
| 4715 | { |
| 4716 | p.SetState(215) |
| 4717 | |
| 4718 | var _m = p.Match(CELParserQUESTIONMARK) |
| 4719 | |
| 4720 | localctx.(*OptFieldContext).opt = _m |
| 4721 | if p.HasError() { |
| 4722 | // Recognition error - abort rule |
| 4723 | goto errorExit |
| 4724 | } |
| 4725 | } |
| 4726 | |
| 4727 | } |
| 4728 | { |
| 4729 | p.SetState(218) |
| 4730 | p.EscapeIdent() |
| 4731 | } |
| 4732 | |
| 4733 | errorExit: |
| 4734 | if p.HasError() { |
| 4735 | v := p.GetError() |
| 4736 | localctx.SetException(v) |
| 4737 | p.GetErrorHandler().ReportError(p, v) |
| 4738 | p.GetErrorHandler().Recover(p, v) |
| 4739 | p.SetError(nil) |
| 4740 | } |
| 4741 | p.ExitRule() |
| 4742 | return localctx |
| 4743 | goto errorExit // Trick to prevent compiler error if the label is not used |
| 4744 | } |
| 4745 | |
| 4746 | // IMapInitializerListContext is an interface to support dynamic dispatch. |
| 4747 | type IMapInitializerListContext interface { |
| 4748 | antlr.ParserRuleContext |
| 4749 | |
| 4750 | // GetParser returns the parser. |
| 4751 | GetParser() antlr.Parser |
| 4752 | |
| 4753 | // GetS21 returns the s21 token. |
| 4754 | GetS21() antlr.Token |
| 4755 | |
| 4756 | // SetS21 sets the s21 token. |
| 4757 | SetS21(antlr.Token) |
| 4758 | |
| 4759 | // GetCols returns the cols token list. |
| 4760 | GetCols() []antlr.Token |
| 4761 | |
| 4762 | // SetCols sets the cols token list. |
| 4763 | SetCols([]antlr.Token) |
| 4764 | |
| 4765 | // Get_optExpr returns the _optExpr rule contexts. |
| 4766 | Get_optExpr() IOptExprContext |
| 4767 | |
| 4768 | // Get_expr returns the _expr rule contexts. |
| 4769 | Get_expr() IExprContext |
| 4770 | |
| 4771 | // Set_optExpr sets the _optExpr rule contexts. |
| 4772 | Set_optExpr(IOptExprContext) |
| 4773 | |
| 4774 | // Set_expr sets the _expr rule contexts. |
| 4775 | Set_expr(IExprContext) |
| 4776 | |
| 4777 | // GetKeys returns the keys rule context list. |
| 4778 | GetKeys() []IOptExprContext |
| 4779 | |
| 4780 | // GetValues returns the values rule context list. |
| 4781 | GetValues() []IExprContext |
| 4782 | |
| 4783 | // SetKeys sets the keys rule context list. |
| 4784 | SetKeys([]IOptExprContext) |
| 4785 | |
| 4786 | // SetValues sets the values rule context list. |
| 4787 | SetValues([]IExprContext) |
| 4788 | |
| 4789 | // Getter signatures |
| 4790 | AllOptExpr() []IOptExprContext |
| 4791 | OptExpr(i int) IOptExprContext |
| 4792 | AllCOLON() []antlr.TerminalNode |
| 4793 | COLON(i int) antlr.TerminalNode |
| 4794 | AllExpr() []IExprContext |
| 4795 | Expr(i int) IExprContext |
| 4796 | AllCOMMA() []antlr.TerminalNode |
| 4797 | COMMA(i int) antlr.TerminalNode |
| 4798 | |
| 4799 | // IsMapInitializerListContext differentiates from other interfaces. |
| 4800 | IsMapInitializerListContext() |
| 4801 | } |
| 4802 | |
| 4803 | type MapInitializerListContext struct { |
| 4804 | antlr.BaseParserRuleContext |
| 4805 | parser antlr.Parser |
| 4806 | _optExpr IOptExprContext |
| 4807 | keys []IOptExprContext |
| 4808 | s21 antlr.Token |
| 4809 | cols []antlr.Token |
| 4810 | _expr IExprContext |
| 4811 | values []IExprContext |
| 4812 | } |
| 4813 | |
| 4814 | func NewEmptyMapInitializerListContext() *MapInitializerListContext { |
| 4815 | var p = new(MapInitializerListContext) |
| 4816 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) |
| 4817 | p.RuleIndex = CELParserRULE_mapInitializerList |
| 4818 | return p |
| 4819 | } |
| 4820 | |
| 4821 | func InitEmptyMapInitializerListContext(p *MapInitializerListContext) { |
| 4822 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) |
| 4823 | p.RuleIndex = CELParserRULE_mapInitializerList |
| 4824 | } |
| 4825 | |
| 4826 | func (*MapInitializerListContext) IsMapInitializerListContext() {} |
| 4827 | |
| 4828 | func NewMapInitializerListContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *MapInitializerListContext { |
| 4829 | var p = new(MapInitializerListContext) |
| 4830 | |
| 4831 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) |
| 4832 | |
| 4833 | p.parser = parser |
| 4834 | p.RuleIndex = CELParserRULE_mapInitializerList |
| 4835 | |
| 4836 | return p |
| 4837 | } |
| 4838 | |
| 4839 | func (s *MapInitializerListContext) GetParser() antlr.Parser { return s.parser } |
| 4840 | |
| 4841 | func (s *MapInitializerListContext) GetS21() antlr.Token { return s.s21 } |
| 4842 | |
| 4843 | func (s *MapInitializerListContext) SetS21(v antlr.Token) { s.s21 = v } |
| 4844 | |
| 4845 | func (s *MapInitializerListContext) GetCols() []antlr.Token { return s.cols } |
| 4846 | |
| 4847 | func (s *MapInitializerListContext) SetCols(v []antlr.Token) { s.cols = v } |
| 4848 | |
| 4849 | func (s *MapInitializerListContext) Get_optExpr() IOptExprContext { return s._optExpr } |
| 4850 | |
| 4851 | func (s *MapInitializerListContext) Get_expr() IExprContext { return s._expr } |
| 4852 | |
| 4853 | func (s *MapInitializerListContext) Set_optExpr(v IOptExprContext) { s._optExpr = v } |
| 4854 | |
| 4855 | func (s *MapInitializerListContext) Set_expr(v IExprContext) { s._expr = v } |
| 4856 | |
| 4857 | func (s *MapInitializerListContext) GetKeys() []IOptExprContext { return s.keys } |
| 4858 | |
| 4859 | func (s *MapInitializerListContext) GetValues() []IExprContext { return s.values } |
| 4860 | |
| 4861 | func (s *MapInitializerListContext) SetKeys(v []IOptExprContext) { s.keys = v } |
| 4862 | |
| 4863 | func (s *MapInitializerListContext) SetValues(v []IExprContext) { s.values = v } |
| 4864 | |
| 4865 | func (s *MapInitializerListContext) AllOptExpr() []IOptExprContext { |
| 4866 | children := s.GetChildren() |
| 4867 | len := 0 |
| 4868 | for _, ctx := range children { |
| 4869 | if _, ok := ctx.(IOptExprContext); ok { |
| 4870 | len++ |
| 4871 | } |
| 4872 | } |
| 4873 | |
| 4874 | tst := make([]IOptExprContext, len) |
| 4875 | i := 0 |
| 4876 | for _, ctx := range children { |
| 4877 | if t, ok := ctx.(IOptExprContext); ok { |
| 4878 | tst[i] = t.(IOptExprContext) |
| 4879 | i++ |
| 4880 | } |
| 4881 | } |
| 4882 | |
| 4883 | return tst |
| 4884 | } |
| 4885 | |
| 4886 | func (s *MapInitializerListContext) OptExpr(i int) IOptExprContext { |
| 4887 | var t antlr.RuleContext |
| 4888 | j := 0 |
| 4889 | for _, ctx := range s.GetChildren() { |
| 4890 | if _, ok := ctx.(IOptExprContext); ok { |
| 4891 | if j == i { |
| 4892 | t = ctx.(antlr.RuleContext) |
| 4893 | break |
| 4894 | } |
| 4895 | j++ |
| 4896 | } |
| 4897 | } |
| 4898 | |
| 4899 | if t == nil { |
| 4900 | return nil |
| 4901 | } |
| 4902 | |
| 4903 | return t.(IOptExprContext) |
| 4904 | } |
| 4905 | |
| 4906 | func (s *MapInitializerListContext) AllCOLON() []antlr.TerminalNode { |
| 4907 | return s.GetTokens(CELParserCOLON) |
| 4908 | } |
| 4909 | |
| 4910 | func (s *MapInitializerListContext) COLON(i int) antlr.TerminalNode { |
| 4911 | return s.GetToken(CELParserCOLON, i) |
| 4912 | } |
| 4913 | |
| 4914 | func (s *MapInitializerListContext) AllExpr() []IExprContext { |
| 4915 | children := s.GetChildren() |
| 4916 | len := 0 |
| 4917 | for _, ctx := range children { |
| 4918 | if _, ok := ctx.(IExprContext); ok { |
| 4919 | len++ |
| 4920 | } |
| 4921 | } |
| 4922 | |
| 4923 | tst := make([]IExprContext, len) |
| 4924 | i := 0 |
| 4925 | for _, ctx := range children { |
| 4926 | if t, ok := ctx.(IExprContext); ok { |
| 4927 | tst[i] = t.(IExprContext) |
| 4928 | i++ |
| 4929 | } |
| 4930 | } |
| 4931 | |
| 4932 | return tst |
| 4933 | } |
| 4934 | |
| 4935 | func (s *MapInitializerListContext) Expr(i int) IExprContext { |
| 4936 | var t antlr.RuleContext |
| 4937 | j := 0 |
| 4938 | for _, ctx := range s.GetChildren() { |
| 4939 | if _, ok := ctx.(IExprContext); ok { |
| 4940 | if j == i { |
| 4941 | t = ctx.(antlr.RuleContext) |
| 4942 | break |
| 4943 | } |
| 4944 | j++ |
| 4945 | } |
| 4946 | } |
| 4947 | |
| 4948 | if t == nil { |
| 4949 | return nil |
| 4950 | } |
| 4951 | |
| 4952 | return t.(IExprContext) |
| 4953 | } |
| 4954 | |
| 4955 | func (s *MapInitializerListContext) AllCOMMA() []antlr.TerminalNode { |
| 4956 | return s.GetTokens(CELParserCOMMA) |
| 4957 | } |
| 4958 | |
| 4959 | func (s *MapInitializerListContext) COMMA(i int) antlr.TerminalNode { |
| 4960 | return s.GetToken(CELParserCOMMA, i) |
| 4961 | } |
| 4962 | |
| 4963 | func (s *MapInitializerListContext) GetRuleContext() antlr.RuleContext { |
| 4964 | return s |
| 4965 | } |
| 4966 | |
| 4967 | func (s *MapInitializerListContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { |
| 4968 | return antlr.TreesStringTree(s, ruleNames, recog) |
| 4969 | } |
| 4970 | |
| 4971 | func (s *MapInitializerListContext) EnterRule(listener antlr.ParseTreeListener) { |
| 4972 | if listenerT, ok := listener.(CELListener); ok { |
| 4973 | listenerT.EnterMapInitializerList(s) |
| 4974 | } |
| 4975 | } |
| 4976 | |
| 4977 | func (s *MapInitializerListContext) ExitRule(listener antlr.ParseTreeListener) { |
| 4978 | if listenerT, ok := listener.(CELListener); ok { |
| 4979 | listenerT.ExitMapInitializerList(s) |
| 4980 | } |
| 4981 | } |
| 4982 | |
| 4983 | func (s *MapInitializerListContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { |
| 4984 | switch t := visitor.(type) { |
| 4985 | case CELVisitor: |
| 4986 | return t.VisitMapInitializerList(s) |
| 4987 | |
| 4988 | default: |
| 4989 | return t.VisitChildren(s) |
| 4990 | } |
| 4991 | } |
| 4992 | |
| 4993 | func (p *CELParser) MapInitializerList() (localctx IMapInitializerListContext) { |
| 4994 | localctx = NewMapInitializerListContext(p, p.GetParserRuleContext(), p.GetState()) |
| 4995 | p.EnterRule(localctx, 26, CELParserRULE_mapInitializerList) |
| 4996 | var _alt int |
| 4997 | |
| 4998 | p.EnterOuterAlt(localctx, 1) |
| 4999 | { |
| 5000 | p.SetState(220) |
| 5001 | |
| 5002 | var _x = p.OptExpr() |
| 5003 | |
| 5004 | localctx.(*MapInitializerListContext)._optExpr = _x |
| 5005 | } |
| 5006 | localctx.(*MapInitializerListContext).keys = append(localctx.(*MapInitializerListContext).keys, localctx.(*MapInitializerListContext)._optExpr) |
| 5007 | { |
| 5008 | p.SetState(221) |
| 5009 | |
| 5010 | var _m = p.Match(CELParserCOLON) |
| 5011 | |
| 5012 | localctx.(*MapInitializerListContext).s21 = _m |
| 5013 | if p.HasError() { |
| 5014 | // Recognition error - abort rule |
| 5015 | goto errorExit |
| 5016 | } |
| 5017 | } |
| 5018 | localctx.(*MapInitializerListContext).cols = append(localctx.(*MapInitializerListContext).cols, localctx.(*MapInitializerListContext).s21) |
| 5019 | { |
| 5020 | p.SetState(222) |
| 5021 | |
| 5022 | var _x = p.Expr() |
| 5023 | |
| 5024 | localctx.(*MapInitializerListContext)._expr = _x |
| 5025 | } |
| 5026 | localctx.(*MapInitializerListContext).values = append(localctx.(*MapInitializerListContext).values, localctx.(*MapInitializerListContext)._expr) |
| 5027 | p.SetState(230) |
| 5028 | p.GetErrorHandler().Sync(p) |
| 5029 | if p.HasError() { |
| 5030 | goto errorExit |
| 5031 | } |
| 5032 | _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 30, p.GetParserRuleContext()) |
| 5033 | if p.HasError() { |
| 5034 | goto errorExit |
| 5035 | } |
| 5036 | for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { |
| 5037 | if _alt == 1 { |
| 5038 | { |
| 5039 | p.SetState(223) |
| 5040 | p.Match(CELParserCOMMA) |
| 5041 | if p.HasError() { |
| 5042 | // Recognition error - abort rule |
| 5043 | goto errorExit |
| 5044 | } |
| 5045 | } |
| 5046 | { |
| 5047 | p.SetState(224) |
| 5048 | |
| 5049 | var _x = p.OptExpr() |
| 5050 | |
| 5051 | localctx.(*MapInitializerListContext)._optExpr = _x |
| 5052 | } |
| 5053 | localctx.(*MapInitializerListContext).keys = append(localctx.(*MapInitializerListContext).keys, localctx.(*MapInitializerListContext)._optExpr) |
| 5054 | { |
| 5055 | p.SetState(225) |
| 5056 | |
| 5057 | var _m = p.Match(CELParserCOLON) |
| 5058 | |
| 5059 | localctx.(*MapInitializerListContext).s21 = _m |
| 5060 | if p.HasError() { |
| 5061 | // Recognition error - abort rule |
| 5062 | goto errorExit |
| 5063 | } |
| 5064 | } |
| 5065 | localctx.(*MapInitializerListContext).cols = append(localctx.(*MapInitializerListContext).cols, localctx.(*MapInitializerListContext).s21) |
| 5066 | { |
| 5067 | p.SetState(226) |
| 5068 | |
| 5069 | var _x = p.Expr() |
| 5070 | |
| 5071 | localctx.(*MapInitializerListContext)._expr = _x |
| 5072 | } |
| 5073 | localctx.(*MapInitializerListContext).values = append(localctx.(*MapInitializerListContext).values, localctx.(*MapInitializerListContext)._expr) |
| 5074 | |
| 5075 | } |
| 5076 | p.SetState(232) |
| 5077 | p.GetErrorHandler().Sync(p) |
| 5078 | if p.HasError() { |
| 5079 | goto errorExit |
| 5080 | } |
| 5081 | _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 30, p.GetParserRuleContext()) |
| 5082 | if p.HasError() { |
| 5083 | goto errorExit |
| 5084 | } |
| 5085 | } |
| 5086 | |
| 5087 | errorExit: |
| 5088 | if p.HasError() { |
| 5089 | v := p.GetError() |
| 5090 | localctx.SetException(v) |
| 5091 | p.GetErrorHandler().ReportError(p, v) |
| 5092 | p.GetErrorHandler().Recover(p, v) |
| 5093 | p.SetError(nil) |
| 5094 | } |
| 5095 | p.ExitRule() |
| 5096 | return localctx |
| 5097 | goto errorExit // Trick to prevent compiler error if the label is not used |
| 5098 | } |
| 5099 | |
| 5100 | // IEscapeIdentContext is an interface to support dynamic dispatch. |
| 5101 | type IEscapeIdentContext interface { |
| 5102 | antlr.ParserRuleContext |
| 5103 | |
| 5104 | // GetParser returns the parser. |
| 5105 | GetParser() antlr.Parser |
| 5106 | // IsEscapeIdentContext differentiates from other interfaces. |
| 5107 | IsEscapeIdentContext() |
| 5108 | } |
| 5109 | |
| 5110 | type EscapeIdentContext struct { |
| 5111 | antlr.BaseParserRuleContext |
| 5112 | parser antlr.Parser |
| 5113 | } |
| 5114 | |
| 5115 | func NewEmptyEscapeIdentContext() *EscapeIdentContext { |
| 5116 | var p = new(EscapeIdentContext) |
| 5117 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) |
| 5118 | p.RuleIndex = CELParserRULE_escapeIdent |
| 5119 | return p |
| 5120 | } |
| 5121 | |
| 5122 | func InitEmptyEscapeIdentContext(p *EscapeIdentContext) { |
| 5123 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) |
| 5124 | p.RuleIndex = CELParserRULE_escapeIdent |
| 5125 | } |
| 5126 | |
| 5127 | func (*EscapeIdentContext) IsEscapeIdentContext() {} |
| 5128 | |
| 5129 | func NewEscapeIdentContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *EscapeIdentContext { |
| 5130 | var p = new(EscapeIdentContext) |
| 5131 | |
| 5132 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) |
| 5133 | |
| 5134 | p.parser = parser |
| 5135 | p.RuleIndex = CELParserRULE_escapeIdent |
| 5136 | |
| 5137 | return p |
| 5138 | } |
| 5139 | |
| 5140 | func (s *EscapeIdentContext) GetParser() antlr.Parser { return s.parser } |
| 5141 | |
| 5142 | func (s *EscapeIdentContext) CopyAll(ctx *EscapeIdentContext) { |
| 5143 | s.CopyFrom(&ctx.BaseParserRuleContext) |
| 5144 | } |
| 5145 | |
| 5146 | func (s *EscapeIdentContext) GetRuleContext() antlr.RuleContext { |
| 5147 | return s |
| 5148 | } |
| 5149 | |
| 5150 | func (s *EscapeIdentContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { |
| 5151 | return antlr.TreesStringTree(s, ruleNames, recog) |
| 5152 | } |
| 5153 | |
| 5154 | type EscapedIdentifierContext struct { |
| 5155 | EscapeIdentContext |
| 5156 | id antlr.Token |
| 5157 | } |
| 5158 | |
| 5159 | func NewEscapedIdentifierContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *EscapedIdentifierContext { |
| 5160 | var p = new(EscapedIdentifierContext) |
| 5161 | |
| 5162 | InitEmptyEscapeIdentContext(&p.EscapeIdentContext) |
| 5163 | p.parser = parser |
| 5164 | p.CopyAll(ctx.(*EscapeIdentContext)) |
| 5165 | |
| 5166 | return p |
| 5167 | } |
| 5168 | |
| 5169 | func (s *EscapedIdentifierContext) GetId() antlr.Token { return s.id } |
| 5170 | |
| 5171 | func (s *EscapedIdentifierContext) SetId(v antlr.Token) { s.id = v } |
| 5172 | |
| 5173 | func (s *EscapedIdentifierContext) GetRuleContext() antlr.RuleContext { |
| 5174 | return s |
| 5175 | } |
| 5176 | |
| 5177 | func (s *EscapedIdentifierContext) ESC_IDENTIFIER() antlr.TerminalNode { |
| 5178 | return s.GetToken(CELParserESC_IDENTIFIER, 0) |
| 5179 | } |
| 5180 | |
| 5181 | func (s *EscapedIdentifierContext) EnterRule(listener antlr.ParseTreeListener) { |
| 5182 | if listenerT, ok := listener.(CELListener); ok { |
| 5183 | listenerT.EnterEscapedIdentifier(s) |
| 5184 | } |
| 5185 | } |
| 5186 | |
| 5187 | func (s *EscapedIdentifierContext) ExitRule(listener antlr.ParseTreeListener) { |
| 5188 | if listenerT, ok := listener.(CELListener); ok { |
| 5189 | listenerT.ExitEscapedIdentifier(s) |
| 5190 | } |
| 5191 | } |
| 5192 | |
| 5193 | func (s *EscapedIdentifierContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { |
| 5194 | switch t := visitor.(type) { |
| 5195 | case CELVisitor: |
| 5196 | return t.VisitEscapedIdentifier(s) |
| 5197 | |
| 5198 | default: |
| 5199 | return t.VisitChildren(s) |
| 5200 | } |
| 5201 | } |
| 5202 | |
| 5203 | type SimpleIdentifierContext struct { |
| 5204 | EscapeIdentContext |
| 5205 | id antlr.Token |
| 5206 | } |
| 5207 | |
| 5208 | func NewSimpleIdentifierContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *SimpleIdentifierContext { |
| 5209 | var p = new(SimpleIdentifierContext) |
| 5210 | |
| 5211 | InitEmptyEscapeIdentContext(&p.EscapeIdentContext) |
| 5212 | p.parser = parser |
| 5213 | p.CopyAll(ctx.(*EscapeIdentContext)) |
| 5214 | |
| 5215 | return p |
| 5216 | } |
| 5217 | |
| 5218 | func (s *SimpleIdentifierContext) GetId() antlr.Token { return s.id } |
| 5219 | |
| 5220 | func (s *SimpleIdentifierContext) SetId(v antlr.Token) { s.id = v } |
| 5221 | |
| 5222 | func (s *SimpleIdentifierContext) GetRuleContext() antlr.RuleContext { |
| 5223 | return s |
| 5224 | } |
| 5225 | |
| 5226 | func (s *SimpleIdentifierContext) IDENTIFIER() antlr.TerminalNode { |
| 5227 | return s.GetToken(CELParserIDENTIFIER, 0) |
| 5228 | } |
| 5229 | |
| 5230 | func (s *SimpleIdentifierContext) EnterRule(listener antlr.ParseTreeListener) { |
| 5231 | if listenerT, ok := listener.(CELListener); ok { |
| 5232 | listenerT.EnterSimpleIdentifier(s) |
| 5233 | } |
| 5234 | } |
| 5235 | |
| 5236 | func (s *SimpleIdentifierContext) ExitRule(listener antlr.ParseTreeListener) { |
| 5237 | if listenerT, ok := listener.(CELListener); ok { |
| 5238 | listenerT.ExitSimpleIdentifier(s) |
| 5239 | } |
| 5240 | } |
| 5241 | |
| 5242 | func (s *SimpleIdentifierContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { |
| 5243 | switch t := visitor.(type) { |
| 5244 | case CELVisitor: |
| 5245 | return t.VisitSimpleIdentifier(s) |
| 5246 | |
| 5247 | default: |
| 5248 | return t.VisitChildren(s) |
| 5249 | } |
| 5250 | } |
| 5251 | |
| 5252 | func (p *CELParser) EscapeIdent() (localctx IEscapeIdentContext) { |
| 5253 | localctx = NewEscapeIdentContext(p, p.GetParserRuleContext(), p.GetState()) |
| 5254 | p.EnterRule(localctx, 28, CELParserRULE_escapeIdent) |
| 5255 | p.SetState(235) |
| 5256 | p.GetErrorHandler().Sync(p) |
| 5257 | if p.HasError() { |
| 5258 | goto errorExit |
| 5259 | } |
| 5260 | |
| 5261 | switch p.GetTokenStream().LA(1) { |
| 5262 | case CELParserIDENTIFIER: |
| 5263 | localctx = NewSimpleIdentifierContext(p, localctx) |
| 5264 | p.EnterOuterAlt(localctx, 1) |
| 5265 | { |
| 5266 | p.SetState(233) |
| 5267 | |
| 5268 | var _m = p.Match(CELParserIDENTIFIER) |
| 5269 | |
| 5270 | localctx.(*SimpleIdentifierContext).id = _m |
| 5271 | if p.HasError() { |
| 5272 | // Recognition error - abort rule |
| 5273 | goto errorExit |
| 5274 | } |
| 5275 | } |
| 5276 | |
| 5277 | case CELParserESC_IDENTIFIER: |
| 5278 | localctx = NewEscapedIdentifierContext(p, localctx) |
| 5279 | p.EnterOuterAlt(localctx, 2) |
| 5280 | { |
| 5281 | p.SetState(234) |
| 5282 | |
| 5283 | var _m = p.Match(CELParserESC_IDENTIFIER) |
| 5284 | |
| 5285 | localctx.(*EscapedIdentifierContext).id = _m |
| 5286 | if p.HasError() { |
| 5287 | // Recognition error - abort rule |
| 5288 | goto errorExit |
| 5289 | } |
| 5290 | } |
| 5291 | |
| 5292 | default: |
| 5293 | p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) |
| 5294 | goto errorExit |
| 5295 | } |
| 5296 | |
| 5297 | errorExit: |
| 5298 | if p.HasError() { |
| 5299 | v := p.GetError() |
| 5300 | localctx.SetException(v) |
| 5301 | p.GetErrorHandler().ReportError(p, v) |
| 5302 | p.GetErrorHandler().Recover(p, v) |
| 5303 | p.SetError(nil) |
| 5304 | } |
| 5305 | p.ExitRule() |
| 5306 | return localctx |
| 5307 | goto errorExit // Trick to prevent compiler error if the label is not used |
| 5308 | } |
| 5309 | |
| 5310 | // IOptExprContext is an interface to support dynamic dispatch. |
| 5311 | type IOptExprContext interface { |
| 5312 | antlr.ParserRuleContext |
| 5313 | |
| 5314 | // GetParser returns the parser. |
| 5315 | GetParser() antlr.Parser |
| 5316 | |
| 5317 | // GetOpt returns the opt token. |
| 5318 | GetOpt() antlr.Token |
| 5319 | |
| 5320 | // SetOpt sets the opt token. |
| 5321 | SetOpt(antlr.Token) |
| 5322 | |
| 5323 | // GetE returns the e rule contexts. |
| 5324 | GetE() IExprContext |
| 5325 | |
| 5326 | // SetE sets the e rule contexts. |
| 5327 | SetE(IExprContext) |
| 5328 | |
| 5329 | // Getter signatures |
| 5330 | Expr() IExprContext |
| 5331 | QUESTIONMARK() antlr.TerminalNode |
| 5332 | |
| 5333 | // IsOptExprContext differentiates from other interfaces. |
| 5334 | IsOptExprContext() |
| 5335 | } |
| 5336 | |
| 5337 | type OptExprContext struct { |
| 5338 | antlr.BaseParserRuleContext |
| 5339 | parser antlr.Parser |
| 5340 | opt antlr.Token |
| 5341 | e IExprContext |
| 5342 | } |
| 5343 | |
| 5344 | func NewEmptyOptExprContext() *OptExprContext { |
| 5345 | var p = new(OptExprContext) |
| 5346 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) |
| 5347 | p.RuleIndex = CELParserRULE_optExpr |
| 5348 | return p |
| 5349 | } |
| 5350 | |
| 5351 | func InitEmptyOptExprContext(p *OptExprContext) { |
| 5352 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) |
| 5353 | p.RuleIndex = CELParserRULE_optExpr |
| 5354 | } |
| 5355 | |
| 5356 | func (*OptExprContext) IsOptExprContext() {} |
| 5357 | |
| 5358 | func NewOptExprContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *OptExprContext { |
| 5359 | var p = new(OptExprContext) |
| 5360 | |
| 5361 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) |
| 5362 | |
| 5363 | p.parser = parser |
| 5364 | p.RuleIndex = CELParserRULE_optExpr |
| 5365 | |
| 5366 | return p |
| 5367 | } |
| 5368 | |
| 5369 | func (s *OptExprContext) GetParser() antlr.Parser { return s.parser } |
| 5370 | |
| 5371 | func (s *OptExprContext) GetOpt() antlr.Token { return s.opt } |
| 5372 | |
| 5373 | func (s *OptExprContext) SetOpt(v antlr.Token) { s.opt = v } |
| 5374 | |
| 5375 | func (s *OptExprContext) GetE() IExprContext { return s.e } |
| 5376 | |
| 5377 | func (s *OptExprContext) SetE(v IExprContext) { s.e = v } |
| 5378 | |
| 5379 | func (s *OptExprContext) Expr() IExprContext { |
| 5380 | var t antlr.RuleContext |
| 5381 | for _, ctx := range s.GetChildren() { |
| 5382 | if _, ok := ctx.(IExprContext); ok { |
| 5383 | t = ctx.(antlr.RuleContext) |
| 5384 | break |
| 5385 | } |
| 5386 | } |
| 5387 | |
| 5388 | if t == nil { |
| 5389 | return nil |
| 5390 | } |
| 5391 | |
| 5392 | return t.(IExprContext) |
| 5393 | } |
| 5394 | |
| 5395 | func (s *OptExprContext) QUESTIONMARK() antlr.TerminalNode { |
| 5396 | return s.GetToken(CELParserQUESTIONMARK, 0) |
| 5397 | } |
| 5398 | |
| 5399 | func (s *OptExprContext) GetRuleContext() antlr.RuleContext { |
| 5400 | return s |
| 5401 | } |
| 5402 | |
| 5403 | func (s *OptExprContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { |
| 5404 | return antlr.TreesStringTree(s, ruleNames, recog) |
| 5405 | } |
| 5406 | |
| 5407 | func (s *OptExprContext) EnterRule(listener antlr.ParseTreeListener) { |
| 5408 | if listenerT, ok := listener.(CELListener); ok { |
| 5409 | listenerT.EnterOptExpr(s) |
| 5410 | } |
| 5411 | } |
| 5412 | |
| 5413 | func (s *OptExprContext) ExitRule(listener antlr.ParseTreeListener) { |
| 5414 | if listenerT, ok := listener.(CELListener); ok { |
| 5415 | listenerT.ExitOptExpr(s) |
| 5416 | } |
| 5417 | } |
| 5418 | |
| 5419 | func (s *OptExprContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { |
| 5420 | switch t := visitor.(type) { |
| 5421 | case CELVisitor: |
| 5422 | return t.VisitOptExpr(s) |
| 5423 | |
| 5424 | default: |
| 5425 | return t.VisitChildren(s) |
| 5426 | } |
| 5427 | } |
| 5428 | |
| 5429 | func (p *CELParser) OptExpr() (localctx IOptExprContext) { |
| 5430 | localctx = NewOptExprContext(p, p.GetParserRuleContext(), p.GetState()) |
| 5431 | p.EnterRule(localctx, 30, CELParserRULE_optExpr) |
| 5432 | var _la int |
| 5433 | |
| 5434 | p.EnterOuterAlt(localctx, 1) |
| 5435 | p.SetState(238) |
| 5436 | p.GetErrorHandler().Sync(p) |
| 5437 | if p.HasError() { |
| 5438 | goto errorExit |
| 5439 | } |
| 5440 | _la = p.GetTokenStream().LA(1) |
| 5441 | |
| 5442 | if _la == CELParserQUESTIONMARK { |
| 5443 | { |
| 5444 | p.SetState(237) |
| 5445 | |
| 5446 | var _m = p.Match(CELParserQUESTIONMARK) |
| 5447 | |
| 5448 | localctx.(*OptExprContext).opt = _m |
| 5449 | if p.HasError() { |
| 5450 | // Recognition error - abort rule |
| 5451 | goto errorExit |
| 5452 | } |
| 5453 | } |
| 5454 | |
| 5455 | } |
| 5456 | { |
| 5457 | p.SetState(240) |
| 5458 | |
| 5459 | var _x = p.Expr() |
| 5460 | |
| 5461 | localctx.(*OptExprContext).e = _x |
| 5462 | } |
| 5463 | |
| 5464 | errorExit: |
| 5465 | if p.HasError() { |
| 5466 | v := p.GetError() |
| 5467 | localctx.SetException(v) |
| 5468 | p.GetErrorHandler().ReportError(p, v) |
| 5469 | p.GetErrorHandler().Recover(p, v) |
| 5470 | p.SetError(nil) |
| 5471 | } |
| 5472 | p.ExitRule() |
| 5473 | return localctx |
| 5474 | goto errorExit // Trick to prevent compiler error if the label is not used |
| 5475 | } |
| 5476 | |
| 5477 | // ILiteralContext is an interface to support dynamic dispatch. |
| 5478 | type ILiteralContext interface { |
| 5479 | antlr.ParserRuleContext |
| 5480 | |
| 5481 | // GetParser returns the parser. |
| 5482 | GetParser() antlr.Parser |
| 5483 | // IsLiteralContext differentiates from other interfaces. |
| 5484 | IsLiteralContext() |
| 5485 | } |
| 5486 | |
| 5487 | type LiteralContext struct { |
| 5488 | antlr.BaseParserRuleContext |
| 5489 | parser antlr.Parser |
| 5490 | } |
| 5491 | |
| 5492 | func NewEmptyLiteralContext() *LiteralContext { |
| 5493 | var p = new(LiteralContext) |
| 5494 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) |
| 5495 | p.RuleIndex = CELParserRULE_literal |
| 5496 | return p |
| 5497 | } |
| 5498 | |
| 5499 | func InitEmptyLiteralContext(p *LiteralContext) { |
| 5500 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) |
| 5501 | p.RuleIndex = CELParserRULE_literal |
| 5502 | } |
| 5503 | |
| 5504 | func (*LiteralContext) IsLiteralContext() {} |
| 5505 | |
| 5506 | func NewLiteralContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *LiteralContext { |
| 5507 | var p = new(LiteralContext) |
| 5508 | |
| 5509 | antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) |
| 5510 | |
| 5511 | p.parser = parser |
| 5512 | p.RuleIndex = CELParserRULE_literal |
| 5513 | |
| 5514 | return p |
| 5515 | } |
| 5516 | |
| 5517 | func (s *LiteralContext) GetParser() antlr.Parser { return s.parser } |
| 5518 | |
| 5519 | func (s *LiteralContext) CopyAll(ctx *LiteralContext) { |
| 5520 | s.CopyFrom(&ctx.BaseParserRuleContext) |
| 5521 | } |
| 5522 | |
| 5523 | func (s *LiteralContext) GetRuleContext() antlr.RuleContext { |
| 5524 | return s |
| 5525 | } |
| 5526 | |
| 5527 | func (s *LiteralContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { |
| 5528 | return antlr.TreesStringTree(s, ruleNames, recog) |
| 5529 | } |
| 5530 | |
| 5531 | type BytesContext struct { |
| 5532 | LiteralContext |
| 5533 | tok antlr.Token |
| 5534 | } |
| 5535 | |
| 5536 | func NewBytesContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *BytesContext { |
| 5537 | var p = new(BytesContext) |
| 5538 | |
| 5539 | InitEmptyLiteralContext(&p.LiteralContext) |
| 5540 | p.parser = parser |
| 5541 | p.CopyAll(ctx.(*LiteralContext)) |
| 5542 | |
| 5543 | return p |
| 5544 | } |
| 5545 | |
| 5546 | func (s *BytesContext) GetTok() antlr.Token { return s.tok } |
| 5547 | |
| 5548 | func (s *BytesContext) SetTok(v antlr.Token) { s.tok = v } |
| 5549 | |
| 5550 | func (s *BytesContext) GetRuleContext() antlr.RuleContext { |
| 5551 | return s |
| 5552 | } |
| 5553 | |
| 5554 | func (s *BytesContext) BYTES() antlr.TerminalNode { |
| 5555 | return s.GetToken(CELParserBYTES, 0) |
| 5556 | } |
| 5557 | |
| 5558 | func (s *BytesContext) EnterRule(listener antlr.ParseTreeListener) { |
| 5559 | if listenerT, ok := listener.(CELListener); ok { |
| 5560 | listenerT.EnterBytes(s) |
| 5561 | } |
| 5562 | } |
| 5563 | |
| 5564 | func (s *BytesContext) ExitRule(listener antlr.ParseTreeListener) { |
| 5565 | if listenerT, ok := listener.(CELListener); ok { |
| 5566 | listenerT.ExitBytes(s) |
| 5567 | } |
| 5568 | } |
| 5569 | |
| 5570 | func (s *BytesContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { |
| 5571 | switch t := visitor.(type) { |
| 5572 | case CELVisitor: |
| 5573 | return t.VisitBytes(s) |
| 5574 | |
| 5575 | default: |
| 5576 | return t.VisitChildren(s) |
| 5577 | } |
| 5578 | } |
| 5579 | |
| 5580 | type UintContext struct { |
| 5581 | LiteralContext |
| 5582 | tok antlr.Token |
| 5583 | } |
| 5584 | |
| 5585 | func NewUintContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *UintContext { |
| 5586 | var p = new(UintContext) |
| 5587 | |
| 5588 | InitEmptyLiteralContext(&p.LiteralContext) |
| 5589 | p.parser = parser |
| 5590 | p.CopyAll(ctx.(*LiteralContext)) |
| 5591 | |
| 5592 | return p |
| 5593 | } |
| 5594 | |
| 5595 | func (s *UintContext) GetTok() antlr.Token { return s.tok } |
| 5596 | |
| 5597 | func (s *UintContext) SetTok(v antlr.Token) { s.tok = v } |
| 5598 | |
| 5599 | func (s *UintContext) GetRuleContext() antlr.RuleContext { |
| 5600 | return s |
| 5601 | } |
| 5602 | |
| 5603 | func (s *UintContext) NUM_UINT() antlr.TerminalNode { |
| 5604 | return s.GetToken(CELParserNUM_UINT, 0) |
| 5605 | } |
| 5606 | |
| 5607 | func (s *UintContext) EnterRule(listener antlr.ParseTreeListener) { |
| 5608 | if listenerT, ok := listener.(CELListener); ok { |
| 5609 | listenerT.EnterUint(s) |
| 5610 | } |
| 5611 | } |
| 5612 | |
| 5613 | func (s *UintContext) ExitRule(listener antlr.ParseTreeListener) { |
| 5614 | if listenerT, ok := listener.(CELListener); ok { |
| 5615 | listenerT.ExitUint(s) |
| 5616 | } |
| 5617 | } |
| 5618 | |
| 5619 | func (s *UintContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { |
| 5620 | switch t := visitor.(type) { |
| 5621 | case CELVisitor: |
| 5622 | return t.VisitUint(s) |
| 5623 | |
| 5624 | default: |
| 5625 | return t.VisitChildren(s) |
| 5626 | } |
| 5627 | } |
| 5628 | |
| 5629 | type NullContext struct { |
| 5630 | LiteralContext |
| 5631 | tok antlr.Token |
| 5632 | } |
| 5633 | |
| 5634 | func NewNullContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *NullContext { |
| 5635 | var p = new(NullContext) |
| 5636 | |
| 5637 | InitEmptyLiteralContext(&p.LiteralContext) |
| 5638 | p.parser = parser |
| 5639 | p.CopyAll(ctx.(*LiteralContext)) |
| 5640 | |
| 5641 | return p |
| 5642 | } |
| 5643 | |
| 5644 | func (s *NullContext) GetTok() antlr.Token { return s.tok } |
| 5645 | |
| 5646 | func (s *NullContext) SetTok(v antlr.Token) { s.tok = v } |
| 5647 | |
| 5648 | func (s *NullContext) GetRuleContext() antlr.RuleContext { |
| 5649 | return s |
| 5650 | } |
| 5651 | |
| 5652 | func (s *NullContext) NUL() antlr.TerminalNode { |
| 5653 | return s.GetToken(CELParserNUL, 0) |
| 5654 | } |
| 5655 | |
| 5656 | func (s *NullContext) EnterRule(listener antlr.ParseTreeListener) { |
| 5657 | if listenerT, ok := listener.(CELListener); ok { |
| 5658 | listenerT.EnterNull(s) |
| 5659 | } |
| 5660 | } |
| 5661 | |
| 5662 | func (s *NullContext) ExitRule(listener antlr.ParseTreeListener) { |
| 5663 | if listenerT, ok := listener.(CELListener); ok { |
| 5664 | listenerT.ExitNull(s) |
| 5665 | } |
| 5666 | } |
| 5667 | |
| 5668 | func (s *NullContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { |
| 5669 | switch t := visitor.(type) { |
| 5670 | case CELVisitor: |
| 5671 | return t.VisitNull(s) |
| 5672 | |
| 5673 | default: |
| 5674 | return t.VisitChildren(s) |
| 5675 | } |
| 5676 | } |
| 5677 | |
| 5678 | type BoolFalseContext struct { |
| 5679 | LiteralContext |
| 5680 | tok antlr.Token |
| 5681 | } |
| 5682 | |
| 5683 | func NewBoolFalseContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *BoolFalseContext { |
| 5684 | var p = new(BoolFalseContext) |
| 5685 | |
| 5686 | InitEmptyLiteralContext(&p.LiteralContext) |
| 5687 | p.parser = parser |
| 5688 | p.CopyAll(ctx.(*LiteralContext)) |
| 5689 | |
| 5690 | return p |
| 5691 | } |
| 5692 | |
| 5693 | func (s *BoolFalseContext) GetTok() antlr.Token { return s.tok } |
| 5694 | |
| 5695 | func (s *BoolFalseContext) SetTok(v antlr.Token) { s.tok = v } |
| 5696 | |
| 5697 | func (s *BoolFalseContext) GetRuleContext() antlr.RuleContext { |
| 5698 | return s |
| 5699 | } |
| 5700 | |
| 5701 | func (s *BoolFalseContext) CEL_FALSE() antlr.TerminalNode { |
| 5702 | return s.GetToken(CELParserCEL_FALSE, 0) |
| 5703 | } |
| 5704 | |
| 5705 | func (s *BoolFalseContext) EnterRule(listener antlr.ParseTreeListener) { |
| 5706 | if listenerT, ok := listener.(CELListener); ok { |
| 5707 | listenerT.EnterBoolFalse(s) |
| 5708 | } |
| 5709 | } |
| 5710 | |
| 5711 | func (s *BoolFalseContext) ExitRule(listener antlr.ParseTreeListener) { |
| 5712 | if listenerT, ok := listener.(CELListener); ok { |
| 5713 | listenerT.ExitBoolFalse(s) |
| 5714 | } |
| 5715 | } |
| 5716 | |
| 5717 | func (s *BoolFalseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { |
| 5718 | switch t := visitor.(type) { |
| 5719 | case CELVisitor: |
| 5720 | return t.VisitBoolFalse(s) |
| 5721 | |
| 5722 | default: |
| 5723 | return t.VisitChildren(s) |
| 5724 | } |
| 5725 | } |
| 5726 | |
| 5727 | type StringContext struct { |
| 5728 | LiteralContext |
| 5729 | tok antlr.Token |
| 5730 | } |
| 5731 | |
| 5732 | func NewStringContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *StringContext { |
| 5733 | var p = new(StringContext) |
| 5734 | |
| 5735 | InitEmptyLiteralContext(&p.LiteralContext) |
| 5736 | p.parser = parser |
| 5737 | p.CopyAll(ctx.(*LiteralContext)) |
| 5738 | |
| 5739 | return p |
| 5740 | } |
| 5741 | |
| 5742 | func (s *StringContext) GetTok() antlr.Token { return s.tok } |
| 5743 | |
| 5744 | func (s *StringContext) SetTok(v antlr.Token) { s.tok = v } |
| 5745 | |
| 5746 | func (s *StringContext) GetRuleContext() antlr.RuleContext { |
| 5747 | return s |
| 5748 | } |
| 5749 | |
| 5750 | func (s *StringContext) STRING() antlr.TerminalNode { |
| 5751 | return s.GetToken(CELParserSTRING, 0) |
| 5752 | } |
| 5753 | |
| 5754 | func (s *StringContext) EnterRule(listener antlr.ParseTreeListener) { |
| 5755 | if listenerT, ok := listener.(CELListener); ok { |
| 5756 | listenerT.EnterString(s) |
| 5757 | } |
| 5758 | } |
| 5759 | |
| 5760 | func (s *StringContext) ExitRule(listener antlr.ParseTreeListener) { |
| 5761 | if listenerT, ok := listener.(CELListener); ok { |
| 5762 | listenerT.ExitString(s) |
| 5763 | } |
| 5764 | } |
| 5765 | |
| 5766 | func (s *StringContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { |
| 5767 | switch t := visitor.(type) { |
| 5768 | case CELVisitor: |
| 5769 | return t.VisitString(s) |
| 5770 | |
| 5771 | default: |
| 5772 | return t.VisitChildren(s) |
| 5773 | } |
| 5774 | } |
| 5775 | |
| 5776 | type DoubleContext struct { |
| 5777 | LiteralContext |
| 5778 | sign antlr.Token |
| 5779 | tok antlr.Token |
| 5780 | } |
| 5781 | |
| 5782 | func NewDoubleContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *DoubleContext { |
| 5783 | var p = new(DoubleContext) |
| 5784 | |
| 5785 | InitEmptyLiteralContext(&p.LiteralContext) |
| 5786 | p.parser = parser |
| 5787 | p.CopyAll(ctx.(*LiteralContext)) |
| 5788 | |
| 5789 | return p |
| 5790 | } |
| 5791 | |
| 5792 | func (s *DoubleContext) GetSign() antlr.Token { return s.sign } |
| 5793 | |
| 5794 | func (s *DoubleContext) GetTok() antlr.Token { return s.tok } |
| 5795 | |
| 5796 | func (s *DoubleContext) SetSign(v antlr.Token) { s.sign = v } |
| 5797 | |
| 5798 | func (s *DoubleContext) SetTok(v antlr.Token) { s.tok = v } |
| 5799 | |
| 5800 | func (s *DoubleContext) GetRuleContext() antlr.RuleContext { |
| 5801 | return s |
| 5802 | } |
| 5803 | |
| 5804 | func (s *DoubleContext) NUM_FLOAT() antlr.TerminalNode { |
| 5805 | return s.GetToken(CELParserNUM_FLOAT, 0) |
| 5806 | } |
| 5807 | |
| 5808 | func (s *DoubleContext) MINUS() antlr.TerminalNode { |
| 5809 | return s.GetToken(CELParserMINUS, 0) |
| 5810 | } |
| 5811 | |
| 5812 | func (s *DoubleContext) EnterRule(listener antlr.ParseTreeListener) { |
| 5813 | if listenerT, ok := listener.(CELListener); ok { |
| 5814 | listenerT.EnterDouble(s) |
| 5815 | } |
| 5816 | } |
| 5817 | |
| 5818 | func (s *DoubleContext) ExitRule(listener antlr.ParseTreeListener) { |
| 5819 | if listenerT, ok := listener.(CELListener); ok { |
| 5820 | listenerT.ExitDouble(s) |
| 5821 | } |
| 5822 | } |
| 5823 | |
| 5824 | func (s *DoubleContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { |
| 5825 | switch t := visitor.(type) { |
| 5826 | case CELVisitor: |
| 5827 | return t.VisitDouble(s) |
| 5828 | |
| 5829 | default: |
| 5830 | return t.VisitChildren(s) |
| 5831 | } |
| 5832 | } |
| 5833 | |
| 5834 | type BoolTrueContext struct { |
| 5835 | LiteralContext |
| 5836 | tok antlr.Token |
| 5837 | } |
| 5838 | |
| 5839 | func NewBoolTrueContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *BoolTrueContext { |
| 5840 | var p = new(BoolTrueContext) |
| 5841 | |
| 5842 | InitEmptyLiteralContext(&p.LiteralContext) |
| 5843 | p.parser = parser |
| 5844 | p.CopyAll(ctx.(*LiteralContext)) |
| 5845 | |
| 5846 | return p |
| 5847 | } |
| 5848 | |
| 5849 | func (s *BoolTrueContext) GetTok() antlr.Token { return s.tok } |
| 5850 | |
| 5851 | func (s *BoolTrueContext) SetTok(v antlr.Token) { s.tok = v } |
| 5852 | |
| 5853 | func (s *BoolTrueContext) GetRuleContext() antlr.RuleContext { |
| 5854 | return s |
| 5855 | } |
| 5856 | |
| 5857 | func (s *BoolTrueContext) CEL_TRUE() antlr.TerminalNode { |
| 5858 | return s.GetToken(CELParserCEL_TRUE, 0) |
| 5859 | } |
| 5860 | |
| 5861 | func (s *BoolTrueContext) EnterRule(listener antlr.ParseTreeListener) { |
| 5862 | if listenerT, ok := listener.(CELListener); ok { |
| 5863 | listenerT.EnterBoolTrue(s) |
| 5864 | } |
| 5865 | } |
| 5866 | |
| 5867 | func (s *BoolTrueContext) ExitRule(listener antlr.ParseTreeListener) { |
| 5868 | if listenerT, ok := listener.(CELListener); ok { |
| 5869 | listenerT.ExitBoolTrue(s) |
| 5870 | } |
| 5871 | } |
| 5872 | |
| 5873 | func (s *BoolTrueContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { |
| 5874 | switch t := visitor.(type) { |
| 5875 | case CELVisitor: |
| 5876 | return t.VisitBoolTrue(s) |
| 5877 | |
| 5878 | default: |
| 5879 | return t.VisitChildren(s) |
| 5880 | } |
| 5881 | } |
| 5882 | |
| 5883 | type IntContext struct { |
| 5884 | LiteralContext |
| 5885 | sign antlr.Token |
| 5886 | tok antlr.Token |
| 5887 | } |
| 5888 | |
| 5889 | func NewIntContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *IntContext { |
| 5890 | var p = new(IntContext) |
| 5891 | |
| 5892 | InitEmptyLiteralContext(&p.LiteralContext) |
| 5893 | p.parser = parser |
| 5894 | p.CopyAll(ctx.(*LiteralContext)) |
| 5895 | |
| 5896 | return p |
| 5897 | } |
| 5898 | |
| 5899 | func (s *IntContext) GetSign() antlr.Token { return s.sign } |
| 5900 | |
| 5901 | func (s *IntContext) GetTok() antlr.Token { return s.tok } |
| 5902 | |
| 5903 | func (s *IntContext) SetSign(v antlr.Token) { s.sign = v } |
| 5904 | |
| 5905 | func (s *IntContext) SetTok(v antlr.Token) { s.tok = v } |
| 5906 | |
| 5907 | func (s *IntContext) GetRuleContext() antlr.RuleContext { |
| 5908 | return s |
| 5909 | } |
| 5910 | |
| 5911 | func (s *IntContext) NUM_INT() antlr.TerminalNode { |
| 5912 | return s.GetToken(CELParserNUM_INT, 0) |
| 5913 | } |
| 5914 | |
| 5915 | func (s *IntContext) MINUS() antlr.TerminalNode { |
| 5916 | return s.GetToken(CELParserMINUS, 0) |
| 5917 | } |
| 5918 | |
| 5919 | func (s *IntContext) EnterRule(listener antlr.ParseTreeListener) { |
| 5920 | if listenerT, ok := listener.(CELListener); ok { |
| 5921 | listenerT.EnterInt(s) |
| 5922 | } |
| 5923 | } |
| 5924 | |
| 5925 | func (s *IntContext) ExitRule(listener antlr.ParseTreeListener) { |
| 5926 | if listenerT, ok := listener.(CELListener); ok { |
| 5927 | listenerT.ExitInt(s) |
| 5928 | } |
| 5929 | } |
| 5930 | |
| 5931 | func (s *IntContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { |
| 5932 | switch t := visitor.(type) { |
| 5933 | case CELVisitor: |
| 5934 | return t.VisitInt(s) |
| 5935 | |
| 5936 | default: |
| 5937 | return t.VisitChildren(s) |
| 5938 | } |
| 5939 | } |
| 5940 | |
| 5941 | func (p *CELParser) Literal() (localctx ILiteralContext) { |
| 5942 | localctx = NewLiteralContext(p, p.GetParserRuleContext(), p.GetState()) |
| 5943 | p.EnterRule(localctx, 32, CELParserRULE_literal) |
| 5944 | var _la int |
| 5945 | |
| 5946 | p.SetState(256) |
| 5947 | p.GetErrorHandler().Sync(p) |
| 5948 | if p.HasError() { |
| 5949 | goto errorExit |
| 5950 | } |
| 5951 | |
| 5952 | switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 35, p.GetParserRuleContext()) { |
| 5953 | case 1: |
| 5954 | localctx = NewIntContext(p, localctx) |
| 5955 | p.EnterOuterAlt(localctx, 1) |
| 5956 | p.SetState(243) |
| 5957 | p.GetErrorHandler().Sync(p) |
| 5958 | if p.HasError() { |
| 5959 | goto errorExit |
| 5960 | } |
| 5961 | _la = p.GetTokenStream().LA(1) |
| 5962 | |
| 5963 | if _la == CELParserMINUS { |
| 5964 | { |
| 5965 | p.SetState(242) |
| 5966 | |
| 5967 | var _m = p.Match(CELParserMINUS) |
| 5968 | |
| 5969 | localctx.(*IntContext).sign = _m |
| 5970 | if p.HasError() { |
| 5971 | // Recognition error - abort rule |
| 5972 | goto errorExit |
| 5973 | } |
| 5974 | } |
| 5975 | |
| 5976 | } |
| 5977 | { |
| 5978 | p.SetState(245) |
| 5979 | |
| 5980 | var _m = p.Match(CELParserNUM_INT) |
| 5981 | |
| 5982 | localctx.(*IntContext).tok = _m |
| 5983 | if p.HasError() { |
| 5984 | // Recognition error - abort rule |
| 5985 | goto errorExit |
| 5986 | } |
| 5987 | } |
| 5988 | |
| 5989 | case 2: |
| 5990 | localctx = NewUintContext(p, localctx) |
| 5991 | p.EnterOuterAlt(localctx, 2) |
| 5992 | { |
| 5993 | p.SetState(246) |
| 5994 | |
| 5995 | var _m = p.Match(CELParserNUM_UINT) |
| 5996 | |
| 5997 | localctx.(*UintContext).tok = _m |
| 5998 | if p.HasError() { |
| 5999 | // Recognition error - abort rule |
| 6000 | goto errorExit |
| 6001 | } |
| 6002 | } |
| 6003 | |
| 6004 | case 3: |
| 6005 | localctx = NewDoubleContext(p, localctx) |
| 6006 | p.EnterOuterAlt(localctx, 3) |
| 6007 | p.SetState(248) |
| 6008 | p.GetErrorHandler().Sync(p) |
| 6009 | if p.HasError() { |
| 6010 | goto errorExit |
| 6011 | } |
| 6012 | _la = p.GetTokenStream().LA(1) |
| 6013 | |
| 6014 | if _la == CELParserMINUS { |
| 6015 | { |
| 6016 | p.SetState(247) |
| 6017 | |
| 6018 | var _m = p.Match(CELParserMINUS) |
| 6019 | |
| 6020 | localctx.(*DoubleContext).sign = _m |
| 6021 | if p.HasError() { |
| 6022 | // Recognition error - abort rule |
| 6023 | goto errorExit |
| 6024 | } |
| 6025 | } |
| 6026 | |
| 6027 | } |
| 6028 | { |
| 6029 | p.SetState(250) |
| 6030 | |
| 6031 | var _m = p.Match(CELParserNUM_FLOAT) |
| 6032 | |
| 6033 | localctx.(*DoubleContext).tok = _m |
| 6034 | if p.HasError() { |
| 6035 | // Recognition error - abort rule |
| 6036 | goto errorExit |
| 6037 | } |
| 6038 | } |
| 6039 | |
| 6040 | case 4: |
| 6041 | localctx = NewStringContext(p, localctx) |
| 6042 | p.EnterOuterAlt(localctx, 4) |
| 6043 | { |
| 6044 | p.SetState(251) |
| 6045 | |
| 6046 | var _m = p.Match(CELParserSTRING) |
| 6047 | |
| 6048 | localctx.(*StringContext).tok = _m |
| 6049 | if p.HasError() { |
| 6050 | // Recognition error - abort rule |
| 6051 | goto errorExit |
| 6052 | } |
| 6053 | } |
| 6054 | |
| 6055 | case 5: |
| 6056 | localctx = NewBytesContext(p, localctx) |
| 6057 | p.EnterOuterAlt(localctx, 5) |
| 6058 | { |
| 6059 | p.SetState(252) |
| 6060 | |
| 6061 | var _m = p.Match(CELParserBYTES) |
| 6062 | |
| 6063 | localctx.(*BytesContext).tok = _m |
| 6064 | if p.HasError() { |
| 6065 | // Recognition error - abort rule |
| 6066 | goto errorExit |
| 6067 | } |
| 6068 | } |
| 6069 | |
| 6070 | case 6: |
| 6071 | localctx = NewBoolTrueContext(p, localctx) |
| 6072 | p.EnterOuterAlt(localctx, 6) |
| 6073 | { |
| 6074 | p.SetState(253) |
| 6075 | |
| 6076 | var _m = p.Match(CELParserCEL_TRUE) |
| 6077 | |
| 6078 | localctx.(*BoolTrueContext).tok = _m |
| 6079 | if p.HasError() { |
| 6080 | // Recognition error - abort rule |
| 6081 | goto errorExit |
| 6082 | } |
| 6083 | } |
| 6084 | |
| 6085 | case 7: |
| 6086 | localctx = NewBoolFalseContext(p, localctx) |
| 6087 | p.EnterOuterAlt(localctx, 7) |
| 6088 | { |
| 6089 | p.SetState(254) |
| 6090 | |
| 6091 | var _m = p.Match(CELParserCEL_FALSE) |
| 6092 | |
| 6093 | localctx.(*BoolFalseContext).tok = _m |
| 6094 | if p.HasError() { |
| 6095 | // Recognition error - abort rule |
| 6096 | goto errorExit |
| 6097 | } |
| 6098 | } |
| 6099 | |
| 6100 | case 8: |
| 6101 | localctx = NewNullContext(p, localctx) |
| 6102 | p.EnterOuterAlt(localctx, 8) |
| 6103 | { |
| 6104 | p.SetState(255) |
| 6105 | |
| 6106 | var _m = p.Match(CELParserNUL) |
| 6107 | |
| 6108 | localctx.(*NullContext).tok = _m |
| 6109 | if p.HasError() { |
| 6110 | // Recognition error - abort rule |
| 6111 | goto errorExit |
| 6112 | } |
| 6113 | } |
| 6114 | |
| 6115 | case antlr.ATNInvalidAltNumber: |
| 6116 | goto errorExit |
| 6117 | } |
| 6118 | |
| 6119 | errorExit: |
| 6120 | if p.HasError() { |
| 6121 | v := p.GetError() |
| 6122 | localctx.SetException(v) |
| 6123 | p.GetErrorHandler().ReportError(p, v) |
| 6124 | p.GetErrorHandler().Recover(p, v) |
| 6125 | p.SetError(nil) |
| 6126 | } |
| 6127 | p.ExitRule() |
| 6128 | return localctx |
| 6129 | goto errorExit // Trick to prevent compiler error if the label is not used |
| 6130 | } |
| 6131 | |
| 6132 | func (p *CELParser) Sempred(localctx antlr.RuleContext, ruleIndex, predIndex int) bool { |
| 6133 | switch ruleIndex { |
| 6134 | case 4: |
| 6135 | var t *RelationContext = nil |
| 6136 | if localctx != nil { |
| 6137 | t = localctx.(*RelationContext) |
| 6138 | } |
| 6139 | return p.Relation_Sempred(t, predIndex) |
| 6140 | |
| 6141 | case 5: |
| 6142 | var t *CalcContext = nil |
| 6143 | if localctx != nil { |
| 6144 | t = localctx.(*CalcContext) |
| 6145 | } |
| 6146 | return p.Calc_Sempred(t, predIndex) |
| 6147 | |
| 6148 | case 7: |
| 6149 | var t *MemberContext = nil |
| 6150 | if localctx != nil { |
| 6151 | t = localctx.(*MemberContext) |
| 6152 | } |
| 6153 | return p.Member_Sempred(t, predIndex) |
| 6154 | |
| 6155 | default: |
| 6156 | panic("No predicate with index: " + fmt.Sprint(ruleIndex)) |
| 6157 | } |
| 6158 | } |
| 6159 | |
| 6160 | func (p *CELParser) Relation_Sempred(localctx antlr.RuleContext, predIndex int) bool { |
| 6161 | switch predIndex { |
| 6162 | case 0: |
| 6163 | return p.Precpred(p.GetParserRuleContext(), 1) |
| 6164 | |
| 6165 | default: |
| 6166 | panic("No predicate with index: " + fmt.Sprint(predIndex)) |
| 6167 | } |
| 6168 | } |
| 6169 | |
| 6170 | func (p *CELParser) Calc_Sempred(localctx antlr.RuleContext, predIndex int) bool { |
| 6171 | switch predIndex { |
| 6172 | case 1: |
| 6173 | return p.Precpred(p.GetParserRuleContext(), 2) |
| 6174 | |
| 6175 | case 2: |
| 6176 | return p.Precpred(p.GetParserRuleContext(), 1) |
| 6177 | |
| 6178 | default: |
| 6179 | panic("No predicate with index: " + fmt.Sprint(predIndex)) |
| 6180 | } |
| 6181 | } |
| 6182 | |
| 6183 | func (p *CELParser) Member_Sempred(localctx antlr.RuleContext, predIndex int) bool { |
| 6184 | switch predIndex { |
| 6185 | case 3: |
| 6186 | return p.Precpred(p.GetParserRuleContext(), 3) |
| 6187 | |
| 6188 | case 4: |
| 6189 | return p.Precpred(p.GetParserRuleContext(), 2) |
| 6190 | |
| 6191 | case 5: |
| 6192 | return p.Precpred(p.GetParserRuleContext(), 1) |
| 6193 | |
| 6194 | default: |
| 6195 | panic("No predicate with index: " + fmt.Sprint(predIndex)) |
| 6196 | } |
| 6197 | } |