[#78] netmap: Add new keywords NOT and UNIQUE
* Add the rule for NOT operation to the policy parser grammar * Regenerate query parse * Implement NOT in filter * Add unit-tests Signed-off-by: Airat Arifullin a.arifullin@yadro.com
This commit is contained in:
parent
ec59ebfd88
commit
4f48f6c9e0
17 changed files with 468 additions and 376 deletions
|
@ -1,5 +1,3 @@
|
|||
// Code generated from /work/netmap/parser/Query.g4 by ANTLR 4.13.0. DO NOT EDIT.
|
||||
|
||||
package parser // Query
|
||||
|
||||
import (
|
||||
|
@ -33,14 +31,14 @@ var QueryParserStaticData struct {
|
|||
func queryParserInit() {
|
||||
staticData := &QueryParserStaticData
|
||||
staticData.LiteralNames = []string{
|
||||
"", "'AND'", "'OR'", "", "'REP'", "'IN'", "'AS'", "'CBF'", "'SELECT'",
|
||||
"'FROM'", "'FILTER'", "'*'", "'SAME'", "'DISTINCT'", "'('", "')'", "'@'",
|
||||
"", "", "'0'",
|
||||
"", "'NOT'", "'AND'", "'OR'", "", "'REP'", "'IN'", "'AS'", "'CBF'",
|
||||
"'SELECT'", "'FROM'", "'FILTER'", "'*'", "'SAME'", "'DISTINCT'", "'('",
|
||||
"')'", "'@'", "", "", "'0'",
|
||||
}
|
||||
staticData.SymbolicNames = []string{
|
||||
"", "AND_OP", "OR_OP", "SIMPLE_OP", "REP", "IN", "AS", "CBF", "SELECT",
|
||||
"FROM", "FILTER", "WILDCARD", "CLAUSE_SAME", "CLAUSE_DISTINCT", "L_PAREN",
|
||||
"R_PAREN", "AT", "IDENT", "NUMBER1", "ZERO", "STRING", "WS",
|
||||
"", "NOT_OP", "AND_OP", "OR_OP", "SIMPLE_OP", "REP", "IN", "AS", "CBF",
|
||||
"SELECT", "FROM", "FILTER", "WILDCARD", "CLAUSE_SAME", "CLAUSE_DISTINCT",
|
||||
"L_PAREN", "R_PAREN", "AT", "IDENT", "NUMBER1", "ZERO", "STRING", "WS",
|
||||
}
|
||||
staticData.RuleNames = []string{
|
||||
"policy", "repStmt", "cbfStmt", "selectStmt", "clause", "filterExpr",
|
||||
|
@ -49,60 +47,62 @@ func queryParserInit() {
|
|||
}
|
||||
staticData.PredictionContextCache = antlr.NewPredictionContextCache()
|
||||
staticData.serializedATN = []int32{
|
||||
4, 1, 21, 130, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7,
|
||||
4, 1, 22, 135, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7,
|
||||
4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7,
|
||||
10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 1, 0, 4, 0, 30, 8, 0, 11,
|
||||
0, 12, 0, 31, 1, 0, 3, 0, 35, 8, 0, 1, 0, 5, 0, 38, 8, 0, 10, 0, 12, 0,
|
||||
41, 9, 0, 1, 0, 5, 0, 44, 8, 0, 10, 0, 12, 0, 47, 9, 0, 1, 0, 1, 0, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 3, 1, 55, 8, 1, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3,
|
||||
1, 3, 3, 3, 64, 8, 3, 1, 3, 3, 3, 67, 8, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3,
|
||||
3, 73, 8, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 83,
|
||||
8, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 5, 5, 91, 8, 5, 10, 5, 12, 5,
|
||||
94, 9, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1,
|
||||
7, 3, 7, 107, 8, 7, 1, 8, 1, 8, 3, 8, 111, 8, 8, 1, 9, 1, 9, 1, 9, 3, 9,
|
||||
116, 8, 9, 1, 10, 1, 10, 1, 11, 1, 11, 1, 12, 1, 12, 3, 12, 124, 8, 12,
|
||||
1, 13, 1, 13, 3, 13, 128, 8, 13, 1, 13, 0, 1, 10, 14, 0, 2, 4, 6, 8, 10,
|
||||
12, 14, 16, 18, 20, 22, 24, 26, 0, 3, 1, 0, 12, 13, 1, 0, 18, 19, 2, 0,
|
||||
4, 6, 8, 10, 132, 0, 29, 1, 0, 0, 0, 2, 50, 1, 0, 0, 0, 4, 56, 1, 0, 0,
|
||||
0, 6, 59, 1, 0, 0, 0, 8, 74, 1, 0, 0, 0, 10, 82, 1, 0, 0, 0, 12, 95, 1,
|
||||
0, 0, 0, 14, 106, 1, 0, 0, 0, 16, 110, 1, 0, 0, 0, 18, 115, 1, 0, 0, 0,
|
||||
20, 117, 1, 0, 0, 0, 22, 119, 1, 0, 0, 0, 24, 123, 1, 0, 0, 0, 26, 127,
|
||||
1, 0, 0, 0, 28, 30, 3, 2, 1, 0, 29, 28, 1, 0, 0, 0, 30, 31, 1, 0, 0, 0,
|
||||
31, 29, 1, 0, 0, 0, 31, 32, 1, 0, 0, 0, 32, 34, 1, 0, 0, 0, 33, 35, 3,
|
||||
4, 2, 0, 34, 33, 1, 0, 0, 0, 34, 35, 1, 0, 0, 0, 35, 39, 1, 0, 0, 0, 36,
|
||||
38, 3, 6, 3, 0, 37, 36, 1, 0, 0, 0, 38, 41, 1, 0, 0, 0, 39, 37, 1, 0, 0,
|
||||
0, 39, 40, 1, 0, 0, 0, 40, 45, 1, 0, 0, 0, 41, 39, 1, 0, 0, 0, 42, 44,
|
||||
3, 12, 6, 0, 43, 42, 1, 0, 0, 0, 44, 47, 1, 0, 0, 0, 45, 43, 1, 0, 0, 0,
|
||||
45, 46, 1, 0, 0, 0, 46, 48, 1, 0, 0, 0, 47, 45, 1, 0, 0, 0, 48, 49, 5,
|
||||
0, 0, 1, 49, 1, 1, 0, 0, 0, 50, 51, 5, 4, 0, 0, 51, 54, 5, 18, 0, 0, 52,
|
||||
53, 5, 5, 0, 0, 53, 55, 3, 24, 12, 0, 54, 52, 1, 0, 0, 0, 54, 55, 1, 0,
|
||||
0, 0, 55, 3, 1, 0, 0, 0, 56, 57, 5, 7, 0, 0, 57, 58, 5, 18, 0, 0, 58, 5,
|
||||
1, 0, 0, 0, 59, 60, 5, 8, 0, 0, 60, 66, 5, 18, 0, 0, 61, 63, 5, 5, 0, 0,
|
||||
62, 64, 3, 8, 4, 0, 63, 62, 1, 0, 0, 0, 63, 64, 1, 0, 0, 0, 64, 65, 1,
|
||||
0, 0, 0, 65, 67, 3, 24, 12, 0, 66, 61, 1, 0, 0, 0, 66, 67, 1, 0, 0, 0,
|
||||
67, 68, 1, 0, 0, 0, 68, 69, 5, 9, 0, 0, 69, 72, 3, 26, 13, 0, 70, 71, 5,
|
||||
6, 0, 0, 71, 73, 3, 24, 12, 0, 72, 70, 1, 0, 0, 0, 72, 73, 1, 0, 0, 0,
|
||||
73, 7, 1, 0, 0, 0, 74, 75, 7, 0, 0, 0, 75, 9, 1, 0, 0, 0, 76, 77, 6, 5,
|
||||
-1, 0, 77, 78, 5, 14, 0, 0, 78, 79, 3, 10, 5, 0, 79, 80, 5, 15, 0, 0, 80,
|
||||
83, 1, 0, 0, 0, 81, 83, 3, 14, 7, 0, 82, 76, 1, 0, 0, 0, 82, 81, 1, 0,
|
||||
0, 0, 83, 92, 1, 0, 0, 0, 84, 85, 10, 4, 0, 0, 85, 86, 5, 1, 0, 0, 86,
|
||||
91, 3, 10, 5, 5, 87, 88, 10, 3, 0, 0, 88, 89, 5, 2, 0, 0, 89, 91, 3, 10,
|
||||
5, 4, 90, 84, 1, 0, 0, 0, 90, 87, 1, 0, 0, 0, 91, 94, 1, 0, 0, 0, 92, 90,
|
||||
1, 0, 0, 0, 92, 93, 1, 0, 0, 0, 93, 11, 1, 0, 0, 0, 94, 92, 1, 0, 0, 0,
|
||||
95, 96, 5, 10, 0, 0, 96, 97, 3, 10, 5, 0, 97, 98, 5, 6, 0, 0, 98, 99, 3,
|
||||
24, 12, 0, 99, 13, 1, 0, 0, 0, 100, 101, 5, 16, 0, 0, 101, 107, 3, 24,
|
||||
12, 0, 102, 103, 3, 16, 8, 0, 103, 104, 5, 3, 0, 0, 104, 105, 3, 18, 9,
|
||||
0, 105, 107, 1, 0, 0, 0, 106, 100, 1, 0, 0, 0, 106, 102, 1, 0, 0, 0, 107,
|
||||
15, 1, 0, 0, 0, 108, 111, 3, 24, 12, 0, 109, 111, 5, 20, 0, 0, 110, 108,
|
||||
1, 0, 0, 0, 110, 109, 1, 0, 0, 0, 111, 17, 1, 0, 0, 0, 112, 116, 3, 24,
|
||||
12, 0, 113, 116, 3, 20, 10, 0, 114, 116, 5, 20, 0, 0, 115, 112, 1, 0, 0,
|
||||
0, 115, 113, 1, 0, 0, 0, 115, 114, 1, 0, 0, 0, 116, 19, 1, 0, 0, 0, 117,
|
||||
118, 7, 1, 0, 0, 118, 21, 1, 0, 0, 0, 119, 120, 7, 2, 0, 0, 120, 23, 1,
|
||||
0, 0, 0, 121, 124, 3, 22, 11, 0, 122, 124, 5, 17, 0, 0, 123, 121, 1, 0,
|
||||
0, 0, 123, 122, 1, 0, 0, 0, 124, 25, 1, 0, 0, 0, 125, 128, 3, 24, 12, 0,
|
||||
126, 128, 5, 11, 0, 0, 127, 125, 1, 0, 0, 0, 127, 126, 1, 0, 0, 0, 128,
|
||||
27, 1, 0, 0, 0, 16, 31, 34, 39, 45, 54, 63, 66, 72, 82, 90, 92, 106, 110,
|
||||
115, 123, 127,
|
||||
3, 73, 8, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5,
|
||||
1, 5, 1, 5, 1, 5, 3, 5, 88, 8, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 5,
|
||||
5, 96, 8, 5, 10, 5, 12, 5, 99, 9, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7,
|
||||
1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 3, 7, 112, 8, 7, 1, 8, 1, 8, 3, 8, 116, 8,
|
||||
8, 1, 9, 1, 9, 1, 9, 3, 9, 121, 8, 9, 1, 10, 1, 10, 1, 11, 1, 11, 1, 12,
|
||||
1, 12, 3, 12, 129, 8, 12, 1, 13, 1, 13, 3, 13, 133, 8, 13, 1, 13, 0, 1,
|
||||
10, 14, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 0, 3, 1, 0,
|
||||
13, 14, 1, 0, 19, 20, 2, 0, 5, 7, 9, 11, 138, 0, 29, 1, 0, 0, 0, 2, 50,
|
||||
1, 0, 0, 0, 4, 56, 1, 0, 0, 0, 6, 59, 1, 0, 0, 0, 8, 74, 1, 0, 0, 0, 10,
|
||||
87, 1, 0, 0, 0, 12, 100, 1, 0, 0, 0, 14, 111, 1, 0, 0, 0, 16, 115, 1, 0,
|
||||
0, 0, 18, 120, 1, 0, 0, 0, 20, 122, 1, 0, 0, 0, 22, 124, 1, 0, 0, 0, 24,
|
||||
128, 1, 0, 0, 0, 26, 132, 1, 0, 0, 0, 28, 30, 3, 2, 1, 0, 29, 28, 1, 0,
|
||||
0, 0, 30, 31, 1, 0, 0, 0, 31, 29, 1, 0, 0, 0, 31, 32, 1, 0, 0, 0, 32, 34,
|
||||
1, 0, 0, 0, 33, 35, 3, 4, 2, 0, 34, 33, 1, 0, 0, 0, 34, 35, 1, 0, 0, 0,
|
||||
35, 39, 1, 0, 0, 0, 36, 38, 3, 6, 3, 0, 37, 36, 1, 0, 0, 0, 38, 41, 1,
|
||||
0, 0, 0, 39, 37, 1, 0, 0, 0, 39, 40, 1, 0, 0, 0, 40, 45, 1, 0, 0, 0, 41,
|
||||
39, 1, 0, 0, 0, 42, 44, 3, 12, 6, 0, 43, 42, 1, 0, 0, 0, 44, 47, 1, 0,
|
||||
0, 0, 45, 43, 1, 0, 0, 0, 45, 46, 1, 0, 0, 0, 46, 48, 1, 0, 0, 0, 47, 45,
|
||||
1, 0, 0, 0, 48, 49, 5, 0, 0, 1, 49, 1, 1, 0, 0, 0, 50, 51, 5, 5, 0, 0,
|
||||
51, 54, 5, 19, 0, 0, 52, 53, 5, 6, 0, 0, 53, 55, 3, 24, 12, 0, 54, 52,
|
||||
1, 0, 0, 0, 54, 55, 1, 0, 0, 0, 55, 3, 1, 0, 0, 0, 56, 57, 5, 8, 0, 0,
|
||||
57, 58, 5, 19, 0, 0, 58, 5, 1, 0, 0, 0, 59, 60, 5, 9, 0, 0, 60, 66, 5,
|
||||
19, 0, 0, 61, 63, 5, 6, 0, 0, 62, 64, 3, 8, 4, 0, 63, 62, 1, 0, 0, 0, 63,
|
||||
64, 1, 0, 0, 0, 64, 65, 1, 0, 0, 0, 65, 67, 3, 24, 12, 0, 66, 61, 1, 0,
|
||||
0, 0, 66, 67, 1, 0, 0, 0, 67, 68, 1, 0, 0, 0, 68, 69, 5, 10, 0, 0, 69,
|
||||
72, 3, 26, 13, 0, 70, 71, 5, 7, 0, 0, 71, 73, 3, 24, 12, 0, 72, 70, 1,
|
||||
0, 0, 0, 72, 73, 1, 0, 0, 0, 73, 7, 1, 0, 0, 0, 74, 75, 7, 0, 0, 0, 75,
|
||||
9, 1, 0, 0, 0, 76, 77, 6, 5, -1, 0, 77, 78, 5, 1, 0, 0, 78, 79, 5, 15,
|
||||
0, 0, 79, 80, 3, 10, 5, 0, 80, 81, 5, 16, 0, 0, 81, 88, 1, 0, 0, 0, 82,
|
||||
83, 5, 15, 0, 0, 83, 84, 3, 10, 5, 0, 84, 85, 5, 16, 0, 0, 85, 88, 1, 0,
|
||||
0, 0, 86, 88, 3, 14, 7, 0, 87, 76, 1, 0, 0, 0, 87, 82, 1, 0, 0, 0, 87,
|
||||
86, 1, 0, 0, 0, 88, 97, 1, 0, 0, 0, 89, 90, 10, 4, 0, 0, 90, 91, 5, 2,
|
||||
0, 0, 91, 96, 3, 10, 5, 5, 92, 93, 10, 3, 0, 0, 93, 94, 5, 3, 0, 0, 94,
|
||||
96, 3, 10, 5, 4, 95, 89, 1, 0, 0, 0, 95, 92, 1, 0, 0, 0, 96, 99, 1, 0,
|
||||
0, 0, 97, 95, 1, 0, 0, 0, 97, 98, 1, 0, 0, 0, 98, 11, 1, 0, 0, 0, 99, 97,
|
||||
1, 0, 0, 0, 100, 101, 5, 11, 0, 0, 101, 102, 3, 10, 5, 0, 102, 103, 5,
|
||||
7, 0, 0, 103, 104, 3, 24, 12, 0, 104, 13, 1, 0, 0, 0, 105, 106, 5, 17,
|
||||
0, 0, 106, 112, 3, 24, 12, 0, 107, 108, 3, 16, 8, 0, 108, 109, 5, 4, 0,
|
||||
0, 109, 110, 3, 18, 9, 0, 110, 112, 1, 0, 0, 0, 111, 105, 1, 0, 0, 0, 111,
|
||||
107, 1, 0, 0, 0, 112, 15, 1, 0, 0, 0, 113, 116, 3, 24, 12, 0, 114, 116,
|
||||
5, 21, 0, 0, 115, 113, 1, 0, 0, 0, 115, 114, 1, 0, 0, 0, 116, 17, 1, 0,
|
||||
0, 0, 117, 121, 3, 24, 12, 0, 118, 121, 3, 20, 10, 0, 119, 121, 5, 21,
|
||||
0, 0, 120, 117, 1, 0, 0, 0, 120, 118, 1, 0, 0, 0, 120, 119, 1, 0, 0, 0,
|
||||
121, 19, 1, 0, 0, 0, 122, 123, 7, 1, 0, 0, 123, 21, 1, 0, 0, 0, 124, 125,
|
||||
7, 2, 0, 0, 125, 23, 1, 0, 0, 0, 126, 129, 3, 22, 11, 0, 127, 129, 5, 18,
|
||||
0, 0, 128, 126, 1, 0, 0, 0, 128, 127, 1, 0, 0, 0, 129, 25, 1, 0, 0, 0,
|
||||
130, 133, 3, 24, 12, 0, 131, 133, 5, 12, 0, 0, 132, 130, 1, 0, 0, 0, 132,
|
||||
131, 1, 0, 0, 0, 133, 27, 1, 0, 0, 0, 16, 31, 34, 39, 45, 54, 63, 66, 72,
|
||||
87, 95, 97, 111, 115, 120, 128, 132,
|
||||
}
|
||||
deserializer := antlr.NewATNDeserializer(nil)
|
||||
staticData.atn = deserializer.Deserialize(staticData.serializedATN)
|
||||
|
@ -141,27 +141,28 @@ func NewQuery(input antlr.TokenStream) *Query {
|
|||
// Query tokens.
|
||||
const (
|
||||
QueryEOF = antlr.TokenEOF
|
||||
QueryAND_OP = 1
|
||||
QueryOR_OP = 2
|
||||
QuerySIMPLE_OP = 3
|
||||
QueryREP = 4
|
||||
QueryIN = 5
|
||||
QueryAS = 6
|
||||
QueryCBF = 7
|
||||
QuerySELECT = 8
|
||||
QueryFROM = 9
|
||||
QueryFILTER = 10
|
||||
QueryWILDCARD = 11
|
||||
QueryCLAUSE_SAME = 12
|
||||
QueryCLAUSE_DISTINCT = 13
|
||||
QueryL_PAREN = 14
|
||||
QueryR_PAREN = 15
|
||||
QueryAT = 16
|
||||
QueryIDENT = 17
|
||||
QueryNUMBER1 = 18
|
||||
QueryZERO = 19
|
||||
QuerySTRING = 20
|
||||
QueryWS = 21
|
||||
QueryNOT_OP = 1
|
||||
QueryAND_OP = 2
|
||||
QueryOR_OP = 3
|
||||
QuerySIMPLE_OP = 4
|
||||
QueryREP = 5
|
||||
QueryIN = 6
|
||||
QueryAS = 7
|
||||
QueryCBF = 8
|
||||
QuerySELECT = 9
|
||||
QueryFROM = 10
|
||||
QueryFILTER = 11
|
||||
QueryWILDCARD = 12
|
||||
QueryCLAUSE_SAME = 13
|
||||
QueryCLAUSE_DISTINCT = 14
|
||||
QueryL_PAREN = 15
|
||||
QueryR_PAREN = 16
|
||||
QueryAT = 17
|
||||
QueryIDENT = 18
|
||||
QueryNUMBER1 = 19
|
||||
QueryZERO = 20
|
||||
QuerySTRING = 21
|
||||
QueryWS = 22
|
||||
)
|
||||
|
||||
// Query rules.
|
||||
|
@ -1265,6 +1266,7 @@ type IFilterExprContext interface {
|
|||
// Getter signatures
|
||||
L_PAREN() antlr.TerminalNode
|
||||
R_PAREN() antlr.TerminalNode
|
||||
NOT_OP() antlr.TerminalNode
|
||||
AllFilterExpr() []IFilterExprContext
|
||||
FilterExpr(i int) IFilterExprContext
|
||||
Expr() IExprContext
|
||||
|
@ -1279,8 +1281,8 @@ type FilterExprContext struct {
|
|||
antlr.BaseParserRuleContext
|
||||
parser antlr.Parser
|
||||
F1 IFilterExprContext
|
||||
Inner IFilterExprContext
|
||||
Op antlr.Token
|
||||
Inner IFilterExprContext
|
||||
F2 IFilterExprContext
|
||||
}
|
||||
|
||||
|
@ -1335,6 +1337,10 @@ func (s *FilterExprContext) R_PAREN() antlr.TerminalNode {
|
|||
return s.GetToken(QueryR_PAREN, 0)
|
||||
}
|
||||
|
||||
func (s *FilterExprContext) NOT_OP() antlr.TerminalNode {
|
||||
return s.GetToken(QueryNOT_OP, 0)
|
||||
}
|
||||
|
||||
func (s *FilterExprContext) AllFilterExpr() []IFilterExprContext {
|
||||
children := s.GetChildren()
|
||||
len := 0
|
||||
|
@ -1434,17 +1440,20 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) {
|
|||
var _alt int
|
||||
|
||||
p.EnterOuterAlt(localctx, 1)
|
||||
p.SetState(82)
|
||||
p.SetState(87)
|
||||
p.GetErrorHandler().Sync(p)
|
||||
if p.HasError() {
|
||||
goto errorExit
|
||||
}
|
||||
|
||||
switch p.GetTokenStream().LA(1) {
|
||||
case QueryL_PAREN:
|
||||
case QueryNOT_OP:
|
||||
{
|
||||
p.SetState(77)
|
||||
p.Match(QueryL_PAREN)
|
||||
|
||||
var _m = p.Match(QueryNOT_OP)
|
||||
|
||||
localctx.(*FilterExprContext).Op = _m
|
||||
if p.HasError() {
|
||||
// Recognition error - abort rule
|
||||
goto errorExit
|
||||
|
@ -1452,13 +1461,46 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) {
|
|||
}
|
||||
{
|
||||
p.SetState(78)
|
||||
p.Match(QueryL_PAREN)
|
||||
if p.HasError() {
|
||||
// Recognition error - abort rule
|
||||
goto errorExit
|
||||
}
|
||||
}
|
||||
{
|
||||
p.SetState(79)
|
||||
|
||||
var _x = p.filterExpr(0)
|
||||
|
||||
localctx.(*FilterExprContext).F1 = _x
|
||||
}
|
||||
{
|
||||
p.SetState(80)
|
||||
p.Match(QueryR_PAREN)
|
||||
if p.HasError() {
|
||||
// Recognition error - abort rule
|
||||
goto errorExit
|
||||
}
|
||||
}
|
||||
|
||||
case QueryL_PAREN:
|
||||
{
|
||||
p.SetState(82)
|
||||
p.Match(QueryL_PAREN)
|
||||
if p.HasError() {
|
||||
// Recognition error - abort rule
|
||||
goto errorExit
|
||||
}
|
||||
}
|
||||
{
|
||||
p.SetState(83)
|
||||
|
||||
var _x = p.filterExpr(0)
|
||||
|
||||
localctx.(*FilterExprContext).Inner = _x
|
||||
}
|
||||
{
|
||||
p.SetState(79)
|
||||
p.SetState(84)
|
||||
p.Match(QueryR_PAREN)
|
||||
if p.HasError() {
|
||||
// Recognition error - abort rule
|
||||
|
@ -1468,7 +1510,7 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) {
|
|||
|
||||
case QueryREP, QueryIN, QueryAS, QuerySELECT, QueryFROM, QueryFILTER, QueryAT, QueryIDENT, QuerySTRING:
|
||||
{
|
||||
p.SetState(81)
|
||||
p.SetState(86)
|
||||
p.Expr()
|
||||
}
|
||||
|
||||
|
@ -1477,7 +1519,7 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) {
|
|||
goto errorExit
|
||||
}
|
||||
p.GetParserRuleContext().SetStop(p.GetTokenStream().LT(-1))
|
||||
p.SetState(92)
|
||||
p.SetState(97)
|
||||
p.GetErrorHandler().Sync(p)
|
||||
if p.HasError() {
|
||||
goto errorExit
|
||||
|
@ -1492,7 +1534,7 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) {
|
|||
p.TriggerExitRuleEvent()
|
||||
}
|
||||
_prevctx = localctx
|
||||
p.SetState(90)
|
||||
p.SetState(95)
|
||||
p.GetErrorHandler().Sync(p)
|
||||
if p.HasError() {
|
||||
goto errorExit
|
||||
|
@ -1503,14 +1545,14 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) {
|
|||
localctx = NewFilterExprContext(p, _parentctx, _parentState)
|
||||
localctx.(*FilterExprContext).F1 = _prevctx
|
||||
p.PushNewRecursionContext(localctx, _startState, QueryRULE_filterExpr)
|
||||
p.SetState(84)
|
||||
p.SetState(89)
|
||||
|
||||
if !(p.Precpred(p.GetParserRuleContext(), 4)) {
|
||||
p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 4)", ""))
|
||||
goto errorExit
|
||||
}
|
||||
{
|
||||
p.SetState(85)
|
||||
p.SetState(90)
|
||||
|
||||
var _m = p.Match(QueryAND_OP)
|
||||
|
||||
|
@ -1521,7 +1563,7 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) {
|
|||
}
|
||||
}
|
||||
{
|
||||
p.SetState(86)
|
||||
p.SetState(91)
|
||||
|
||||
var _x = p.filterExpr(5)
|
||||
|
||||
|
@ -1532,14 +1574,14 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) {
|
|||
localctx = NewFilterExprContext(p, _parentctx, _parentState)
|
||||
localctx.(*FilterExprContext).F1 = _prevctx
|
||||
p.PushNewRecursionContext(localctx, _startState, QueryRULE_filterExpr)
|
||||
p.SetState(87)
|
||||
p.SetState(92)
|
||||
|
||||
if !(p.Precpred(p.GetParserRuleContext(), 3)) {
|
||||
p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 3)", ""))
|
||||
goto errorExit
|
||||
}
|
||||
{
|
||||
p.SetState(88)
|
||||
p.SetState(93)
|
||||
|
||||
var _m = p.Match(QueryOR_OP)
|
||||
|
||||
|
@ -1550,7 +1592,7 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) {
|
|||
}
|
||||
}
|
||||
{
|
||||
p.SetState(89)
|
||||
p.SetState(94)
|
||||
|
||||
var _x = p.filterExpr(4)
|
||||
|
||||
|
@ -1562,7 +1604,7 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) {
|
|||
}
|
||||
|
||||
}
|
||||
p.SetState(94)
|
||||
p.SetState(99)
|
||||
p.GetErrorHandler().Sync(p)
|
||||
if p.HasError() {
|
||||
goto errorExit
|
||||
|
@ -1720,7 +1762,7 @@ func (p *Query) FilterStmt() (localctx IFilterStmtContext) {
|
|||
p.EnterRule(localctx, 12, QueryRULE_filterStmt)
|
||||
p.EnterOuterAlt(localctx, 1)
|
||||
{
|
||||
p.SetState(95)
|
||||
p.SetState(100)
|
||||
p.Match(QueryFILTER)
|
||||
if p.HasError() {
|
||||
// Recognition error - abort rule
|
||||
|
@ -1728,14 +1770,14 @@ func (p *Query) FilterStmt() (localctx IFilterStmtContext) {
|
|||
}
|
||||
}
|
||||
{
|
||||
p.SetState(96)
|
||||
p.SetState(101)
|
||||
|
||||
var _x = p.filterExpr(0)
|
||||
|
||||
localctx.(*FilterStmtContext).Expr = _x
|
||||
}
|
||||
{
|
||||
p.SetState(97)
|
||||
p.SetState(102)
|
||||
p.Match(QueryAS)
|
||||
if p.HasError() {
|
||||
// Recognition error - abort rule
|
||||
|
@ -1743,7 +1785,7 @@ func (p *Query) FilterStmt() (localctx IFilterStmtContext) {
|
|||
}
|
||||
}
|
||||
{
|
||||
p.SetState(98)
|
||||
p.SetState(103)
|
||||
|
||||
var _x = p.Ident()
|
||||
|
||||
|
@ -1923,7 +1965,7 @@ func (s *ExprContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
|||
func (p *Query) Expr() (localctx IExprContext) {
|
||||
localctx = NewExprContext(p, p.GetParserRuleContext(), p.GetState())
|
||||
p.EnterRule(localctx, 14, QueryRULE_expr)
|
||||
p.SetState(106)
|
||||
p.SetState(111)
|
||||
p.GetErrorHandler().Sync(p)
|
||||
if p.HasError() {
|
||||
goto errorExit
|
||||
|
@ -1933,7 +1975,7 @@ func (p *Query) Expr() (localctx IExprContext) {
|
|||
case QueryAT:
|
||||
p.EnterOuterAlt(localctx, 1)
|
||||
{
|
||||
p.SetState(100)
|
||||
p.SetState(105)
|
||||
p.Match(QueryAT)
|
||||
if p.HasError() {
|
||||
// Recognition error - abort rule
|
||||
|
@ -1941,7 +1983,7 @@ func (p *Query) Expr() (localctx IExprContext) {
|
|||
}
|
||||
}
|
||||
{
|
||||
p.SetState(101)
|
||||
p.SetState(106)
|
||||
|
||||
var _x = p.Ident()
|
||||
|
||||
|
@ -1951,14 +1993,14 @@ func (p *Query) Expr() (localctx IExprContext) {
|
|||
case QueryREP, QueryIN, QueryAS, QuerySELECT, QueryFROM, QueryFILTER, QueryIDENT, QuerySTRING:
|
||||
p.EnterOuterAlt(localctx, 2)
|
||||
{
|
||||
p.SetState(102)
|
||||
p.SetState(107)
|
||||
|
||||
var _x = p.FilterKey()
|
||||
|
||||
localctx.(*ExprContext).Key = _x
|
||||
}
|
||||
{
|
||||
p.SetState(103)
|
||||
p.SetState(108)
|
||||
p.Match(QuerySIMPLE_OP)
|
||||
if p.HasError() {
|
||||
// Recognition error - abort rule
|
||||
|
@ -1966,7 +2008,7 @@ func (p *Query) Expr() (localctx IExprContext) {
|
|||
}
|
||||
}
|
||||
{
|
||||
p.SetState(104)
|
||||
p.SetState(109)
|
||||
|
||||
var _x = p.FilterValue()
|
||||
|
||||
|
@ -2079,7 +2121,7 @@ func (s *FilterKeyContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
|||
func (p *Query) FilterKey() (localctx IFilterKeyContext) {
|
||||
localctx = NewFilterKeyContext(p, p.GetParserRuleContext(), p.GetState())
|
||||
p.EnterRule(localctx, 16, QueryRULE_filterKey)
|
||||
p.SetState(110)
|
||||
p.SetState(115)
|
||||
p.GetErrorHandler().Sync(p)
|
||||
if p.HasError() {
|
||||
goto errorExit
|
||||
|
@ -2089,14 +2131,14 @@ func (p *Query) FilterKey() (localctx IFilterKeyContext) {
|
|||
case QueryREP, QueryIN, QueryAS, QuerySELECT, QueryFROM, QueryFILTER, QueryIDENT:
|
||||
p.EnterOuterAlt(localctx, 1)
|
||||
{
|
||||
p.SetState(108)
|
||||
p.SetState(113)
|
||||
p.Ident()
|
||||
}
|
||||
|
||||
case QuerySTRING:
|
||||
p.EnterOuterAlt(localctx, 2)
|
||||
{
|
||||
p.SetState(109)
|
||||
p.SetState(114)
|
||||
p.Match(QuerySTRING)
|
||||
if p.HasError() {
|
||||
// Recognition error - abort rule
|
||||
|
@ -2227,7 +2269,7 @@ func (s *FilterValueContext) Accept(visitor antlr.ParseTreeVisitor) interface{}
|
|||
func (p *Query) FilterValue() (localctx IFilterValueContext) {
|
||||
localctx = NewFilterValueContext(p, p.GetParserRuleContext(), p.GetState())
|
||||
p.EnterRule(localctx, 18, QueryRULE_filterValue)
|
||||
p.SetState(115)
|
||||
p.SetState(120)
|
||||
p.GetErrorHandler().Sync(p)
|
||||
if p.HasError() {
|
||||
goto errorExit
|
||||
|
@ -2237,21 +2279,21 @@ func (p *Query) FilterValue() (localctx IFilterValueContext) {
|
|||
case QueryREP, QueryIN, QueryAS, QuerySELECT, QueryFROM, QueryFILTER, QueryIDENT:
|
||||
p.EnterOuterAlt(localctx, 1)
|
||||
{
|
||||
p.SetState(112)
|
||||
p.SetState(117)
|
||||
p.Ident()
|
||||
}
|
||||
|
||||
case QueryNUMBER1, QueryZERO:
|
||||
p.EnterOuterAlt(localctx, 2)
|
||||
{
|
||||
p.SetState(113)
|
||||
p.SetState(118)
|
||||
p.Number()
|
||||
}
|
||||
|
||||
case QuerySTRING:
|
||||
p.EnterOuterAlt(localctx, 3)
|
||||
{
|
||||
p.SetState(114)
|
||||
p.SetState(119)
|
||||
p.Match(QuerySTRING)
|
||||
if p.HasError() {
|
||||
// Recognition error - abort rule
|
||||
|
@ -2357,7 +2399,7 @@ func (p *Query) Number() (localctx INumberContext) {
|
|||
|
||||
p.EnterOuterAlt(localctx, 1)
|
||||
{
|
||||
p.SetState(117)
|
||||
p.SetState(122)
|
||||
_la = p.GetTokenStream().LA(1)
|
||||
|
||||
if !(_la == QueryNUMBER1 || _la == QueryZERO) {
|
||||
|
@ -2481,10 +2523,10 @@ func (p *Query) Keyword() (localctx IKeywordContext) {
|
|||
|
||||
p.EnterOuterAlt(localctx, 1)
|
||||
{
|
||||
p.SetState(119)
|
||||
p.SetState(124)
|
||||
_la = p.GetTokenStream().LA(1)
|
||||
|
||||
if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&1904) != 0) {
|
||||
if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&3808) != 0) {
|
||||
p.GetErrorHandler().RecoverInline(p)
|
||||
} else {
|
||||
p.GetErrorHandler().ReportMatch(p)
|
||||
|
@ -2593,7 +2635,7 @@ func (s *IdentContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
|||
func (p *Query) Ident() (localctx IIdentContext) {
|
||||
localctx = NewIdentContext(p, p.GetParserRuleContext(), p.GetState())
|
||||
p.EnterRule(localctx, 24, QueryRULE_ident)
|
||||
p.SetState(123)
|
||||
p.SetState(128)
|
||||
p.GetErrorHandler().Sync(p)
|
||||
if p.HasError() {
|
||||
goto errorExit
|
||||
|
@ -2603,14 +2645,14 @@ func (p *Query) Ident() (localctx IIdentContext) {
|
|||
case QueryREP, QueryIN, QueryAS, QuerySELECT, QueryFROM, QueryFILTER:
|
||||
p.EnterOuterAlt(localctx, 1)
|
||||
{
|
||||
p.SetState(121)
|
||||
p.SetState(126)
|
||||
p.Keyword()
|
||||
}
|
||||
|
||||
case QueryIDENT:
|
||||
p.EnterOuterAlt(localctx, 2)
|
||||
{
|
||||
p.SetState(122)
|
||||
p.SetState(127)
|
||||
p.Match(QueryIDENT)
|
||||
if p.HasError() {
|
||||
// Recognition error - abort rule
|
||||
|
@ -2724,7 +2766,7 @@ func (s *IdentWCContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
|||
func (p *Query) IdentWC() (localctx IIdentWCContext) {
|
||||
localctx = NewIdentWCContext(p, p.GetParserRuleContext(), p.GetState())
|
||||
p.EnterRule(localctx, 26, QueryRULE_identWC)
|
||||
p.SetState(127)
|
||||
p.SetState(132)
|
||||
p.GetErrorHandler().Sync(p)
|
||||
if p.HasError() {
|
||||
goto errorExit
|
||||
|
@ -2734,14 +2776,14 @@ func (p *Query) IdentWC() (localctx IIdentWCContext) {
|
|||
case QueryREP, QueryIN, QueryAS, QuerySELECT, QueryFROM, QueryFILTER, QueryIDENT:
|
||||
p.EnterOuterAlt(localctx, 1)
|
||||
{
|
||||
p.SetState(125)
|
||||
p.SetState(130)
|
||||
p.Ident()
|
||||
}
|
||||
|
||||
case QueryWILDCARD:
|
||||
p.EnterOuterAlt(localctx, 2)
|
||||
{
|
||||
p.SetState(126)
|
||||
p.SetState(131)
|
||||
p.Match(QueryWILDCARD)
|
||||
if p.HasError() {
|
||||
// Recognition error - abort rule
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue