frostfs-sdk-go/netmap/parser/query_lexer.go
Airat Arifullin 4f48f6c9e0 [#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
2023-06-02 17:47:20 +03:00

215 lines
10 KiB
Go

package parser
import (
"fmt"
"sync"
"unicode"
"github.com/antlr4-go/antlr/v4"
)
// Suppress unused import error
var _ = fmt.Printf
var _ = sync.Once{}
var _ = unicode.IsLetter
type QueryLexer struct {
*antlr.BaseLexer
channelNames []string
modeNames []string
// TODO: EOF string
}
var QueryLexerLexerStaticData struct {
once sync.Once
serializedATN []int32
ChannelNames []string
ModeNames []string
LiteralNames []string
SymbolicNames []string
RuleNames []string
PredictionContextCache *antlr.PredictionContextCache
atn *antlr.ATN
decisionToDFA []*antlr.DFA
}
func querylexerLexerInit() {
staticData := &QueryLexerLexerStaticData
staticData.ChannelNames = []string{
"DEFAULT_TOKEN_CHANNEL", "HIDDEN",
}
staticData.ModeNames = []string{
"DEFAULT_MODE",
}
staticData.LiteralNames = []string{
"", "'NOT'", "'AND'", "'OR'", "", "'REP'", "'IN'", "'AS'", "'CBF'",
"'SELECT'", "'FROM'", "'FILTER'", "'*'", "'SAME'", "'DISTINCT'", "'('",
"')'", "'@'", "", "", "'0'",
}
staticData.SymbolicNames = []string{
"", "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{
"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", "Digit", "Nondigit", "NUMBER1",
"ZERO", "STRING", "ESC", "UNICODE", "HEX", "SAFECODEPOINTSINGLE", "SAFECODEPOINTDOUBLE",
"WS",
}
staticData.PredictionContextCache = antlr.NewPredictionContextCache()
staticData.serializedATN = []int32{
4, 0, 22, 204, 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, 2, 28, 7, 28, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1,
1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3,
1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 83, 8, 3, 1, 4, 1, 4, 1, 4, 1,
4, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1,
8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1,
10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12,
1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1,
13, 1, 14, 1, 14, 1, 15, 1, 15, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 5, 17,
143, 8, 17, 10, 17, 12, 17, 146, 9, 17, 1, 18, 1, 18, 1, 19, 1, 19, 1,
20, 1, 20, 5, 20, 154, 8, 20, 10, 20, 12, 20, 157, 9, 20, 1, 21, 1, 21,
1, 22, 1, 22, 1, 22, 5, 22, 164, 8, 22, 10, 22, 12, 22, 167, 9, 22, 1,
22, 1, 22, 1, 22, 1, 22, 5, 22, 173, 8, 22, 10, 22, 12, 22, 176, 9, 22,
1, 22, 3, 22, 179, 8, 22, 1, 23, 1, 23, 1, 23, 3, 23, 184, 8, 23, 1, 24,
1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 25, 1, 25, 1, 26, 1, 26, 1, 27, 1,
27, 1, 28, 4, 28, 199, 8, 28, 11, 28, 12, 28, 200, 1, 28, 1, 28, 0, 0,
29, 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, 18, 37, 0, 39,
0, 41, 19, 43, 20, 45, 21, 47, 0, 49, 0, 51, 0, 53, 0, 55, 0, 57, 22, 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, 211, 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, 35, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 43, 1, 0, 0, 0, 0,
45, 1, 0, 0, 0, 0, 57, 1, 0, 0, 0, 1, 59, 1, 0, 0, 0, 3, 63, 1, 0, 0, 0,
5, 67, 1, 0, 0, 0, 7, 82, 1, 0, 0, 0, 9, 84, 1, 0, 0, 0, 11, 88, 1, 0,
0, 0, 13, 91, 1, 0, 0, 0, 15, 94, 1, 0, 0, 0, 17, 98, 1, 0, 0, 0, 19, 105,
1, 0, 0, 0, 21, 110, 1, 0, 0, 0, 23, 117, 1, 0, 0, 0, 25, 119, 1, 0, 0,
0, 27, 124, 1, 0, 0, 0, 29, 133, 1, 0, 0, 0, 31, 135, 1, 0, 0, 0, 33, 137,
1, 0, 0, 0, 35, 139, 1, 0, 0, 0, 37, 147, 1, 0, 0, 0, 39, 149, 1, 0, 0,
0, 41, 151, 1, 0, 0, 0, 43, 158, 1, 0, 0, 0, 45, 178, 1, 0, 0, 0, 47, 180,
1, 0, 0, 0, 49, 185, 1, 0, 0, 0, 51, 191, 1, 0, 0, 0, 53, 193, 1, 0, 0,
0, 55, 195, 1, 0, 0, 0, 57, 198, 1, 0, 0, 0, 59, 60, 5, 78, 0, 0, 60, 61,
5, 79, 0, 0, 61, 62, 5, 84, 0, 0, 62, 2, 1, 0, 0, 0, 63, 64, 5, 65, 0,
0, 64, 65, 5, 78, 0, 0, 65, 66, 5, 68, 0, 0, 66, 4, 1, 0, 0, 0, 67, 68,
5, 79, 0, 0, 68, 69, 5, 82, 0, 0, 69, 6, 1, 0, 0, 0, 70, 71, 5, 69, 0,
0, 71, 83, 5, 81, 0, 0, 72, 73, 5, 78, 0, 0, 73, 83, 5, 69, 0, 0, 74, 75,
5, 71, 0, 0, 75, 83, 5, 69, 0, 0, 76, 77, 5, 71, 0, 0, 77, 83, 5, 84, 0,
0, 78, 79, 5, 76, 0, 0, 79, 83, 5, 84, 0, 0, 80, 81, 5, 76, 0, 0, 81, 83,
5, 69, 0, 0, 82, 70, 1, 0, 0, 0, 82, 72, 1, 0, 0, 0, 82, 74, 1, 0, 0, 0,
82, 76, 1, 0, 0, 0, 82, 78, 1, 0, 0, 0, 82, 80, 1, 0, 0, 0, 83, 8, 1, 0,
0, 0, 84, 85, 5, 82, 0, 0, 85, 86, 5, 69, 0, 0, 86, 87, 5, 80, 0, 0, 87,
10, 1, 0, 0, 0, 88, 89, 5, 73, 0, 0, 89, 90, 5, 78, 0, 0, 90, 12, 1, 0,
0, 0, 91, 92, 5, 65, 0, 0, 92, 93, 5, 83, 0, 0, 93, 14, 1, 0, 0, 0, 94,
95, 5, 67, 0, 0, 95, 96, 5, 66, 0, 0, 96, 97, 5, 70, 0, 0, 97, 16, 1, 0,
0, 0, 98, 99, 5, 83, 0, 0, 99, 100, 5, 69, 0, 0, 100, 101, 5, 76, 0, 0,
101, 102, 5, 69, 0, 0, 102, 103, 5, 67, 0, 0, 103, 104, 5, 84, 0, 0, 104,
18, 1, 0, 0, 0, 105, 106, 5, 70, 0, 0, 106, 107, 5, 82, 0, 0, 107, 108,
5, 79, 0, 0, 108, 109, 5, 77, 0, 0, 109, 20, 1, 0, 0, 0, 110, 111, 5, 70,
0, 0, 111, 112, 5, 73, 0, 0, 112, 113, 5, 76, 0, 0, 113, 114, 5, 84, 0,
0, 114, 115, 5, 69, 0, 0, 115, 116, 5, 82, 0, 0, 116, 22, 1, 0, 0, 0, 117,
118, 5, 42, 0, 0, 118, 24, 1, 0, 0, 0, 119, 120, 5, 83, 0, 0, 120, 121,
5, 65, 0, 0, 121, 122, 5, 77, 0, 0, 122, 123, 5, 69, 0, 0, 123, 26, 1,
0, 0, 0, 124, 125, 5, 68, 0, 0, 125, 126, 5, 73, 0, 0, 126, 127, 5, 83,
0, 0, 127, 128, 5, 84, 0, 0, 128, 129, 5, 73, 0, 0, 129, 130, 5, 78, 0,
0, 130, 131, 5, 67, 0, 0, 131, 132, 5, 84, 0, 0, 132, 28, 1, 0, 0, 0, 133,
134, 5, 40, 0, 0, 134, 30, 1, 0, 0, 0, 135, 136, 5, 41, 0, 0, 136, 32,
1, 0, 0, 0, 137, 138, 5, 64, 0, 0, 138, 34, 1, 0, 0, 0, 139, 144, 3, 39,
19, 0, 140, 143, 3, 37, 18, 0, 141, 143, 3, 39, 19, 0, 142, 140, 1, 0,
0, 0, 142, 141, 1, 0, 0, 0, 143, 146, 1, 0, 0, 0, 144, 142, 1, 0, 0, 0,
144, 145, 1, 0, 0, 0, 145, 36, 1, 0, 0, 0, 146, 144, 1, 0, 0, 0, 147, 148,
7, 0, 0, 0, 148, 38, 1, 0, 0, 0, 149, 150, 7, 1, 0, 0, 150, 40, 1, 0, 0,
0, 151, 155, 7, 2, 0, 0, 152, 154, 3, 37, 18, 0, 153, 152, 1, 0, 0, 0,
154, 157, 1, 0, 0, 0, 155, 153, 1, 0, 0, 0, 155, 156, 1, 0, 0, 0, 156,
42, 1, 0, 0, 0, 157, 155, 1, 0, 0, 0, 158, 159, 5, 48, 0, 0, 159, 44, 1,
0, 0, 0, 160, 165, 5, 34, 0, 0, 161, 164, 3, 47, 23, 0, 162, 164, 3, 55,
27, 0, 163, 161, 1, 0, 0, 0, 163, 162, 1, 0, 0, 0, 164, 167, 1, 0, 0, 0,
165, 163, 1, 0, 0, 0, 165, 166, 1, 0, 0, 0, 166, 168, 1, 0, 0, 0, 167,
165, 1, 0, 0, 0, 168, 179, 5, 34, 0, 0, 169, 174, 5, 39, 0, 0, 170, 173,
3, 47, 23, 0, 171, 173, 3, 53, 26, 0, 172, 170, 1, 0, 0, 0, 172, 171, 1,
0, 0, 0, 173, 176, 1, 0, 0, 0, 174, 172, 1, 0, 0, 0, 174, 175, 1, 0, 0,
0, 175, 177, 1, 0, 0, 0, 176, 174, 1, 0, 0, 0, 177, 179, 5, 39, 0, 0, 178,
160, 1, 0, 0, 0, 178, 169, 1, 0, 0, 0, 179, 46, 1, 0, 0, 0, 180, 183, 5,
92, 0, 0, 181, 184, 7, 3, 0, 0, 182, 184, 3, 49, 24, 0, 183, 181, 1, 0,
0, 0, 183, 182, 1, 0, 0, 0, 184, 48, 1, 0, 0, 0, 185, 186, 5, 117, 0, 0,
186, 187, 3, 51, 25, 0, 187, 188, 3, 51, 25, 0, 188, 189, 3, 51, 25, 0,
189, 190, 3, 51, 25, 0, 190, 50, 1, 0, 0, 0, 191, 192, 7, 4, 0, 0, 192,
52, 1, 0, 0, 0, 193, 194, 8, 5, 0, 0, 194, 54, 1, 0, 0, 0, 195, 196, 8,
6, 0, 0, 196, 56, 1, 0, 0, 0, 197, 199, 7, 7, 0, 0, 198, 197, 1, 0, 0,
0, 199, 200, 1, 0, 0, 0, 200, 198, 1, 0, 0, 0, 200, 201, 1, 0, 0, 0, 201,
202, 1, 0, 0, 0, 202, 203, 6, 28, 0, 0, 203, 58, 1, 0, 0, 0, 12, 0, 82,
142, 144, 155, 163, 165, 172, 174, 178, 183, 200, 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"
// TODO: l.EOF = antlr.TokenEOF
return l
}
// QueryLexer tokens.
const (
QueryLexerNOT_OP = 1
QueryLexerAND_OP = 2
QueryLexerOR_OP = 3
QueryLexerSIMPLE_OP = 4
QueryLexerREP = 5
QueryLexerIN = 6
QueryLexerAS = 7
QueryLexerCBF = 8
QueryLexerSELECT = 9
QueryLexerFROM = 10
QueryLexerFILTER = 11
QueryLexerWILDCARD = 12
QueryLexerCLAUSE_SAME = 13
QueryLexerCLAUSE_DISTINCT = 14
QueryLexerL_PAREN = 15
QueryLexerR_PAREN = 16
QueryLexerAT = 17
QueryLexerIDENT = 18
QueryLexerNUMBER1 = 19
QueryLexerZERO = 20
QueryLexerSTRING = 21
QueryLexerWS = 22
)