forked from TrueCloudLab/frostfs-sdk-go
[#332] netmap/parser: Disallow trailing garbage
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
402d72e629
commit
1929b634a1
10 changed files with 617 additions and 340 deletions
|
@ -4,7 +4,7 @@ options {
|
||||||
tokenVocab = QueryLexer;
|
tokenVocab = QueryLexer;
|
||||||
}
|
}
|
||||||
|
|
||||||
policy: repStmt+ cbfStmt? selectStmt* filterStmt*;
|
policy: repStmt+ cbfStmt? selectStmt* filterStmt* EOF;
|
||||||
|
|
||||||
repStmt:
|
repStmt:
|
||||||
REP Count = NUMBER1 // number of object replicas
|
REP Count = NUMBER1 // number of object replicas
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -1,4 +1,4 @@
|
||||||
// Code generated from Query.g4 by ANTLR 4.9.2. DO NOT EDIT.
|
// Code generated from Query.g4 by ANTLR 4.10.1. DO NOT EDIT.
|
||||||
|
|
||||||
package parser // Query
|
package parser // Query
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Code generated from Query.g4 by ANTLR 4.9.2. DO NOT EDIT.
|
// Code generated from Query.g4 by ANTLR 4.10.1. DO NOT EDIT.
|
||||||
|
|
||||||
package parser // Query
|
package parser // Query
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
// Code generated from QueryLexer.g4 by ANTLR 4.9.2. DO NOT EDIT.
|
// Code generated from QueryLexer.g4 by ANTLR 4.10.1. DO NOT EDIT.
|
||||||
|
|
||||||
package parser
|
package parser
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"sync"
|
||||||
"unicode"
|
"unicode"
|
||||||
|
|
||||||
"github.com/antlr/antlr4/runtime/Go/antlr"
|
"github.com/antlr/antlr4/runtime/Go/antlr"
|
||||||
|
@ -11,127 +12,9 @@ import (
|
||||||
|
|
||||||
// Suppress unused import error
|
// Suppress unused import error
|
||||||
var _ = fmt.Printf
|
var _ = fmt.Printf
|
||||||
|
var _ = sync.Once{}
|
||||||
var _ = unicode.IsLetter
|
var _ = unicode.IsLetter
|
||||||
|
|
||||||
var serializedLexerAtn = []uint16{
|
|
||||||
3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 23, 200,
|
|
||||||
8, 1, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7,
|
|
||||||
9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12,
|
|
||||||
4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4,
|
|
||||||
18, 9, 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 4, 23,
|
|
||||||
9, 23, 4, 24, 9, 24, 4, 25, 9, 25, 4, 26, 9, 26, 4, 27, 9, 27, 4, 28, 9,
|
|
||||||
28, 4, 29, 9, 29, 3, 2, 3, 2, 3, 2, 3, 2, 3, 3, 3, 3, 3, 3, 3, 4, 3, 4,
|
|
||||||
3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 5, 4, 79, 10,
|
|
||||||
4, 3, 5, 3, 5, 3, 5, 3, 5, 3, 6, 3, 6, 3, 6, 3, 7, 3, 7, 3, 7, 3, 8, 3,
|
|
||||||
8, 3, 8, 3, 8, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 10, 3, 10,
|
|
||||||
3, 10, 3, 10, 3, 10, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3,
|
|
||||||
12, 3, 12, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 14, 3, 14, 3, 14, 3, 14,
|
|
||||||
3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 15, 3, 15, 3, 16, 3, 16, 3, 17, 3,
|
|
||||||
17, 3, 18, 3, 18, 3, 18, 7, 18, 139, 10, 18, 12, 18, 14, 18, 142, 11, 18,
|
|
||||||
3, 19, 3, 19, 3, 20, 3, 20, 3, 21, 3, 21, 7, 21, 150, 10, 21, 12, 21, 14,
|
|
||||||
21, 153, 11, 21, 3, 22, 3, 22, 3, 23, 3, 23, 3, 23, 7, 23, 160, 10, 23,
|
|
||||||
12, 23, 14, 23, 163, 11, 23, 3, 23, 3, 23, 3, 23, 3, 23, 7, 23, 169, 10,
|
|
||||||
23, 12, 23, 14, 23, 172, 11, 23, 3, 23, 5, 23, 175, 10, 23, 3, 24, 3, 24,
|
|
||||||
3, 24, 5, 24, 180, 10, 24, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3,
|
|
||||||
26, 3, 26, 3, 27, 3, 27, 3, 28, 3, 28, 3, 29, 6, 29, 195, 10, 29, 13, 29,
|
|
||||||
14, 29, 196, 3, 29, 3, 29, 2, 2, 30, 3, 3, 5, 4, 7, 5, 9, 6, 11, 7, 13,
|
|
||||||
8, 15, 9, 17, 10, 19, 11, 21, 12, 23, 13, 25, 14, 27, 15, 29, 16, 31, 17,
|
|
||||||
33, 18, 35, 19, 37, 2, 39, 2, 41, 20, 43, 21, 45, 22, 47, 2, 49, 2, 51,
|
|
||||||
2, 53, 2, 55, 2, 57, 23, 3, 2, 10, 3, 2, 50, 59, 5, 2, 67, 92, 97, 97,
|
|
||||||
99, 124, 3, 2, 51, 59, 11, 2, 36, 36, 41, 41, 49, 49, 94, 94, 100, 100,
|
|
||||||
104, 104, 112, 112, 116, 116, 118, 118, 5, 2, 50, 59, 67, 72, 99, 104,
|
|
||||||
5, 2, 2, 33, 41, 41, 94, 94, 5, 2, 2, 33, 36, 36, 94, 94, 5, 2, 11, 12,
|
|
||||||
15, 15, 34, 34, 2, 207, 2, 3, 3, 2, 2, 2, 2, 5, 3, 2, 2, 2, 2, 7, 3, 2,
|
|
||||||
2, 2, 2, 9, 3, 2, 2, 2, 2, 11, 3, 2, 2, 2, 2, 13, 3, 2, 2, 2, 2, 15, 3,
|
|
||||||
2, 2, 2, 2, 17, 3, 2, 2, 2, 2, 19, 3, 2, 2, 2, 2, 21, 3, 2, 2, 2, 2, 23,
|
|
||||||
3, 2, 2, 2, 2, 25, 3, 2, 2, 2, 2, 27, 3, 2, 2, 2, 2, 29, 3, 2, 2, 2, 2,
|
|
||||||
31, 3, 2, 2, 2, 2, 33, 3, 2, 2, 2, 2, 35, 3, 2, 2, 2, 2, 41, 3, 2, 2, 2,
|
|
||||||
2, 43, 3, 2, 2, 2, 2, 45, 3, 2, 2, 2, 2, 57, 3, 2, 2, 2, 3, 59, 3, 2, 2,
|
|
||||||
2, 5, 63, 3, 2, 2, 2, 7, 78, 3, 2, 2, 2, 9, 80, 3, 2, 2, 2, 11, 84, 3,
|
|
||||||
2, 2, 2, 13, 87, 3, 2, 2, 2, 15, 90, 3, 2, 2, 2, 17, 94, 3, 2, 2, 2, 19,
|
|
||||||
101, 3, 2, 2, 2, 21, 106, 3, 2, 2, 2, 23, 113, 3, 2, 2, 2, 25, 115, 3,
|
|
||||||
2, 2, 2, 27, 120, 3, 2, 2, 2, 29, 129, 3, 2, 2, 2, 31, 131, 3, 2, 2, 2,
|
|
||||||
33, 133, 3, 2, 2, 2, 35, 135, 3, 2, 2, 2, 37, 143, 3, 2, 2, 2, 39, 145,
|
|
||||||
3, 2, 2, 2, 41, 147, 3, 2, 2, 2, 43, 154, 3, 2, 2, 2, 45, 174, 3, 2, 2,
|
|
||||||
2, 47, 176, 3, 2, 2, 2, 49, 181, 3, 2, 2, 2, 51, 187, 3, 2, 2, 2, 53, 189,
|
|
||||||
3, 2, 2, 2, 55, 191, 3, 2, 2, 2, 57, 194, 3, 2, 2, 2, 59, 60, 7, 67, 2,
|
|
||||||
2, 60, 61, 7, 80, 2, 2, 61, 62, 7, 70, 2, 2, 62, 4, 3, 2, 2, 2, 63, 64,
|
|
||||||
7, 81, 2, 2, 64, 65, 7, 84, 2, 2, 65, 6, 3, 2, 2, 2, 66, 67, 7, 71, 2,
|
|
||||||
2, 67, 79, 7, 83, 2, 2, 68, 69, 7, 80, 2, 2, 69, 79, 7, 71, 2, 2, 70, 71,
|
|
||||||
7, 73, 2, 2, 71, 79, 7, 71, 2, 2, 72, 73, 7, 73, 2, 2, 73, 79, 7, 86, 2,
|
|
||||||
2, 74, 75, 7, 78, 2, 2, 75, 79, 7, 86, 2, 2, 76, 77, 7, 78, 2, 2, 77, 79,
|
|
||||||
7, 71, 2, 2, 78, 66, 3, 2, 2, 2, 78, 68, 3, 2, 2, 2, 78, 70, 3, 2, 2, 2,
|
|
||||||
78, 72, 3, 2, 2, 2, 78, 74, 3, 2, 2, 2, 78, 76, 3, 2, 2, 2, 79, 8, 3, 2,
|
|
||||||
2, 2, 80, 81, 7, 84, 2, 2, 81, 82, 7, 71, 2, 2, 82, 83, 7, 82, 2, 2, 83,
|
|
||||||
10, 3, 2, 2, 2, 84, 85, 7, 75, 2, 2, 85, 86, 7, 80, 2, 2, 86, 12, 3, 2,
|
|
||||||
2, 2, 87, 88, 7, 67, 2, 2, 88, 89, 7, 85, 2, 2, 89, 14, 3, 2, 2, 2, 90,
|
|
||||||
91, 7, 69, 2, 2, 91, 92, 7, 68, 2, 2, 92, 93, 7, 72, 2, 2, 93, 16, 3, 2,
|
|
||||||
2, 2, 94, 95, 7, 85, 2, 2, 95, 96, 7, 71, 2, 2, 96, 97, 7, 78, 2, 2, 97,
|
|
||||||
98, 7, 71, 2, 2, 98, 99, 7, 69, 2, 2, 99, 100, 7, 86, 2, 2, 100, 18, 3,
|
|
||||||
2, 2, 2, 101, 102, 7, 72, 2, 2, 102, 103, 7, 84, 2, 2, 103, 104, 7, 81,
|
|
||||||
2, 2, 104, 105, 7, 79, 2, 2, 105, 20, 3, 2, 2, 2, 106, 107, 7, 72, 2, 2,
|
|
||||||
107, 108, 7, 75, 2, 2, 108, 109, 7, 78, 2, 2, 109, 110, 7, 86, 2, 2, 110,
|
|
||||||
111, 7, 71, 2, 2, 111, 112, 7, 84, 2, 2, 112, 22, 3, 2, 2, 2, 113, 114,
|
|
||||||
7, 44, 2, 2, 114, 24, 3, 2, 2, 2, 115, 116, 7, 85, 2, 2, 116, 117, 7, 67,
|
|
||||||
2, 2, 117, 118, 7, 79, 2, 2, 118, 119, 7, 71, 2, 2, 119, 26, 3, 2, 2, 2,
|
|
||||||
120, 121, 7, 70, 2, 2, 121, 122, 7, 75, 2, 2, 122, 123, 7, 85, 2, 2, 123,
|
|
||||||
124, 7, 86, 2, 2, 124, 125, 7, 75, 2, 2, 125, 126, 7, 80, 2, 2, 126, 127,
|
|
||||||
7, 69, 2, 2, 127, 128, 7, 86, 2, 2, 128, 28, 3, 2, 2, 2, 129, 130, 7, 42,
|
|
||||||
2, 2, 130, 30, 3, 2, 2, 2, 131, 132, 7, 43, 2, 2, 132, 32, 3, 2, 2, 2,
|
|
||||||
133, 134, 7, 66, 2, 2, 134, 34, 3, 2, 2, 2, 135, 140, 5, 39, 20, 2, 136,
|
|
||||||
139, 5, 37, 19, 2, 137, 139, 5, 39, 20, 2, 138, 136, 3, 2, 2, 2, 138, 137,
|
|
||||||
3, 2, 2, 2, 139, 142, 3, 2, 2, 2, 140, 138, 3, 2, 2, 2, 140, 141, 3, 2,
|
|
||||||
2, 2, 141, 36, 3, 2, 2, 2, 142, 140, 3, 2, 2, 2, 143, 144, 9, 2, 2, 2,
|
|
||||||
144, 38, 3, 2, 2, 2, 145, 146, 9, 3, 2, 2, 146, 40, 3, 2, 2, 2, 147, 151,
|
|
||||||
9, 4, 2, 2, 148, 150, 5, 37, 19, 2, 149, 148, 3, 2, 2, 2, 150, 153, 3,
|
|
||||||
2, 2, 2, 151, 149, 3, 2, 2, 2, 151, 152, 3, 2, 2, 2, 152, 42, 3, 2, 2,
|
|
||||||
2, 153, 151, 3, 2, 2, 2, 154, 155, 7, 50, 2, 2, 155, 44, 3, 2, 2, 2, 156,
|
|
||||||
161, 7, 36, 2, 2, 157, 160, 5, 47, 24, 2, 158, 160, 5, 55, 28, 2, 159,
|
|
||||||
157, 3, 2, 2, 2, 159, 158, 3, 2, 2, 2, 160, 163, 3, 2, 2, 2, 161, 159,
|
|
||||||
3, 2, 2, 2, 161, 162, 3, 2, 2, 2, 162, 164, 3, 2, 2, 2, 163, 161, 3, 2,
|
|
||||||
2, 2, 164, 175, 7, 36, 2, 2, 165, 170, 7, 41, 2, 2, 166, 169, 5, 47, 24,
|
|
||||||
2, 167, 169, 5, 53, 27, 2, 168, 166, 3, 2, 2, 2, 168, 167, 3, 2, 2, 2,
|
|
||||||
169, 172, 3, 2, 2, 2, 170, 168, 3, 2, 2, 2, 170, 171, 3, 2, 2, 2, 171,
|
|
||||||
173, 3, 2, 2, 2, 172, 170, 3, 2, 2, 2, 173, 175, 7, 41, 2, 2, 174, 156,
|
|
||||||
3, 2, 2, 2, 174, 165, 3, 2, 2, 2, 175, 46, 3, 2, 2, 2, 176, 179, 7, 94,
|
|
||||||
2, 2, 177, 180, 9, 5, 2, 2, 178, 180, 5, 49, 25, 2, 179, 177, 3, 2, 2,
|
|
||||||
2, 179, 178, 3, 2, 2, 2, 180, 48, 3, 2, 2, 2, 181, 182, 7, 119, 2, 2, 182,
|
|
||||||
183, 5, 51, 26, 2, 183, 184, 5, 51, 26, 2, 184, 185, 5, 51, 26, 2, 185,
|
|
||||||
186, 5, 51, 26, 2, 186, 50, 3, 2, 2, 2, 187, 188, 9, 6, 2, 2, 188, 52,
|
|
||||||
3, 2, 2, 2, 189, 190, 10, 7, 2, 2, 190, 54, 3, 2, 2, 2, 191, 192, 10, 8,
|
|
||||||
2, 2, 192, 56, 3, 2, 2, 2, 193, 195, 9, 9, 2, 2, 194, 193, 3, 2, 2, 2,
|
|
||||||
195, 196, 3, 2, 2, 2, 196, 194, 3, 2, 2, 2, 196, 197, 3, 2, 2, 2, 197,
|
|
||||||
198, 3, 2, 2, 2, 198, 199, 8, 29, 2, 2, 199, 58, 3, 2, 2, 2, 14, 2, 78,
|
|
||||||
138, 140, 151, 159, 161, 168, 170, 174, 179, 196, 3, 8, 2, 2,
|
|
||||||
}
|
|
||||||
|
|
||||||
var lexerChannelNames = []string{
|
|
||||||
"DEFAULT_TOKEN_CHANNEL", "HIDDEN",
|
|
||||||
}
|
|
||||||
|
|
||||||
var lexerModeNames = []string{
|
|
||||||
"DEFAULT_MODE",
|
|
||||||
}
|
|
||||||
|
|
||||||
var lexerLiteralNames = []string{
|
|
||||||
"", "'AND'", "'OR'", "", "'REP'", "'IN'", "'AS'", "'CBF'", "'SELECT'",
|
|
||||||
"'FROM'", "'FILTER'", "'*'", "'SAME'", "'DISTINCT'", "'('", "')'", "'@'",
|
|
||||||
"", "", "'0'",
|
|
||||||
}
|
|
||||||
|
|
||||||
var lexerSymbolicNames = []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",
|
|
||||||
}
|
|
||||||
|
|
||||||
var lexerRuleNames = []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", "Digit", "Nondigit", "NUMBER1", "ZERO", "STRING", "ESC",
|
|
||||||
"UNICODE", "HEX", "SAFECODEPOINTSINGLE", "SAFECODEPOINTDOUBLE", "WS",
|
|
||||||
}
|
|
||||||
|
|
||||||
type QueryLexer struct {
|
type QueryLexer struct {
|
||||||
*antlr.BaseLexer
|
*antlr.BaseLexer
|
||||||
channelNames []string
|
channelNames []string
|
||||||
|
@ -139,28 +22,166 @@ type QueryLexer struct {
|
||||||
// TODO: EOF string
|
// TODO: EOF string
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewQueryLexer produces a new lexer instance for the optional input antlr.CharStream.
|
var querylexerLexerStaticData struct {
|
||||||
//
|
once sync.Once
|
||||||
// The *QueryLexer instance produced may be reused by calling the SetInputStream method.
|
serializedATN []int32
|
||||||
// The initial lexer configuration is expensive to construct, and the object is not thread-safe;
|
channelNames []string
|
||||||
// however, if used within a Golang sync.Pool, the construction cost amortizes well and the
|
modeNames []string
|
||||||
// objects can be used in a thread-safe manner.
|
literalNames []string
|
||||||
func NewQueryLexer(input antlr.CharStream) *QueryLexer {
|
symbolicNames []string
|
||||||
l := new(QueryLexer)
|
ruleNames []string
|
||||||
lexerDeserializer := antlr.NewATNDeserializer(nil)
|
predictionContextCache *antlr.PredictionContextCache
|
||||||
lexerAtn := lexerDeserializer.DeserializeFromUInt16(serializedLexerAtn)
|
atn *antlr.ATN
|
||||||
lexerDecisionToDFA := make([]*antlr.DFA, len(lexerAtn.DecisionToState))
|
decisionToDFA []*antlr.DFA
|
||||||
for index, ds := range lexerAtn.DecisionToState {
|
}
|
||||||
lexerDecisionToDFA[index] = antlr.NewDFA(ds, index)
|
|
||||||
}
|
|
||||||
l.BaseLexer = antlr.NewBaseLexer(input)
|
|
||||||
l.Interpreter = antlr.NewLexerATNSimulator(l, lexerAtn, lexerDecisionToDFA, antlr.NewPredictionContextCache())
|
|
||||||
|
|
||||||
l.channelNames = lexerChannelNames
|
func querylexerLexerInit() {
|
||||||
l.modeNames = lexerModeNames
|
staticData := &querylexerLexerStaticData
|
||||||
l.RuleNames = lexerRuleNames
|
staticData.channelNames = []string{
|
||||||
l.LiteralNames = lexerLiteralNames
|
"DEFAULT_TOKEN_CHANNEL", "HIDDEN",
|
||||||
l.SymbolicNames = lexerSymbolicNames
|
}
|
||||||
|
staticData.modeNames = []string{
|
||||||
|
"DEFAULT_MODE",
|
||||||
|
}
|
||||||
|
staticData.literalNames = []string{
|
||||||
|
"", "'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",
|
||||||
|
}
|
||||||
|
staticData.ruleNames = []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", "Digit", "Nondigit", "NUMBER1", "ZERO", "STRING",
|
||||||
|
"ESC", "UNICODE", "HEX", "SAFECODEPOINTSINGLE", "SAFECODEPOINTDOUBLE",
|
||||||
|
"WS",
|
||||||
|
}
|
||||||
|
staticData.predictionContextCache = antlr.NewPredictionContextCache()
|
||||||
|
staticData.serializedATN = []int32{
|
||||||
|
4, 0, 21, 198, 6, -1, 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, 2, 14, 7, 14, 2, 15,
|
||||||
|
7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7,
|
||||||
|
20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25,
|
||||||
|
2, 26, 7, 26, 2, 27, 7, 27, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1,
|
||||||
|
2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3,
|
||||||
|
2, 77, 8, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5,
|
||||||
|
1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8,
|
||||||
|
1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10,
|
||||||
|
1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1,
|
||||||
|
12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 14, 1, 14, 1, 15, 1, 15,
|
||||||
|
1, 16, 1, 16, 1, 16, 5, 16, 137, 8, 16, 10, 16, 12, 16, 140, 9, 16, 1,
|
||||||
|
17, 1, 17, 1, 18, 1, 18, 1, 19, 1, 19, 5, 19, 148, 8, 19, 10, 19, 12, 19,
|
||||||
|
151, 9, 19, 1, 20, 1, 20, 1, 21, 1, 21, 1, 21, 5, 21, 158, 8, 21, 10, 21,
|
||||||
|
12, 21, 161, 9, 21, 1, 21, 1, 21, 1, 21, 1, 21, 5, 21, 167, 8, 21, 10,
|
||||||
|
21, 12, 21, 170, 9, 21, 1, 21, 3, 21, 173, 8, 21, 1, 22, 1, 22, 1, 22,
|
||||||
|
3, 22, 178, 8, 22, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 24, 1,
|
||||||
|
24, 1, 25, 1, 25, 1, 26, 1, 26, 1, 27, 4, 27, 193, 8, 27, 11, 27, 12, 27,
|
||||||
|
194, 1, 27, 1, 27, 0, 0, 28, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7,
|
||||||
|
15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33,
|
||||||
|
17, 35, 0, 37, 0, 39, 18, 41, 19, 43, 20, 45, 0, 47, 0, 49, 0, 51, 0, 53,
|
||||||
|
0, 55, 21, 1, 0, 8, 1, 0, 48, 57, 3, 0, 65, 90, 95, 95, 97, 122, 1, 0,
|
||||||
|
49, 57, 9, 0, 34, 34, 39, 39, 47, 47, 92, 92, 98, 98, 102, 102, 110, 110,
|
||||||
|
114, 114, 116, 116, 3, 0, 48, 57, 65, 70, 97, 102, 3, 0, 0, 31, 39, 39,
|
||||||
|
92, 92, 3, 0, 0, 31, 34, 34, 92, 92, 3, 0, 9, 10, 13, 13, 32, 32, 205,
|
||||||
|
0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0,
|
||||||
|
0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0,
|
||||||
|
0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0,
|
||||||
|
0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1,
|
||||||
|
0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 39, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 43,
|
||||||
|
1, 0, 0, 0, 0, 55, 1, 0, 0, 0, 1, 57, 1, 0, 0, 0, 3, 61, 1, 0, 0, 0, 5,
|
||||||
|
76, 1, 0, 0, 0, 7, 78, 1, 0, 0, 0, 9, 82, 1, 0, 0, 0, 11, 85, 1, 0, 0,
|
||||||
|
0, 13, 88, 1, 0, 0, 0, 15, 92, 1, 0, 0, 0, 17, 99, 1, 0, 0, 0, 19, 104,
|
||||||
|
1, 0, 0, 0, 21, 111, 1, 0, 0, 0, 23, 113, 1, 0, 0, 0, 25, 118, 1, 0, 0,
|
||||||
|
0, 27, 127, 1, 0, 0, 0, 29, 129, 1, 0, 0, 0, 31, 131, 1, 0, 0, 0, 33, 133,
|
||||||
|
1, 0, 0, 0, 35, 141, 1, 0, 0, 0, 37, 143, 1, 0, 0, 0, 39, 145, 1, 0, 0,
|
||||||
|
0, 41, 152, 1, 0, 0, 0, 43, 172, 1, 0, 0, 0, 45, 174, 1, 0, 0, 0, 47, 179,
|
||||||
|
1, 0, 0, 0, 49, 185, 1, 0, 0, 0, 51, 187, 1, 0, 0, 0, 53, 189, 1, 0, 0,
|
||||||
|
0, 55, 192, 1, 0, 0, 0, 57, 58, 5, 65, 0, 0, 58, 59, 5, 78, 0, 0, 59, 60,
|
||||||
|
5, 68, 0, 0, 60, 2, 1, 0, 0, 0, 61, 62, 5, 79, 0, 0, 62, 63, 5, 82, 0,
|
||||||
|
0, 63, 4, 1, 0, 0, 0, 64, 65, 5, 69, 0, 0, 65, 77, 5, 81, 0, 0, 66, 67,
|
||||||
|
5, 78, 0, 0, 67, 77, 5, 69, 0, 0, 68, 69, 5, 71, 0, 0, 69, 77, 5, 69, 0,
|
||||||
|
0, 70, 71, 5, 71, 0, 0, 71, 77, 5, 84, 0, 0, 72, 73, 5, 76, 0, 0, 73, 77,
|
||||||
|
5, 84, 0, 0, 74, 75, 5, 76, 0, 0, 75, 77, 5, 69, 0, 0, 76, 64, 1, 0, 0,
|
||||||
|
0, 76, 66, 1, 0, 0, 0, 76, 68, 1, 0, 0, 0, 76, 70, 1, 0, 0, 0, 76, 72,
|
||||||
|
1, 0, 0, 0, 76, 74, 1, 0, 0, 0, 77, 6, 1, 0, 0, 0, 78, 79, 5, 82, 0, 0,
|
||||||
|
79, 80, 5, 69, 0, 0, 80, 81, 5, 80, 0, 0, 81, 8, 1, 0, 0, 0, 82, 83, 5,
|
||||||
|
73, 0, 0, 83, 84, 5, 78, 0, 0, 84, 10, 1, 0, 0, 0, 85, 86, 5, 65, 0, 0,
|
||||||
|
86, 87, 5, 83, 0, 0, 87, 12, 1, 0, 0, 0, 88, 89, 5, 67, 0, 0, 89, 90, 5,
|
||||||
|
66, 0, 0, 90, 91, 5, 70, 0, 0, 91, 14, 1, 0, 0, 0, 92, 93, 5, 83, 0, 0,
|
||||||
|
93, 94, 5, 69, 0, 0, 94, 95, 5, 76, 0, 0, 95, 96, 5, 69, 0, 0, 96, 97,
|
||||||
|
5, 67, 0, 0, 97, 98, 5, 84, 0, 0, 98, 16, 1, 0, 0, 0, 99, 100, 5, 70, 0,
|
||||||
|
0, 100, 101, 5, 82, 0, 0, 101, 102, 5, 79, 0, 0, 102, 103, 5, 77, 0, 0,
|
||||||
|
103, 18, 1, 0, 0, 0, 104, 105, 5, 70, 0, 0, 105, 106, 5, 73, 0, 0, 106,
|
||||||
|
107, 5, 76, 0, 0, 107, 108, 5, 84, 0, 0, 108, 109, 5, 69, 0, 0, 109, 110,
|
||||||
|
5, 82, 0, 0, 110, 20, 1, 0, 0, 0, 111, 112, 5, 42, 0, 0, 112, 22, 1, 0,
|
||||||
|
0, 0, 113, 114, 5, 83, 0, 0, 114, 115, 5, 65, 0, 0, 115, 116, 5, 77, 0,
|
||||||
|
0, 116, 117, 5, 69, 0, 0, 117, 24, 1, 0, 0, 0, 118, 119, 5, 68, 0, 0, 119,
|
||||||
|
120, 5, 73, 0, 0, 120, 121, 5, 83, 0, 0, 121, 122, 5, 84, 0, 0, 122, 123,
|
||||||
|
5, 73, 0, 0, 123, 124, 5, 78, 0, 0, 124, 125, 5, 67, 0, 0, 125, 126, 5,
|
||||||
|
84, 0, 0, 126, 26, 1, 0, 0, 0, 127, 128, 5, 40, 0, 0, 128, 28, 1, 0, 0,
|
||||||
|
0, 129, 130, 5, 41, 0, 0, 130, 30, 1, 0, 0, 0, 131, 132, 5, 64, 0, 0, 132,
|
||||||
|
32, 1, 0, 0, 0, 133, 138, 3, 37, 18, 0, 134, 137, 3, 35, 17, 0, 135, 137,
|
||||||
|
3, 37, 18, 0, 136, 134, 1, 0, 0, 0, 136, 135, 1, 0, 0, 0, 137, 140, 1,
|
||||||
|
0, 0, 0, 138, 136, 1, 0, 0, 0, 138, 139, 1, 0, 0, 0, 139, 34, 1, 0, 0,
|
||||||
|
0, 140, 138, 1, 0, 0, 0, 141, 142, 7, 0, 0, 0, 142, 36, 1, 0, 0, 0, 143,
|
||||||
|
144, 7, 1, 0, 0, 144, 38, 1, 0, 0, 0, 145, 149, 7, 2, 0, 0, 146, 148, 3,
|
||||||
|
35, 17, 0, 147, 146, 1, 0, 0, 0, 148, 151, 1, 0, 0, 0, 149, 147, 1, 0,
|
||||||
|
0, 0, 149, 150, 1, 0, 0, 0, 150, 40, 1, 0, 0, 0, 151, 149, 1, 0, 0, 0,
|
||||||
|
152, 153, 5, 48, 0, 0, 153, 42, 1, 0, 0, 0, 154, 159, 5, 34, 0, 0, 155,
|
||||||
|
158, 3, 45, 22, 0, 156, 158, 3, 53, 26, 0, 157, 155, 1, 0, 0, 0, 157, 156,
|
||||||
|
1, 0, 0, 0, 158, 161, 1, 0, 0, 0, 159, 157, 1, 0, 0, 0, 159, 160, 1, 0,
|
||||||
|
0, 0, 160, 162, 1, 0, 0, 0, 161, 159, 1, 0, 0, 0, 162, 173, 5, 34, 0, 0,
|
||||||
|
163, 168, 5, 39, 0, 0, 164, 167, 3, 45, 22, 0, 165, 167, 3, 51, 25, 0,
|
||||||
|
166, 164, 1, 0, 0, 0, 166, 165, 1, 0, 0, 0, 167, 170, 1, 0, 0, 0, 168,
|
||||||
|
166, 1, 0, 0, 0, 168, 169, 1, 0, 0, 0, 169, 171, 1, 0, 0, 0, 170, 168,
|
||||||
|
1, 0, 0, 0, 171, 173, 5, 39, 0, 0, 172, 154, 1, 0, 0, 0, 172, 163, 1, 0,
|
||||||
|
0, 0, 173, 44, 1, 0, 0, 0, 174, 177, 5, 92, 0, 0, 175, 178, 7, 3, 0, 0,
|
||||||
|
176, 178, 3, 47, 23, 0, 177, 175, 1, 0, 0, 0, 177, 176, 1, 0, 0, 0, 178,
|
||||||
|
46, 1, 0, 0, 0, 179, 180, 5, 117, 0, 0, 180, 181, 3, 49, 24, 0, 181, 182,
|
||||||
|
3, 49, 24, 0, 182, 183, 3, 49, 24, 0, 183, 184, 3, 49, 24, 0, 184, 48,
|
||||||
|
1, 0, 0, 0, 185, 186, 7, 4, 0, 0, 186, 50, 1, 0, 0, 0, 187, 188, 8, 5,
|
||||||
|
0, 0, 188, 52, 1, 0, 0, 0, 189, 190, 8, 6, 0, 0, 190, 54, 1, 0, 0, 0, 191,
|
||||||
|
193, 7, 7, 0, 0, 192, 191, 1, 0, 0, 0, 193, 194, 1, 0, 0, 0, 194, 192,
|
||||||
|
1, 0, 0, 0, 194, 195, 1, 0, 0, 0, 195, 196, 1, 0, 0, 0, 196, 197, 6, 27,
|
||||||
|
0, 0, 197, 56, 1, 0, 0, 0, 12, 0, 76, 136, 138, 149, 157, 159, 166, 168,
|
||||||
|
172, 177, 194, 1, 6, 0, 0,
|
||||||
|
}
|
||||||
|
deserializer := antlr.NewATNDeserializer(nil)
|
||||||
|
staticData.atn = deserializer.Deserialize(staticData.serializedATN)
|
||||||
|
atn := staticData.atn
|
||||||
|
staticData.decisionToDFA = make([]*antlr.DFA, len(atn.DecisionToState))
|
||||||
|
decisionToDFA := staticData.decisionToDFA
|
||||||
|
for index, state := range atn.DecisionToState {
|
||||||
|
decisionToDFA[index] = antlr.NewDFA(state, index)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// QueryLexerInit initializes any static state used to implement QueryLexer. By default the
|
||||||
|
// static state used to implement the lexer is lazily initialized during the first call to
|
||||||
|
// NewQueryLexer(). You can call this function if you wish to initialize the static state ahead
|
||||||
|
// of time.
|
||||||
|
func QueryLexerInit() {
|
||||||
|
staticData := &querylexerLexerStaticData
|
||||||
|
staticData.once.Do(querylexerLexerInit)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewQueryLexer produces a new lexer instance for the optional input antlr.CharStream.
|
||||||
|
func NewQueryLexer(input antlr.CharStream) *QueryLexer {
|
||||||
|
QueryLexerInit()
|
||||||
|
l := new(QueryLexer)
|
||||||
|
l.BaseLexer = antlr.NewBaseLexer(input)
|
||||||
|
staticData := &querylexerLexerStaticData
|
||||||
|
l.Interpreter = antlr.NewLexerATNSimulator(l, staticData.atn, staticData.decisionToDFA, staticData.predictionContextCache)
|
||||||
|
l.channelNames = staticData.channelNames
|
||||||
|
l.modeNames = staticData.modeNames
|
||||||
|
l.RuleNames = staticData.ruleNames
|
||||||
|
l.LiteralNames = staticData.literalNames
|
||||||
|
l.SymbolicNames = staticData.symbolicNames
|
||||||
l.GrammarFileName = "QueryLexer.g4"
|
l.GrammarFileName = "QueryLexer.g4"
|
||||||
// TODO: l.EOF = antlr.TokenEOF
|
// TODO: l.EOF = antlr.TokenEOF
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Code generated from Query.g4 by ANTLR 4.9.2. DO NOT EDIT.
|
// Code generated from Query.g4 by ANTLR 4.10.1. DO NOT EDIT.
|
||||||
|
|
||||||
package parser // Query
|
package parser // Query
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,4 @@
|
||||||
// Code generated from Query.g4 by ANTLR 4.9.2. DO NOT EDIT.
|
// Code generated from Query.g4 by ANTLR 4.10.1. DO NOT EDIT.
|
||||||
|
|
||||||
package parser // Query
|
package parser // Query
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@ FILTER City EQ SPB AND SSD EQ true OR City EQ SPB AND Rating GE 5 AS SPBSSD`,
|
||||||
|
|
||||||
invalidTestCases := []string{
|
invalidTestCases := []string{
|
||||||
`?REP 1`,
|
`?REP 1`,
|
||||||
|
`REP 1 trailing garbage`,
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := range invalidTestCases {
|
for i := range invalidTestCases {
|
||||||
|
|
Loading…
Reference in a new issue