sq/libsq/ast/internal/slq/slq_parser.go

3799 lines
86 KiB
Go
Raw Normal View History

// Code generated from SLQ.g4 by ANTLR 4.12.0. DO NOT EDIT.
2016-10-17 07:14:01 +03:00
package slq // SLQ
import (
"fmt"
"strconv"
"sync"
2016-10-17 07:14:01 +03:00
"github.com/antlr/antlr4/runtime/Go/antlr/v4"
2016-10-17 07:14:01 +03:00
)
2016-10-31 01:35:56 +03:00
// Suppress unused import errors
2016-10-17 07:14:01 +03:00
var _ = fmt.Printf
var _ = strconv.Itoa
var _ = sync.Once{}
2016-10-17 07:14:01 +03:00
type SLQParser struct {
*antlr.BaseParser
}
var slqParserStaticData struct {
once sync.Once
serializedATN []int32
literalNames []string
symbolicNames []string
ruleNames []string
predictionContextCache *antlr.PredictionContextCache
atn *antlr.ATN
decisionToDFA []*antlr.DFA
}
func slqParserInit() {
staticData := &slqParserStaticData
staticData.literalNames = []string{
"", "';'", "'*'", "'join'", "'JOIN'", "'j'", "'group'", "'GROUP'", "'g'",
"'.['", "'sum'", "'SUM'", "'avg'", "'AVG'", "'count'", "'COUNT'", "'where'",
"'WHERE'", "'||'", "'/'", "'%'", "'+'", "'-'", "'<<'", "'>>'", "'&'",
"'&&'", "'~'", "'!'", "", "", "'('", "')'", "'['", "']'", "','", "'|'",
"':'", "", "", "", "'<='", "'<'", "'>='", "'>'", "'!='", "'=='",
}
staticData.symbolicNames = []string{
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "ID", "WS", "LPAR",
"RPAR", "LBRA", "RBRA", "COMMA", "PIPE", "COLON", "NULL", "NN", "NUMBER",
"LT_EQ", "LT", "GT_EQ", "GT", "NEQ", "EQ", "NAME", "HANDLE", "STRING",
"LINECOMMENT",
}
staticData.ruleNames = []string{
"stmtList", "query", "segment", "element", "cmpr", "fn", "fnElement",
"join", "joinConstraint", "group", "selector", "selectorElement", "alias",
"handleTable", "handle", "rowRange", "fnName", "expr", "literal", "unaryOperator",
}
staticData.predictionContextCache = antlr.NewPredictionContextCache()
staticData.serializedATN = []int32{
4, 1, 50, 210, 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, 1, 0, 5, 0, 42,
8, 0, 10, 0, 12, 0, 45, 9, 0, 1, 0, 1, 0, 4, 0, 49, 8, 0, 11, 0, 12, 0,
50, 1, 0, 5, 0, 54, 8, 0, 10, 0, 12, 0, 57, 9, 0, 1, 0, 5, 0, 60, 8, 0,
10, 0, 12, 0, 63, 9, 0, 1, 1, 1, 1, 1, 1, 5, 1, 68, 8, 1, 10, 1, 12, 1,
71, 9, 1, 1, 2, 1, 2, 1, 2, 5, 2, 76, 8, 2, 10, 2, 12, 2, 79, 9, 2, 1,
3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 89, 8, 3, 1, 4, 1, 4,
1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 5, 5, 98, 8, 5, 10, 5, 12, 5, 101, 9, 5,
1, 5, 3, 5, 104, 8, 5, 1, 5, 1, 5, 1, 6, 1, 6, 3, 6, 110, 8, 6, 1, 7, 1,
7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 3, 8, 122, 8, 8, 1,
9, 1, 9, 1, 9, 1, 9, 1, 9, 5, 9, 129, 8, 9, 10, 9, 12, 9, 132, 9, 9, 1,
9, 1, 9, 1, 10, 1, 10, 3, 10, 138, 8, 10, 1, 11, 1, 11, 3, 11, 142, 8,
11, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 15, 1, 15,
1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 3, 15, 161, 8, 15, 1,
15, 1, 15, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17,
3, 17, 174, 8, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1,
17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17,
1, 17, 3, 17, 195, 8, 17, 1, 17, 1, 17, 1, 17, 1, 17, 5, 17, 201, 8, 17,
10, 17, 12, 17, 204, 9, 17, 1, 18, 1, 18, 1, 19, 1, 19, 1, 19, 0, 1, 34,
20, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34,
36, 38, 0, 10, 1, 0, 41, 46, 1, 0, 3, 5, 1, 0, 6, 8, 1, 0, 10, 17, 2, 0,
2, 2, 19, 20, 1, 0, 21, 22, 1, 0, 23, 25, 1, 0, 41, 44, 2, 0, 38, 40, 49,
49, 2, 0, 21, 22, 27, 28, 226, 0, 43, 1, 0, 0, 0, 2, 64, 1, 0, 0, 0, 4,
72, 1, 0, 0, 0, 6, 88, 1, 0, 0, 0, 8, 90, 1, 0, 0, 0, 10, 92, 1, 0, 0,
0, 12, 107, 1, 0, 0, 0, 14, 111, 1, 0, 0, 0, 16, 121, 1, 0, 0, 0, 18, 123,
1, 0, 0, 0, 20, 135, 1, 0, 0, 0, 22, 139, 1, 0, 0, 0, 24, 143, 1, 0, 0,
0, 26, 146, 1, 0, 0, 0, 28, 149, 1, 0, 0, 0, 30, 151, 1, 0, 0, 0, 32, 164,
1, 0, 0, 0, 34, 173, 1, 0, 0, 0, 36, 205, 1, 0, 0, 0, 38, 207, 1, 0, 0,
0, 40, 42, 5, 1, 0, 0, 41, 40, 1, 0, 0, 0, 42, 45, 1, 0, 0, 0, 43, 41,
1, 0, 0, 0, 43, 44, 1, 0, 0, 0, 44, 46, 1, 0, 0, 0, 45, 43, 1, 0, 0, 0,
46, 55, 3, 2, 1, 0, 47, 49, 5, 1, 0, 0, 48, 47, 1, 0, 0, 0, 49, 50, 1,
0, 0, 0, 50, 48, 1, 0, 0, 0, 50, 51, 1, 0, 0, 0, 51, 52, 1, 0, 0, 0, 52,
54, 3, 2, 1, 0, 53, 48, 1, 0, 0, 0, 54, 57, 1, 0, 0, 0, 55, 53, 1, 0, 0,
0, 55, 56, 1, 0, 0, 0, 56, 61, 1, 0, 0, 0, 57, 55, 1, 0, 0, 0, 58, 60,
5, 1, 0, 0, 59, 58, 1, 0, 0, 0, 60, 63, 1, 0, 0, 0, 61, 59, 1, 0, 0, 0,
61, 62, 1, 0, 0, 0, 62, 1, 1, 0, 0, 0, 63, 61, 1, 0, 0, 0, 64, 69, 3, 4,
2, 0, 65, 66, 5, 36, 0, 0, 66, 68, 3, 4, 2, 0, 67, 65, 1, 0, 0, 0, 68,
71, 1, 0, 0, 0, 69, 67, 1, 0, 0, 0, 69, 70, 1, 0, 0, 0, 70, 3, 1, 0, 0,
0, 71, 69, 1, 0, 0, 0, 72, 77, 3, 6, 3, 0, 73, 74, 5, 35, 0, 0, 74, 76,
3, 6, 3, 0, 75, 73, 1, 0, 0, 0, 76, 79, 1, 0, 0, 0, 77, 75, 1, 0, 0, 0,
77, 78, 1, 0, 0, 0, 78, 5, 1, 0, 0, 0, 79, 77, 1, 0, 0, 0, 80, 89, 3, 26,
13, 0, 81, 89, 3, 28, 14, 0, 82, 89, 3, 22, 11, 0, 83, 89, 3, 14, 7, 0,
84, 89, 3, 18, 9, 0, 85, 89, 3, 30, 15, 0, 86, 89, 3, 12, 6, 0, 87, 89,
3, 34, 17, 0, 88, 80, 1, 0, 0, 0, 88, 81, 1, 0, 0, 0, 88, 82, 1, 0, 0,
0, 88, 83, 1, 0, 0, 0, 88, 84, 1, 0, 0, 0, 88, 85, 1, 0, 0, 0, 88, 86,
1, 0, 0, 0, 88, 87, 1, 0, 0, 0, 89, 7, 1, 0, 0, 0, 90, 91, 7, 0, 0, 0,
91, 9, 1, 0, 0, 0, 92, 93, 3, 32, 16, 0, 93, 103, 5, 31, 0, 0, 94, 99,
3, 34, 17, 0, 95, 96, 5, 35, 0, 0, 96, 98, 3, 34, 17, 0, 97, 95, 1, 0,
0, 0, 98, 101, 1, 0, 0, 0, 99, 97, 1, 0, 0, 0, 99, 100, 1, 0, 0, 0, 100,
104, 1, 0, 0, 0, 101, 99, 1, 0, 0, 0, 102, 104, 5, 2, 0, 0, 103, 94, 1,
0, 0, 0, 103, 102, 1, 0, 0, 0, 103, 104, 1, 0, 0, 0, 104, 105, 1, 0, 0,
0, 105, 106, 5, 32, 0, 0, 106, 11, 1, 0, 0, 0, 107, 109, 3, 10, 5, 0, 108,
110, 3, 24, 12, 0, 109, 108, 1, 0, 0, 0, 109, 110, 1, 0, 0, 0, 110, 13,
1, 0, 0, 0, 111, 112, 7, 1, 0, 0, 112, 113, 5, 31, 0, 0, 113, 114, 3, 16,
8, 0, 114, 115, 5, 32, 0, 0, 115, 15, 1, 0, 0, 0, 116, 117, 3, 20, 10,
0, 117, 118, 3, 8, 4, 0, 118, 119, 3, 20, 10, 0, 119, 122, 1, 0, 0, 0,
120, 122, 3, 20, 10, 0, 121, 116, 1, 0, 0, 0, 121, 120, 1, 0, 0, 0, 122,
17, 1, 0, 0, 0, 123, 124, 7, 2, 0, 0, 124, 125, 5, 31, 0, 0, 125, 130,
3, 20, 10, 0, 126, 127, 5, 35, 0, 0, 127, 129, 3, 20, 10, 0, 128, 126,
1, 0, 0, 0, 129, 132, 1, 0, 0, 0, 130, 128, 1, 0, 0, 0, 130, 131, 1, 0,
0, 0, 131, 133, 1, 0, 0, 0, 132, 130, 1, 0, 0, 0, 133, 134, 5, 32, 0, 0,
134, 19, 1, 0, 0, 0, 135, 137, 5, 47, 0, 0, 136, 138, 5, 47, 0, 0, 137,
136, 1, 0, 0, 0, 137, 138, 1, 0, 0, 0, 138, 21, 1, 0, 0, 0, 139, 141, 3,
20, 10, 0, 140, 142, 3, 24, 12, 0, 141, 140, 1, 0, 0, 0, 141, 142, 1, 0,
0, 0, 142, 23, 1, 0, 0, 0, 143, 144, 5, 37, 0, 0, 144, 145, 5, 29, 0, 0,
145, 25, 1, 0, 0, 0, 146, 147, 5, 48, 0, 0, 147, 148, 5, 47, 0, 0, 148,
27, 1, 0, 0, 0, 149, 150, 5, 48, 0, 0, 150, 29, 1, 0, 0, 0, 151, 160, 5,
9, 0, 0, 152, 153, 5, 39, 0, 0, 153, 154, 5, 37, 0, 0, 154, 161, 5, 39,
0, 0, 155, 156, 5, 39, 0, 0, 156, 161, 5, 37, 0, 0, 157, 158, 5, 37, 0,
0, 158, 161, 5, 39, 0, 0, 159, 161, 5, 39, 0, 0, 160, 152, 1, 0, 0, 0,
160, 155, 1, 0, 0, 0, 160, 157, 1, 0, 0, 0, 160, 159, 1, 0, 0, 0, 160,
161, 1, 0, 0, 0, 161, 162, 1, 0, 0, 0, 162, 163, 5, 34, 0, 0, 163, 31,
1, 0, 0, 0, 164, 165, 7, 3, 0, 0, 165, 33, 1, 0, 0, 0, 166, 167, 6, 17,
-1, 0, 167, 174, 3, 20, 10, 0, 168, 174, 3, 36, 18, 0, 169, 170, 3, 38,
19, 0, 170, 171, 3, 34, 17, 9, 171, 174, 1, 0, 0, 0, 172, 174, 3, 10, 5,
0, 173, 166, 1, 0, 0, 0, 173, 168, 1, 0, 0, 0, 173, 169, 1, 0, 0, 0, 173,
172, 1, 0, 0, 0, 174, 202, 1, 0, 0, 0, 175, 176, 10, 8, 0, 0, 176, 177,
5, 18, 0, 0, 177, 201, 3, 34, 17, 9, 178, 179, 10, 7, 0, 0, 179, 180, 7,
4, 0, 0, 180, 201, 3, 34, 17, 8, 181, 182, 10, 6, 0, 0, 182, 183, 7, 5,
0, 0, 183, 201, 3, 34, 17, 7, 184, 185, 10, 5, 0, 0, 185, 186, 7, 6, 0,
0, 186, 201, 3, 34, 17, 6, 187, 188, 10, 4, 0, 0, 188, 189, 7, 7, 0, 0,
189, 201, 3, 34, 17, 5, 190, 194, 10, 3, 0, 0, 191, 195, 5, 46, 0, 0, 192,
195, 5, 45, 0, 0, 193, 195, 1, 0, 0, 0, 194, 191, 1, 0, 0, 0, 194, 192,
1, 0, 0, 0, 194, 193, 1, 0, 0, 0, 195, 196, 1, 0, 0, 0, 196, 201, 3, 34,
17, 4, 197, 198, 10, 2, 0, 0, 198, 199, 5, 26, 0, 0, 199, 201, 3, 34, 17,
3, 200, 175, 1, 0, 0, 0, 200, 178, 1, 0, 0, 0, 200, 181, 1, 0, 0, 0, 200,
184, 1, 0, 0, 0, 200, 187, 1, 0, 0, 0, 200, 190, 1, 0, 0, 0, 200, 197,
1, 0, 0, 0, 201, 204, 1, 0, 0, 0, 202, 200, 1, 0, 0, 0, 202, 203, 1, 0,
0, 0, 203, 35, 1, 0, 0, 0, 204, 202, 1, 0, 0, 0, 205, 206, 7, 8, 0, 0,
206, 37, 1, 0, 0, 0, 207, 208, 7, 9, 0, 0, 208, 39, 1, 0, 0, 0, 19, 43,
50, 55, 61, 69, 77, 88, 99, 103, 109, 121, 130, 137, 141, 160, 173, 194,
200, 202,
}
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)
}
}
// SLQParserInit initializes any static state used to implement SLQParser. By default the
// static state used to implement the parser is lazily initialized during the first call to
// NewSLQParser(). You can call this function if you wish to initialize the static state ahead
// of time.
func SLQParserInit() {
staticData := &slqParserStaticData
staticData.once.Do(slqParserInit)
}
// NewSLQParser produces a new parser instance for the optional input antlr.TokenStream.
2016-10-17 07:14:01 +03:00
func NewSLQParser(input antlr.TokenStream) *SLQParser {
SLQParserInit()
2016-10-17 07:14:01 +03:00
this := new(SLQParser)
this.BaseParser = antlr.NewBaseParser(input)
staticData := &slqParserStaticData
this.Interpreter = antlr.NewParserATNSimulator(this, staticData.atn, staticData.decisionToDFA, staticData.predictionContextCache)
this.RuleNames = staticData.ruleNames
this.LiteralNames = staticData.literalNames
this.SymbolicNames = staticData.symbolicNames
this.GrammarFileName = "SLQ.g4"
2016-10-17 07:14:01 +03:00
return this
}
// SLQParser tokens.
const (
SLQParserEOF = antlr.TokenEOF
SLQParserT__0 = 1
SLQParserT__1 = 2
SLQParserT__2 = 3
SLQParserT__3 = 4
2020-08-06 20:58:47 +03:00
SLQParserT__4 = 5
SLQParserT__5 = 6
SLQParserT__6 = 7
SLQParserT__7 = 8
SLQParserT__8 = 9
SLQParserT__9 = 10
SLQParserT__10 = 11
SLQParserT__11 = 12
SLQParserT__12 = 13
SLQParserT__13 = 14
SLQParserT__14 = 15
SLQParserT__15 = 16
SLQParserT__16 = 17
SLQParserT__17 = 18
SLQParserT__18 = 19
SLQParserT__19 = 20
SLQParserT__20 = 21
SLQParserT__21 = 22
SLQParserT__22 = 23
SLQParserT__23 = 24
SLQParserT__24 = 25
SLQParserT__25 = 26
SLQParserT__26 = 27
SLQParserT__27 = 28
SLQParserID = 29
SLQParserWS = 30
SLQParserLPAR = 31
SLQParserRPAR = 32
SLQParserLBRA = 33
SLQParserRBRA = 34
SLQParserCOMMA = 35
SLQParserPIPE = 36
SLQParserCOLON = 37
SLQParserNULL = 38
SLQParserNN = 39
SLQParserNUMBER = 40
SLQParserLT_EQ = 41
SLQParserLT = 42
SLQParserGT_EQ = 43
SLQParserGT = 44
SLQParserNEQ = 45
SLQParserEQ = 46
SLQParserNAME = 47
SLQParserHANDLE = 48
2020-08-06 20:58:47 +03:00
SLQParserSTRING = 49
SLQParserLINECOMMENT = 50
2016-10-17 07:14:01 +03:00
)
// SLQParser rules.
const (
SLQParserRULE_stmtList = 0
SLQParserRULE_query = 1
SLQParserRULE_segment = 2
SLQParserRULE_element = 3
SLQParserRULE_cmpr = 4
SLQParserRULE_fn = 5
SLQParserRULE_fnElement = 6
SLQParserRULE_join = 7
SLQParserRULE_joinConstraint = 8
SLQParserRULE_group = 9
SLQParserRULE_selector = 10
SLQParserRULE_selectorElement = 11
SLQParserRULE_alias = 12
SLQParserRULE_handleTable = 13
SLQParserRULE_handle = 14
SLQParserRULE_rowRange = 15
SLQParserRULE_fnName = 16
SLQParserRULE_expr = 17
SLQParserRULE_literal = 18
SLQParserRULE_unaryOperator = 19
2016-10-17 07:14:01 +03:00
)
2020-08-06 20:58:47 +03:00
// IStmtListContext is an interface to support dynamic dispatch.
type IStmtListContext interface {
antlr.ParserRuleContext
// GetParser returns the parser.
GetParser() antlr.Parser
// Getter signatures
AllQuery() []IQueryContext
Query(i int) IQueryContext
2020-08-06 20:58:47 +03:00
// IsStmtListContext differentiates from other interfaces.
IsStmtListContext()
}
type StmtListContext struct {
*antlr.BaseParserRuleContext
parser antlr.Parser
}
func NewEmptyStmtListContext() *StmtListContext {
var p = new(StmtListContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
p.RuleIndex = SLQParserRULE_stmtList
return p
}
func (*StmtListContext) IsStmtListContext() {}
func NewStmtListContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *StmtListContext {
var p = new(StmtListContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
p.parser = parser
p.RuleIndex = SLQParserRULE_stmtList
return p
}
func (s *StmtListContext) GetParser() antlr.Parser { return s.parser }
func (s *StmtListContext) AllQuery() []IQueryContext {
children := s.GetChildren()
len := 0
for _, ctx := range children {
if _, ok := ctx.(IQueryContext); ok {
len++
}
}
2020-08-06 20:58:47 +03:00
tst := make([]IQueryContext, len)
i := 0
for _, ctx := range children {
if t, ok := ctx.(IQueryContext); ok {
2020-08-06 20:58:47 +03:00
tst[i] = t.(IQueryContext)
i++
2020-08-06 20:58:47 +03:00
}
}
return tst
}
func (s *StmtListContext) Query(i int) IQueryContext {
var t antlr.RuleContext
j := 0
for _, ctx := range s.GetChildren() {
if _, ok := ctx.(IQueryContext); ok {
if j == i {
t = ctx.(antlr.RuleContext)
break
}
j++
}
}
2020-08-06 20:58:47 +03:00
if t == nil {
return nil
}
return t.(IQueryContext)
}
func (s *StmtListContext) GetRuleContext() antlr.RuleContext {
return s
}
func (s *StmtListContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
return antlr.TreesStringTree(s, ruleNames, recog)
}
func (s *StmtListContext) EnterRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(SLQListener); ok {
listenerT.EnterStmtList(s)
}
}
func (s *StmtListContext) ExitRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(SLQListener); ok {
listenerT.ExitStmtList(s)
}
}
func (s *StmtListContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
2020-08-06 20:58:47 +03:00
switch t := visitor.(type) {
case SLQVisitor:
return t.VisitStmtList(s)
default:
return t.VisitChildren(s)
}
}
func (p *SLQParser) StmtList() (localctx IStmtListContext) {
this := p
_ = this
2020-08-06 20:58:47 +03:00
localctx = NewStmtListContext(p, p.GetParserRuleContext(), p.GetState())
p.EnterRule(localctx, 0, SLQParserRULE_stmtList)
var _la int
defer func() {
p.ExitRule()
}()
defer func() {
if err := recover(); err != nil {
if v, ok := err.(antlr.RecognitionException); ok {
localctx.SetException(v)
p.GetErrorHandler().ReportError(p, v)
p.GetErrorHandler().Recover(p, v)
} else {
panic(err)
}
}
}()
var _alt int
p.EnterOuterAlt(localctx, 1)
p.SetState(43)
2020-08-06 20:58:47 +03:00
p.GetErrorHandler().Sync(p)
_la = p.GetTokenStream().LA(1)
for _la == SLQParserT__0 {
{
p.SetState(40)
2020-08-06 20:58:47 +03:00
p.Match(SLQParserT__0)
}
p.SetState(45)
2020-08-06 20:58:47 +03:00
p.GetErrorHandler().Sync(p)
_la = p.GetTokenStream().LA(1)
}
{
p.SetState(46)
2020-08-06 20:58:47 +03:00
p.Query()
}
p.SetState(55)
2020-08-06 20:58:47 +03:00
p.GetErrorHandler().Sync(p)
_alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 2, p.GetParserRuleContext())
for _alt != 2 && _alt != antlr.ATNInvalidAltNumber {
if _alt == 1 {
p.SetState(48)
2020-08-06 20:58:47 +03:00
p.GetErrorHandler().Sync(p)
_la = p.GetTokenStream().LA(1)
for ok := true; ok; ok = _la == SLQParserT__0 {
{
p.SetState(47)
2020-08-06 20:58:47 +03:00
p.Match(SLQParserT__0)
}
p.SetState(50)
2020-08-06 20:58:47 +03:00
p.GetErrorHandler().Sync(p)
_la = p.GetTokenStream().LA(1)
}
{
p.SetState(52)
2020-08-06 20:58:47 +03:00
p.Query()
}
}
p.SetState(57)
2020-08-06 20:58:47 +03:00
p.GetErrorHandler().Sync(p)
_alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 2, p.GetParserRuleContext())
}
p.SetState(61)
2020-08-06 20:58:47 +03:00
p.GetErrorHandler().Sync(p)
_la = p.GetTokenStream().LA(1)
for _la == SLQParserT__0 {
{
p.SetState(58)
2020-08-06 20:58:47 +03:00
p.Match(SLQParserT__0)
}
p.SetState(63)
2020-08-06 20:58:47 +03:00
p.GetErrorHandler().Sync(p)
_la = p.GetTokenStream().LA(1)
}
return localctx
}
2016-10-17 07:14:01 +03:00
// IQueryContext is an interface to support dynamic dispatch.
type IQueryContext interface {
antlr.ParserRuleContext
// GetParser returns the parser.
GetParser() antlr.Parser
// Getter signatures
AllSegment() []ISegmentContext
Segment(i int) ISegmentContext
AllPIPE() []antlr.TerminalNode
PIPE(i int) antlr.TerminalNode
2016-10-31 01:35:56 +03:00
// IsQueryContext differentiates from other interfaces.
IsQueryContext()
2016-10-17 07:14:01 +03:00
}
type QueryContext struct {
*antlr.BaseParserRuleContext
parser antlr.Parser
}
func NewEmptyQueryContext() *QueryContext {
var p = new(QueryContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
p.RuleIndex = SLQParserRULE_query
return p
}
2016-10-31 01:35:56 +03:00
func (*QueryContext) IsQueryContext() {}
2016-10-17 07:14:01 +03:00
func NewQueryContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *QueryContext {
var p = new(QueryContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
p.parser = parser
p.RuleIndex = SLQParserRULE_query
return p
}
func (s *QueryContext) GetParser() antlr.Parser { return s.parser }
func (s *QueryContext) AllSegment() []ISegmentContext {
children := s.GetChildren()
len := 0
for _, ctx := range children {
if _, ok := ctx.(ISegmentContext); ok {
len++
}
}
2016-10-17 07:14:01 +03:00
tst := make([]ISegmentContext, len)
i := 0
for _, ctx := range children {
if t, ok := ctx.(ISegmentContext); ok {
2016-10-17 07:14:01 +03:00
tst[i] = t.(ISegmentContext)
i++
2016-10-17 07:14:01 +03:00
}
}
return tst
}
func (s *QueryContext) Segment(i int) ISegmentContext {
var t antlr.RuleContext
j := 0
for _, ctx := range s.GetChildren() {
if _, ok := ctx.(ISegmentContext); ok {
if j == i {
t = ctx.(antlr.RuleContext)
break
}
j++
}
}
2016-10-17 07:14:01 +03:00
if t == nil {
return nil
}
return t.(ISegmentContext)
}
func (s *QueryContext) AllPIPE() []antlr.TerminalNode {
return s.GetTokens(SLQParserPIPE)
}
func (s *QueryContext) PIPE(i int) antlr.TerminalNode {
return s.GetToken(SLQParserPIPE, i)
}
func (s *QueryContext) GetRuleContext() antlr.RuleContext {
return s
}
2016-10-31 01:35:56 +03:00
func (s *QueryContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
return antlr.TreesStringTree(s, ruleNames, recog)
}
2016-10-17 07:14:01 +03:00
func (s *QueryContext) EnterRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(SLQListener); ok {
listenerT.EnterQuery(s)
}
}
func (s *QueryContext) ExitRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(SLQListener); ok {
listenerT.ExitQuery(s)
}
}
func (s *QueryContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
2016-10-17 07:14:01 +03:00
switch t := visitor.(type) {
case SLQVisitor:
return t.VisitQuery(s)
default:
return t.VisitChildren(s)
}
}
func (p *SLQParser) Query() (localctx IQueryContext) {
this := p
_ = this
2016-10-17 07:14:01 +03:00
localctx = NewQueryContext(p, p.GetParserRuleContext(), p.GetState())
2020-08-06 20:58:47 +03:00
p.EnterRule(localctx, 2, SLQParserRULE_query)
2016-10-17 07:14:01 +03:00
var _la int
defer func() {
p.ExitRule()
}()
defer func() {
if err := recover(); err != nil {
if v, ok := err.(antlr.RecognitionException); ok {
localctx.SetException(v)
p.GetErrorHandler().ReportError(p, v)
p.GetErrorHandler().Recover(p, v)
} else {
panic(err)
}
}
}()
p.EnterOuterAlt(localctx, 1)
2020-08-06 20:58:47 +03:00
{
p.SetState(64)
2020-08-06 20:58:47 +03:00
p.Segment()
}
p.SetState(69)
2016-10-17 07:14:01 +03:00
p.GetErrorHandler().Sync(p)
_la = p.GetTokenStream().LA(1)
for _la == SLQParserPIPE {
2020-08-06 20:58:47 +03:00
{
p.SetState(65)
2020-08-06 20:58:47 +03:00
p.Match(SLQParserPIPE)
}
{
p.SetState(66)
2020-08-06 20:58:47 +03:00
p.Segment()
}
2016-10-17 07:14:01 +03:00
p.SetState(71)
2016-10-17 07:14:01 +03:00
p.GetErrorHandler().Sync(p)
_la = p.GetTokenStream().LA(1)
}
return localctx
}
// ISegmentContext is an interface to support dynamic dispatch.
type ISegmentContext interface {
antlr.ParserRuleContext
// GetParser returns the parser.
GetParser() antlr.Parser
// Getter signatures
AllElement() []IElementContext
Element(i int) IElementContext
AllCOMMA() []antlr.TerminalNode
COMMA(i int) antlr.TerminalNode
2016-10-31 01:35:56 +03:00
// IsSegmentContext differentiates from other interfaces.
IsSegmentContext()
2016-10-17 07:14:01 +03:00
}
type SegmentContext struct {
*antlr.BaseParserRuleContext
parser antlr.Parser
}
func NewEmptySegmentContext() *SegmentContext {
var p = new(SegmentContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
p.RuleIndex = SLQParserRULE_segment
return p
}
2016-10-31 01:35:56 +03:00
func (*SegmentContext) IsSegmentContext() {}
2016-10-17 07:14:01 +03:00
func NewSegmentContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *SegmentContext {
var p = new(SegmentContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
p.parser = parser
p.RuleIndex = SLQParserRULE_segment
return p
}
func (s *SegmentContext) GetParser() antlr.Parser { return s.parser }
func (s *SegmentContext) AllElement() []IElementContext {
children := s.GetChildren()
len := 0
for _, ctx := range children {
if _, ok := ctx.(IElementContext); ok {
len++
}
}
2016-10-17 07:14:01 +03:00
tst := make([]IElementContext, len)
i := 0
for _, ctx := range children {
if t, ok := ctx.(IElementContext); ok {
2016-10-17 07:14:01 +03:00
tst[i] = t.(IElementContext)
i++
2016-10-17 07:14:01 +03:00
}
}
return tst
}
func (s *SegmentContext) Element(i int) IElementContext {
var t antlr.RuleContext
j := 0
for _, ctx := range s.GetChildren() {
if _, ok := ctx.(IElementContext); ok {
if j == i {
t = ctx.(antlr.RuleContext)
break
}
j++
}
}
2016-10-17 07:14:01 +03:00
if t == nil {
return nil
}
return t.(IElementContext)
}
func (s *SegmentContext) AllCOMMA() []antlr.TerminalNode {
return s.GetTokens(SLQParserCOMMA)
}
func (s *SegmentContext) COMMA(i int) antlr.TerminalNode {
return s.GetToken(SLQParserCOMMA, i)
}
func (s *SegmentContext) GetRuleContext() antlr.RuleContext {
return s
}
2016-10-31 01:35:56 +03:00
func (s *SegmentContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
return antlr.TreesStringTree(s, ruleNames, recog)
}
2016-10-17 07:14:01 +03:00
func (s *SegmentContext) EnterRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(SLQListener); ok {
listenerT.EnterSegment(s)
}
}
func (s *SegmentContext) ExitRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(SLQListener); ok {
listenerT.ExitSegment(s)
}
}
func (s *SegmentContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
2016-10-17 07:14:01 +03:00
switch t := visitor.(type) {
case SLQVisitor:
return t.VisitSegment(s)
default:
return t.VisitChildren(s)
}
}
func (p *SLQParser) Segment() (localctx ISegmentContext) {
this := p
_ = this
2016-10-17 07:14:01 +03:00
localctx = NewSegmentContext(p, p.GetParserRuleContext(), p.GetState())
2020-08-06 20:58:47 +03:00
p.EnterRule(localctx, 4, SLQParserRULE_segment)
2016-10-17 07:14:01 +03:00
var _la int
defer func() {
p.ExitRule()
}()
defer func() {
if err := recover(); err != nil {
if v, ok := err.(antlr.RecognitionException); ok {
localctx.SetException(v)
p.GetErrorHandler().ReportError(p, v)
p.GetErrorHandler().Recover(p, v)
} else {
panic(err)
}
}
}()
p.EnterOuterAlt(localctx, 1)
2020-08-06 20:58:47 +03:00
{
p.SetState(72)
2020-08-06 20:58:47 +03:00
p.Element()
}
2016-10-17 07:14:01 +03:00
p.SetState(77)
2016-10-17 07:14:01 +03:00
p.GetErrorHandler().Sync(p)
_la = p.GetTokenStream().LA(1)
for _la == SLQParserCOMMA {
2020-08-06 20:58:47 +03:00
{
p.SetState(73)
2020-08-06 20:58:47 +03:00
p.Match(SLQParserCOMMA)
}
{
p.SetState(74)
2020-08-06 20:58:47 +03:00
p.Element()
}
2016-10-17 07:14:01 +03:00
p.SetState(79)
2016-10-17 07:14:01 +03:00
p.GetErrorHandler().Sync(p)
_la = p.GetTokenStream().LA(1)
}
return localctx
}
// IElementContext is an interface to support dynamic dispatch.
type IElementContext interface {
antlr.ParserRuleContext
// GetParser returns the parser.
GetParser() antlr.Parser
// Getter signatures
HandleTable() IHandleTableContext
Handle() IHandleContext
SelectorElement() ISelectorElementContext
Join() IJoinContext
Group() IGroupContext
RowRange() IRowRangeContext
FnElement() IFnElementContext
Expr() IExprContext
2016-10-31 01:35:56 +03:00
// IsElementContext differentiates from other interfaces.
IsElementContext()
2016-10-17 07:14:01 +03:00
}
type ElementContext struct {
*antlr.BaseParserRuleContext
parser antlr.Parser
}
func NewEmptyElementContext() *ElementContext {
var p = new(ElementContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
p.RuleIndex = SLQParserRULE_element
return p
}
2016-10-31 01:35:56 +03:00
func (*ElementContext) IsElementContext() {}
2016-10-17 07:14:01 +03:00
func NewElementContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ElementContext {
var p = new(ElementContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
p.parser = parser
p.RuleIndex = SLQParserRULE_element
return p
}
func (s *ElementContext) GetParser() antlr.Parser { return s.parser }
func (s *ElementContext) HandleTable() IHandleTableContext {
var t antlr.RuleContext
for _, ctx := range s.GetChildren() {
if _, ok := ctx.(IHandleTableContext); ok {
t = ctx.(antlr.RuleContext)
break
}
}
2016-10-17 07:14:01 +03:00
if t == nil {
return nil
}
return t.(IHandleTableContext)
2016-10-17 07:14:01 +03:00
}
func (s *ElementContext) Handle() IHandleContext {
var t antlr.RuleContext
for _, ctx := range s.GetChildren() {
if _, ok := ctx.(IHandleContext); ok {
t = ctx.(antlr.RuleContext)
break
}
}
2016-10-17 07:14:01 +03:00
if t == nil {
return nil
}
return t.(IHandleContext)
2016-10-17 07:14:01 +03:00
}
func (s *ElementContext) SelectorElement() ISelectorElementContext {
var t antlr.RuleContext
for _, ctx := range s.GetChildren() {
if _, ok := ctx.(ISelectorElementContext); ok {
t = ctx.(antlr.RuleContext)
break
}
}
2016-10-17 07:14:01 +03:00
if t == nil {
return nil
}
return t.(ISelectorElementContext)
2016-10-17 07:14:01 +03:00
}
2016-10-31 01:35:56 +03:00
func (s *ElementContext) Join() IJoinContext {
var t antlr.RuleContext
for _, ctx := range s.GetChildren() {
if _, ok := ctx.(IJoinContext); ok {
t = ctx.(antlr.RuleContext)
break
}
}
2016-10-17 07:14:01 +03:00
if t == nil {
return nil
}
2016-10-31 01:35:56 +03:00
return t.(IJoinContext)
2016-10-17 07:14:01 +03:00
}
2020-08-06 20:58:47 +03:00
func (s *ElementContext) Group() IGroupContext {
var t antlr.RuleContext
for _, ctx := range s.GetChildren() {
if _, ok := ctx.(IGroupContext); ok {
t = ctx.(antlr.RuleContext)
break
}
}
2020-08-06 20:58:47 +03:00
if t == nil {
return nil
}
return t.(IGroupContext)
}
2016-10-17 07:14:01 +03:00
func (s *ElementContext) RowRange() IRowRangeContext {
var t antlr.RuleContext
for _, ctx := range s.GetChildren() {
if _, ok := ctx.(IRowRangeContext); ok {
t = ctx.(antlr.RuleContext)
break
}
}
2016-10-17 07:14:01 +03:00
if t == nil {
return nil
}
return t.(IRowRangeContext)
}
func (s *ElementContext) FnElement() IFnElementContext {
var t antlr.RuleContext
for _, ctx := range s.GetChildren() {
if _, ok := ctx.(IFnElementContext); ok {
t = ctx.(antlr.RuleContext)
break
}
}
2020-08-06 20:58:47 +03:00
if t == nil {
return nil
}
return t.(IFnElementContext)
2020-08-06 20:58:47 +03:00
}
func (s *ElementContext) Expr() IExprContext {
var t antlr.RuleContext
for _, ctx := range s.GetChildren() {
if _, ok := ctx.(IExprContext); ok {
t = ctx.(antlr.RuleContext)
break
}
}
2020-08-06 20:58:47 +03:00
if t == nil {
return nil
}
return t.(IExprContext)
}
2016-10-17 07:14:01 +03:00
func (s *ElementContext) GetRuleContext() antlr.RuleContext {
return s
}
2016-10-31 01:35:56 +03:00
func (s *ElementContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
return antlr.TreesStringTree(s, ruleNames, recog)
}
2016-10-17 07:14:01 +03:00
func (s *ElementContext) EnterRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(SLQListener); ok {
listenerT.EnterElement(s)
}
}
func (s *ElementContext) ExitRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(SLQListener); ok {
listenerT.ExitElement(s)
}
}
func (s *ElementContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
2016-10-17 07:14:01 +03:00
switch t := visitor.(type) {
case SLQVisitor:
return t.VisitElement(s)
default:
return t.VisitChildren(s)
}
}
func (p *SLQParser) Element() (localctx IElementContext) {
this := p
_ = this
2016-10-17 07:14:01 +03:00
localctx = NewElementContext(p, p.GetParserRuleContext(), p.GetState())
2020-08-06 20:58:47 +03:00
p.EnterRule(localctx, 6, SLQParserRULE_element)
2016-10-17 07:14:01 +03:00
defer func() {
p.ExitRule()
}()
defer func() {
if err := recover(); err != nil {
if v, ok := err.(antlr.RecognitionException); ok {
localctx.SetException(v)
p.GetErrorHandler().ReportError(p, v)
p.GetErrorHandler().Recover(p, v)
} else {
panic(err)
}
}
}()
p.SetState(88)
2016-10-17 07:14:01 +03:00
p.GetErrorHandler().Sync(p)
2020-08-06 20:58:47 +03:00
switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 6, p.GetParserRuleContext()) {
2016-10-17 07:14:01 +03:00
case 1:
p.EnterOuterAlt(localctx, 1)
2020-08-06 20:58:47 +03:00
{
p.SetState(80)
p.HandleTable()
2020-08-06 20:58:47 +03:00
}
2016-10-17 07:14:01 +03:00
case 2:
p.EnterOuterAlt(localctx, 2)
2020-08-06 20:58:47 +03:00
{
p.SetState(81)
p.Handle()
2020-08-06 20:58:47 +03:00
}
2016-10-17 07:14:01 +03:00
case 3:
p.EnterOuterAlt(localctx, 3)
2020-08-06 20:58:47 +03:00
{
p.SetState(82)
p.SelectorElement()
2020-08-06 20:58:47 +03:00
}
2016-10-17 07:14:01 +03:00
case 4:
p.EnterOuterAlt(localctx, 4)
2020-08-06 20:58:47 +03:00
{
p.SetState(83)
2020-08-06 20:58:47 +03:00
p.Join()
}
2016-10-17 07:14:01 +03:00
case 5:
p.EnterOuterAlt(localctx, 5)
2020-08-06 20:58:47 +03:00
{
p.SetState(84)
2020-08-06 20:58:47 +03:00
p.Group()
}
case 6:
p.EnterOuterAlt(localctx, 6)
{
p.SetState(85)
2020-08-06 20:58:47 +03:00
p.RowRange()
}
case 7:
p.EnterOuterAlt(localctx, 7)
{
p.SetState(86)
p.FnElement()
2020-08-06 20:58:47 +03:00
}
case 8:
p.EnterOuterAlt(localctx, 8)
{
p.SetState(87)
2020-08-06 20:58:47 +03:00
p.expr(0)
}
2016-10-17 07:14:01 +03:00
}
return localctx
}
// ICmprContext is an interface to support dynamic dispatch.
type ICmprContext interface {
antlr.ParserRuleContext
// GetParser returns the parser.
GetParser() antlr.Parser
// Getter signatures
LT_EQ() antlr.TerminalNode
LT() antlr.TerminalNode
GT_EQ() antlr.TerminalNode
GT() antlr.TerminalNode
EQ() antlr.TerminalNode
NEQ() antlr.TerminalNode
2016-10-31 01:35:56 +03:00
// IsCmprContext differentiates from other interfaces.
IsCmprContext()
2016-10-17 07:14:01 +03:00
}
type CmprContext struct {
*antlr.BaseParserRuleContext
parser antlr.Parser
}
func NewEmptyCmprContext() *CmprContext {
var p = new(CmprContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
p.RuleIndex = SLQParserRULE_cmpr
return p
}
2016-10-31 01:35:56 +03:00
func (*CmprContext) IsCmprContext() {}
2016-10-17 07:14:01 +03:00
func NewCmprContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CmprContext {
var p = new(CmprContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
p.parser = parser
p.RuleIndex = SLQParserRULE_cmpr
return p
}
func (s *CmprContext) GetParser() antlr.Parser { return s.parser }
func (s *CmprContext) LT_EQ() antlr.TerminalNode {
return s.GetToken(SLQParserLT_EQ, 0)
}
func (s *CmprContext) LT() antlr.TerminalNode {
return s.GetToken(SLQParserLT, 0)
}
func (s *CmprContext) GT_EQ() antlr.TerminalNode {
return s.GetToken(SLQParserGT_EQ, 0)
}
func (s *CmprContext) GT() antlr.TerminalNode {
return s.GetToken(SLQParserGT, 0)
}
func (s *CmprContext) EQ() antlr.TerminalNode {
return s.GetToken(SLQParserEQ, 0)
}
func (s *CmprContext) NEQ() antlr.TerminalNode {
return s.GetToken(SLQParserNEQ, 0)
}
func (s *CmprContext) GetRuleContext() antlr.RuleContext {
return s
}
2016-10-31 01:35:56 +03:00
func (s *CmprContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
return antlr.TreesStringTree(s, ruleNames, recog)
}
2016-10-17 07:14:01 +03:00
func (s *CmprContext) EnterRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(SLQListener); ok {
listenerT.EnterCmpr(s)
}
}
func (s *CmprContext) ExitRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(SLQListener); ok {
listenerT.ExitCmpr(s)
}
}
func (s *CmprContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
2016-10-17 07:14:01 +03:00
switch t := visitor.(type) {
case SLQVisitor:
return t.VisitCmpr(s)
default:
return t.VisitChildren(s)
}
}
func (p *SLQParser) Cmpr() (localctx ICmprContext) {
this := p
_ = this
2016-10-17 07:14:01 +03:00
localctx = NewCmprContext(p, p.GetParserRuleContext(), p.GetState())
2020-08-06 20:58:47 +03:00
p.EnterRule(localctx, 8, SLQParserRULE_cmpr)
2016-10-17 07:14:01 +03:00
var _la int
defer func() {
p.ExitRule()
}()
defer func() {
if err := recover(); err != nil {
if v, ok := err.(antlr.RecognitionException); ok {
localctx.SetException(v)
p.GetErrorHandler().ReportError(p, v)
p.GetErrorHandler().Recover(p, v)
} else {
panic(err)
}
}
}()
p.EnterOuterAlt(localctx, 1)
2020-08-06 20:58:47 +03:00
{
p.SetState(90)
2020-08-06 20:58:47 +03:00
_la = p.GetTokenStream().LA(1)
2016-10-17 07:14:01 +03:00
if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&138538465099776) != 0) {
2020-08-06 20:58:47 +03:00
p.GetErrorHandler().RecoverInline(p)
} else {
p.GetErrorHandler().ReportMatch(p)
p.Consume()
}
2016-10-17 07:14:01 +03:00
}
return localctx
}
2020-08-06 20:58:47 +03:00
// IFnContext is an interface to support dynamic dispatch.
type IFnContext interface {
2016-10-17 07:14:01 +03:00
antlr.ParserRuleContext
// GetParser returns the parser.
GetParser() antlr.Parser
// Getter signatures
FnName() IFnNameContext
LPAR() antlr.TerminalNode
RPAR() antlr.TerminalNode
AllExpr() []IExprContext
Expr(i int) IExprContext
AllCOMMA() []antlr.TerminalNode
COMMA(i int) antlr.TerminalNode
2020-08-06 20:58:47 +03:00
// IsFnContext differentiates from other interfaces.
IsFnContext()
2016-10-17 07:14:01 +03:00
}
2020-08-06 20:58:47 +03:00
type FnContext struct {
2016-10-17 07:14:01 +03:00
*antlr.BaseParserRuleContext
parser antlr.Parser
}
2020-08-06 20:58:47 +03:00
func NewEmptyFnContext() *FnContext {
var p = new(FnContext)
2016-10-17 07:14:01 +03:00
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
2020-08-06 20:58:47 +03:00
p.RuleIndex = SLQParserRULE_fn
2016-10-17 07:14:01 +03:00
return p
}
2020-08-06 20:58:47 +03:00
func (*FnContext) IsFnContext() {}
2016-10-17 07:14:01 +03:00
2020-08-06 20:58:47 +03:00
func NewFnContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *FnContext {
var p = new(FnContext)
2016-10-17 07:14:01 +03:00
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
p.parser = parser
2020-08-06 20:58:47 +03:00
p.RuleIndex = SLQParserRULE_fn
2016-10-17 07:14:01 +03:00
return p
}
2020-08-06 20:58:47 +03:00
func (s *FnContext) GetParser() antlr.Parser { return s.parser }
func (s *FnContext) FnName() IFnNameContext {
var t antlr.RuleContext
for _, ctx := range s.GetChildren() {
if _, ok := ctx.(IFnNameContext); ok {
t = ctx.(antlr.RuleContext)
break
}
}
2020-08-06 20:58:47 +03:00
if t == nil {
return nil
}
return t.(IFnNameContext)
}
func (s *FnContext) LPAR() antlr.TerminalNode {
return s.GetToken(SLQParserLPAR, 0)
}
func (s *FnContext) RPAR() antlr.TerminalNode {
return s.GetToken(SLQParserRPAR, 0)
}
2016-10-17 07:14:01 +03:00
2020-08-06 20:58:47 +03:00
func (s *FnContext) AllExpr() []IExprContext {
children := s.GetChildren()
len := 0
for _, ctx := range children {
if _, ok := ctx.(IExprContext); ok {
len++
}
}
2016-10-17 07:14:01 +03:00
tst := make([]IExprContext, len)
i := 0
for _, ctx := range children {
if t, ok := ctx.(IExprContext); ok {
2020-08-06 20:58:47 +03:00
tst[i] = t.(IExprContext)
i++
2016-10-17 07:14:01 +03:00
}
}
return tst
}
2020-08-06 20:58:47 +03:00
func (s *FnContext) Expr(i int) IExprContext {
var t antlr.RuleContext
j := 0
for _, ctx := range s.GetChildren() {
if _, ok := ctx.(IExprContext); ok {
if j == i {
t = ctx.(antlr.RuleContext)
break
}
j++
}
}
2016-10-17 07:14:01 +03:00
if t == nil {
return nil
}
2020-08-06 20:58:47 +03:00
return t.(IExprContext)
2016-10-17 07:14:01 +03:00
}
2020-08-06 20:58:47 +03:00
func (s *FnContext) AllCOMMA() []antlr.TerminalNode {
2016-10-17 07:14:01 +03:00
return s.GetTokens(SLQParserCOMMA)
}
2020-08-06 20:58:47 +03:00
func (s *FnContext) COMMA(i int) antlr.TerminalNode {
2016-10-17 07:14:01 +03:00
return s.GetToken(SLQParserCOMMA, i)
}
2020-08-06 20:58:47 +03:00
func (s *FnContext) GetRuleContext() antlr.RuleContext {
2016-10-17 07:14:01 +03:00
return s
}
2020-08-06 20:58:47 +03:00
func (s *FnContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
2016-10-31 01:35:56 +03:00
return antlr.TreesStringTree(s, ruleNames, recog)
}
2020-08-06 20:58:47 +03:00
func (s *FnContext) EnterRule(listener antlr.ParseTreeListener) {
2016-10-17 07:14:01 +03:00
if listenerT, ok := listener.(SLQListener); ok {
2020-08-06 20:58:47 +03:00
listenerT.EnterFn(s)
2016-10-17 07:14:01 +03:00
}
}
2020-08-06 20:58:47 +03:00
func (s *FnContext) ExitRule(listener antlr.ParseTreeListener) {
2016-10-17 07:14:01 +03:00
if listenerT, ok := listener.(SLQListener); ok {
2020-08-06 20:58:47 +03:00
listenerT.ExitFn(s)
2016-10-17 07:14:01 +03:00
}
}
func (s *FnContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
2016-10-17 07:14:01 +03:00
switch t := visitor.(type) {
case SLQVisitor:
2020-08-06 20:58:47 +03:00
return t.VisitFn(s)
2016-10-17 07:14:01 +03:00
default:
return t.VisitChildren(s)
}
}
2020-08-06 20:58:47 +03:00
func (p *SLQParser) Fn() (localctx IFnContext) {
this := p
_ = this
2020-08-06 20:58:47 +03:00
localctx = NewFnContext(p, p.GetParserRuleContext(), p.GetState())
p.EnterRule(localctx, 10, SLQParserRULE_fn)
2016-10-17 07:14:01 +03:00
var _la int
defer func() {
p.ExitRule()
}()
defer func() {
if err := recover(); err != nil {
if v, ok := err.(antlr.RecognitionException); ok {
localctx.SetException(v)
p.GetErrorHandler().ReportError(p, v)
p.GetErrorHandler().Recover(p, v)
} else {
panic(err)
}
}
}()
p.EnterOuterAlt(localctx, 1)
2020-08-06 20:58:47 +03:00
{
p.SetState(92)
2020-08-06 20:58:47 +03:00
p.FnName()
}
{
p.SetState(93)
2020-08-06 20:58:47 +03:00
p.Match(SLQParserLPAR)
}
p.SetState(103)
2020-08-06 20:58:47 +03:00
p.GetErrorHandler().Sync(p)
2016-10-17 07:14:01 +03:00
2020-08-06 20:58:47 +03:00
switch p.GetTokenStream().LA(1) {
case SLQParserT__9, SLQParserT__10, SLQParserT__11, SLQParserT__12, SLQParserT__13, SLQParserT__14, SLQParserT__15, SLQParserT__16, SLQParserT__20, SLQParserT__21, SLQParserT__26, SLQParserT__27, SLQParserNULL, SLQParserNN, SLQParserNUMBER, SLQParserNAME, SLQParserSTRING:
2020-08-06 20:58:47 +03:00
{
p.SetState(94)
2020-08-06 20:58:47 +03:00
p.expr(0)
}
p.SetState(99)
2016-10-17 07:14:01 +03:00
p.GetErrorHandler().Sync(p)
_la = p.GetTokenStream().LA(1)
for _la == SLQParserCOMMA {
2020-08-06 20:58:47 +03:00
{
p.SetState(95)
2020-08-06 20:58:47 +03:00
p.Match(SLQParserCOMMA)
}
{
p.SetState(96)
2020-08-06 20:58:47 +03:00
p.expr(0)
}
2016-10-17 07:14:01 +03:00
p.SetState(101)
2016-10-17 07:14:01 +03:00
p.GetErrorHandler().Sync(p)
_la = p.GetTokenStream().LA(1)
}
2020-08-06 20:58:47 +03:00
case SLQParserT__1:
{
p.SetState(102)
2020-08-06 20:58:47 +03:00
p.Match(SLQParserT__1)
}
case SLQParserRPAR:
default:
}
{
p.SetState(105)
2020-08-06 20:58:47 +03:00
p.Match(SLQParserRPAR)
2016-10-17 07:14:01 +03:00
}
return localctx
}
// IFnElementContext is an interface to support dynamic dispatch.
type IFnElementContext interface {
antlr.ParserRuleContext
// GetParser returns the parser.
GetParser() antlr.Parser
// Getter signatures
Fn() IFnContext
Alias() IAliasContext
// IsFnElementContext differentiates from other interfaces.
IsFnElementContext()
}
type FnElementContext struct {
*antlr.BaseParserRuleContext
parser antlr.Parser
}
func NewEmptyFnElementContext() *FnElementContext {
var p = new(FnElementContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
p.RuleIndex = SLQParserRULE_fnElement
return p
}
func (*FnElementContext) IsFnElementContext() {}
func NewFnElementContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *FnElementContext {
var p = new(FnElementContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
p.parser = parser
p.RuleIndex = SLQParserRULE_fnElement
return p
}
func (s *FnElementContext) GetParser() antlr.Parser { return s.parser }
func (s *FnElementContext) Fn() IFnContext {
var t antlr.RuleContext
for _, ctx := range s.GetChildren() {
if _, ok := ctx.(IFnContext); ok {
t = ctx.(antlr.RuleContext)
break
}
}
if t == nil {
return nil
}
return t.(IFnContext)
}
func (s *FnElementContext) Alias() IAliasContext {
var t antlr.RuleContext
for _, ctx := range s.GetChildren() {
if _, ok := ctx.(IAliasContext); ok {
t = ctx.(antlr.RuleContext)
break
}
}
if t == nil {
return nil
}
return t.(IAliasContext)
}
func (s *FnElementContext) GetRuleContext() antlr.RuleContext {
return s
}
func (s *FnElementContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
return antlr.TreesStringTree(s, ruleNames, recog)
}
func (s *FnElementContext) EnterRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(SLQListener); ok {
listenerT.EnterFnElement(s)
}
}
func (s *FnElementContext) ExitRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(SLQListener); ok {
listenerT.ExitFnElement(s)
}
}
func (s *FnElementContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
switch t := visitor.(type) {
case SLQVisitor:
return t.VisitFnElement(s)
default:
return t.VisitChildren(s)
}
}
func (p *SLQParser) FnElement() (localctx IFnElementContext) {
this := p
_ = this
localctx = NewFnElementContext(p, p.GetParserRuleContext(), p.GetState())
p.EnterRule(localctx, 12, SLQParserRULE_fnElement)
var _la int
defer func() {
p.ExitRule()
}()
defer func() {
if err := recover(); err != nil {
if v, ok := err.(antlr.RecognitionException); ok {
localctx.SetException(v)
p.GetErrorHandler().ReportError(p, v)
p.GetErrorHandler().Recover(p, v)
} else {
panic(err)
}
}
}()
p.EnterOuterAlt(localctx, 1)
{
p.SetState(107)
p.Fn()
}
p.SetState(109)
p.GetErrorHandler().Sync(p)
_la = p.GetTokenStream().LA(1)
if _la == SLQParserCOLON {
{
p.SetState(108)
p.Alias()
}
}
return localctx
}
2020-08-06 20:58:47 +03:00
// IJoinContext is an interface to support dynamic dispatch.
type IJoinContext interface {
2016-10-17 07:14:01 +03:00
antlr.ParserRuleContext
// GetParser returns the parser.
GetParser() antlr.Parser
// Getter signatures
LPAR() antlr.TerminalNode
JoinConstraint() IJoinConstraintContext
RPAR() antlr.TerminalNode
2020-08-06 20:58:47 +03:00
// IsJoinContext differentiates from other interfaces.
IsJoinContext()
2016-10-17 07:14:01 +03:00
}
2020-08-06 20:58:47 +03:00
type JoinContext struct {
2016-10-17 07:14:01 +03:00
*antlr.BaseParserRuleContext
parser antlr.Parser
}
2020-08-06 20:58:47 +03:00
func NewEmptyJoinContext() *JoinContext {
var p = new(JoinContext)
2016-10-17 07:14:01 +03:00
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
2020-08-06 20:58:47 +03:00
p.RuleIndex = SLQParserRULE_join
2016-10-17 07:14:01 +03:00
return p
}
2020-08-06 20:58:47 +03:00
func (*JoinContext) IsJoinContext() {}
2016-10-17 07:14:01 +03:00
2020-08-06 20:58:47 +03:00
func NewJoinContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *JoinContext {
var p = new(JoinContext)
2016-10-17 07:14:01 +03:00
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
p.parser = parser
2020-08-06 20:58:47 +03:00
p.RuleIndex = SLQParserRULE_join
2016-10-17 07:14:01 +03:00
return p
}
2020-08-06 20:58:47 +03:00
func (s *JoinContext) GetParser() antlr.Parser { return s.parser }
2016-10-17 07:14:01 +03:00
2020-08-06 20:58:47 +03:00
func (s *JoinContext) LPAR() antlr.TerminalNode {
return s.GetToken(SLQParserLPAR, 0)
}
func (s *JoinContext) JoinConstraint() IJoinConstraintContext {
var t antlr.RuleContext
for _, ctx := range s.GetChildren() {
if _, ok := ctx.(IJoinConstraintContext); ok {
t = ctx.(antlr.RuleContext)
break
}
}
2020-08-06 20:58:47 +03:00
if t == nil {
return nil
}
return t.(IJoinConstraintContext)
2016-10-17 07:14:01 +03:00
}
2020-08-06 20:58:47 +03:00
func (s *JoinContext) RPAR() antlr.TerminalNode {
return s.GetToken(SLQParserRPAR, 0)
2016-10-17 07:14:01 +03:00
}
2020-08-06 20:58:47 +03:00
func (s *JoinContext) GetRuleContext() antlr.RuleContext {
2016-10-17 07:14:01 +03:00
return s
}
2020-08-06 20:58:47 +03:00
func (s *JoinContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
2016-10-31 01:35:56 +03:00
return antlr.TreesStringTree(s, ruleNames, recog)
}
2020-08-06 20:58:47 +03:00
func (s *JoinContext) EnterRule(listener antlr.ParseTreeListener) {
2016-10-17 07:14:01 +03:00
if listenerT, ok := listener.(SLQListener); ok {
2020-08-06 20:58:47 +03:00
listenerT.EnterJoin(s)
2016-10-17 07:14:01 +03:00
}
}
2020-08-06 20:58:47 +03:00
func (s *JoinContext) ExitRule(listener antlr.ParseTreeListener) {
2016-10-17 07:14:01 +03:00
if listenerT, ok := listener.(SLQListener); ok {
2020-08-06 20:58:47 +03:00
listenerT.ExitJoin(s)
2016-10-17 07:14:01 +03:00
}
}
func (s *JoinContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
2016-10-17 07:14:01 +03:00
switch t := visitor.(type) {
case SLQVisitor:
2020-08-06 20:58:47 +03:00
return t.VisitJoin(s)
2016-10-17 07:14:01 +03:00
default:
return t.VisitChildren(s)
}
}
2020-08-06 20:58:47 +03:00
func (p *SLQParser) Join() (localctx IJoinContext) {
this := p
_ = this
2020-08-06 20:58:47 +03:00
localctx = NewJoinContext(p, p.GetParserRuleContext(), p.GetState())
p.EnterRule(localctx, 14, SLQParserRULE_join)
2016-10-17 07:14:01 +03:00
var _la int
defer func() {
p.ExitRule()
}()
defer func() {
if err := recover(); err != nil {
if v, ok := err.(antlr.RecognitionException); ok {
localctx.SetException(v)
p.GetErrorHandler().ReportError(p, v)
p.GetErrorHandler().Recover(p, v)
} else {
panic(err)
}
}
}()
p.EnterOuterAlt(localctx, 1)
2020-08-06 20:58:47 +03:00
{
p.SetState(111)
2020-08-06 20:58:47 +03:00
_la = p.GetTokenStream().LA(1)
2016-10-17 07:14:01 +03:00
if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&56) != 0) {
2020-08-06 20:58:47 +03:00
p.GetErrorHandler().RecoverInline(p)
} else {
p.GetErrorHandler().ReportMatch(p)
p.Consume()
}
}
{
p.SetState(112)
2020-08-06 20:58:47 +03:00
p.Match(SLQParserLPAR)
}
{
p.SetState(113)
2020-08-06 20:58:47 +03:00
p.JoinConstraint()
}
{
p.SetState(114)
2020-08-06 20:58:47 +03:00
p.Match(SLQParserRPAR)
2016-10-17 07:14:01 +03:00
}
return localctx
}
2020-08-06 20:58:47 +03:00
// IJoinConstraintContext is an interface to support dynamic dispatch.
type IJoinConstraintContext interface {
2016-10-17 07:14:01 +03:00
antlr.ParserRuleContext
// GetParser returns the parser.
GetParser() antlr.Parser
// Getter signatures
AllSelector() []ISelectorContext
Selector(i int) ISelectorContext
Cmpr() ICmprContext
2020-08-06 20:58:47 +03:00
// IsJoinConstraintContext differentiates from other interfaces.
IsJoinConstraintContext()
2016-10-17 07:14:01 +03:00
}
2020-08-06 20:58:47 +03:00
type JoinConstraintContext struct {
2016-10-17 07:14:01 +03:00
*antlr.BaseParserRuleContext
parser antlr.Parser
}
2020-08-06 20:58:47 +03:00
func NewEmptyJoinConstraintContext() *JoinConstraintContext {
var p = new(JoinConstraintContext)
2016-10-17 07:14:01 +03:00
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
2020-08-06 20:58:47 +03:00
p.RuleIndex = SLQParserRULE_joinConstraint
2016-10-17 07:14:01 +03:00
return p
}
2020-08-06 20:58:47 +03:00
func (*JoinConstraintContext) IsJoinConstraintContext() {}
2016-10-17 07:14:01 +03:00
2020-08-06 20:58:47 +03:00
func NewJoinConstraintContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *JoinConstraintContext {
var p = new(JoinConstraintContext)
2016-10-17 07:14:01 +03:00
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
p.parser = parser
2020-08-06 20:58:47 +03:00
p.RuleIndex = SLQParserRULE_joinConstraint
2016-10-17 07:14:01 +03:00
return p
}
2020-08-06 20:58:47 +03:00
func (s *JoinConstraintContext) GetParser() antlr.Parser { return s.parser }
2016-10-17 07:14:01 +03:00
func (s *JoinConstraintContext) AllSelector() []ISelectorContext {
children := s.GetChildren()
len := 0
for _, ctx := range children {
if _, ok := ctx.(ISelectorContext); ok {
len++
}
}
tst := make([]ISelectorContext, len)
i := 0
for _, ctx := range children {
if t, ok := ctx.(ISelectorContext); ok {
tst[i] = t.(ISelectorContext)
i++
}
}
return tst
2016-10-17 07:14:01 +03:00
}
func (s *JoinConstraintContext) Selector(i int) ISelectorContext {
var t antlr.RuleContext
j := 0
for _, ctx := range s.GetChildren() {
if _, ok := ctx.(ISelectorContext); ok {
if j == i {
t = ctx.(antlr.RuleContext)
break
}
j++
}
}
if t == nil {
return nil
}
return t.(ISelectorContext)
2020-08-06 20:58:47 +03:00
}
func (s *JoinConstraintContext) Cmpr() ICmprContext {
var t antlr.RuleContext
for _, ctx := range s.GetChildren() {
if _, ok := ctx.(ICmprContext); ok {
t = ctx.(antlr.RuleContext)
break
}
}
2016-10-17 07:14:01 +03:00
if t == nil {
return nil
}
2020-08-06 20:58:47 +03:00
return t.(ICmprContext)
2016-10-17 07:14:01 +03:00
}
2020-08-06 20:58:47 +03:00
func (s *JoinConstraintContext) GetRuleContext() antlr.RuleContext {
2016-10-17 07:14:01 +03:00
return s
}
2020-08-06 20:58:47 +03:00
func (s *JoinConstraintContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
2016-10-31 01:35:56 +03:00
return antlr.TreesStringTree(s, ruleNames, recog)
}
2020-08-06 20:58:47 +03:00
func (s *JoinConstraintContext) EnterRule(listener antlr.ParseTreeListener) {
2016-10-17 07:14:01 +03:00
if listenerT, ok := listener.(SLQListener); ok {
2020-08-06 20:58:47 +03:00
listenerT.EnterJoinConstraint(s)
2016-10-17 07:14:01 +03:00
}
}
2020-08-06 20:58:47 +03:00
func (s *JoinConstraintContext) ExitRule(listener antlr.ParseTreeListener) {
2016-10-17 07:14:01 +03:00
if listenerT, ok := listener.(SLQListener); ok {
2020-08-06 20:58:47 +03:00
listenerT.ExitJoinConstraint(s)
2016-10-17 07:14:01 +03:00
}
}
func (s *JoinConstraintContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
2016-10-17 07:14:01 +03:00
switch t := visitor.(type) {
case SLQVisitor:
2020-08-06 20:58:47 +03:00
return t.VisitJoinConstraint(s)
2016-10-17 07:14:01 +03:00
default:
return t.VisitChildren(s)
}
}
2020-08-06 20:58:47 +03:00
func (p *SLQParser) JoinConstraint() (localctx IJoinConstraintContext) {
this := p
_ = this
2020-08-06 20:58:47 +03:00
localctx = NewJoinConstraintContext(p, p.GetParserRuleContext(), p.GetState())
p.EnterRule(localctx, 16, SLQParserRULE_joinConstraint)
2016-10-17 07:14:01 +03:00
defer func() {
p.ExitRule()
}()
defer func() {
if err := recover(); err != nil {
if v, ok := err.(antlr.RecognitionException); ok {
localctx.SetException(v)
p.GetErrorHandler().ReportError(p, v)
p.GetErrorHandler().Recover(p, v)
} else {
panic(err)
}
}
}()
p.SetState(121)
2020-08-06 20:58:47 +03:00
p.GetErrorHandler().Sync(p)
switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 10, p.GetParserRuleContext()) {
2020-08-06 20:58:47 +03:00
case 1:
p.EnterOuterAlt(localctx, 1)
{
p.SetState(116)
p.Selector()
2020-08-06 20:58:47 +03:00
}
{
p.SetState(117)
2020-08-06 20:58:47 +03:00
p.Cmpr()
}
{
p.SetState(118)
p.Selector()
2020-08-06 20:58:47 +03:00
}
2016-10-17 07:14:01 +03:00
2020-08-06 20:58:47 +03:00
case 2:
p.EnterOuterAlt(localctx, 2)
{
p.SetState(120)
p.Selector()
2020-08-06 20:58:47 +03:00
}
2016-10-17 07:14:01 +03:00
2020-08-06 20:58:47 +03:00
}
2016-10-17 07:14:01 +03:00
return localctx
}
2020-08-06 20:58:47 +03:00
// IGroupContext is an interface to support dynamic dispatch.
type IGroupContext interface {
2016-10-17 07:14:01 +03:00
antlr.ParserRuleContext
// GetParser returns the parser.
GetParser() antlr.Parser
// Getter signatures
LPAR() antlr.TerminalNode
AllSelector() []ISelectorContext
Selector(i int) ISelectorContext
RPAR() antlr.TerminalNode
AllCOMMA() []antlr.TerminalNode
COMMA(i int) antlr.TerminalNode
2020-08-06 20:58:47 +03:00
// IsGroupContext differentiates from other interfaces.
IsGroupContext()
2016-10-17 07:14:01 +03:00
}
2020-08-06 20:58:47 +03:00
type GroupContext struct {
2016-10-17 07:14:01 +03:00
*antlr.BaseParserRuleContext
parser antlr.Parser
}
2020-08-06 20:58:47 +03:00
func NewEmptyGroupContext() *GroupContext {
var p = new(GroupContext)
2016-10-17 07:14:01 +03:00
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
2020-08-06 20:58:47 +03:00
p.RuleIndex = SLQParserRULE_group
2016-10-17 07:14:01 +03:00
return p
}
2020-08-06 20:58:47 +03:00
func (*GroupContext) IsGroupContext() {}
2016-10-17 07:14:01 +03:00
2020-08-06 20:58:47 +03:00
func NewGroupContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *GroupContext {
var p = new(GroupContext)
2016-10-17 07:14:01 +03:00
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
p.parser = parser
2020-08-06 20:58:47 +03:00
p.RuleIndex = SLQParserRULE_group
2016-10-17 07:14:01 +03:00
return p
}
2020-08-06 20:58:47 +03:00
func (s *GroupContext) GetParser() antlr.Parser { return s.parser }
2016-10-17 07:14:01 +03:00
2020-08-06 20:58:47 +03:00
func (s *GroupContext) LPAR() antlr.TerminalNode {
return s.GetToken(SLQParserLPAR, 0)
}
func (s *GroupContext) AllSelector() []ISelectorContext {
children := s.GetChildren()
len := 0
for _, ctx := range children {
if _, ok := ctx.(ISelectorContext); ok {
len++
}
}
tst := make([]ISelectorContext, len)
i := 0
for _, ctx := range children {
if t, ok := ctx.(ISelectorContext); ok {
tst[i] = t.(ISelectorContext)
i++
}
}
return tst
2016-10-17 07:14:01 +03:00
}
func (s *GroupContext) Selector(i int) ISelectorContext {
var t antlr.RuleContext
j := 0
for _, ctx := range s.GetChildren() {
if _, ok := ctx.(ISelectorContext); ok {
if j == i {
t = ctx.(antlr.RuleContext)
break
}
j++
}
}
if t == nil {
return nil
}
return t.(ISelectorContext)
2016-10-17 07:14:01 +03:00
}
2020-08-06 20:58:47 +03:00
func (s *GroupContext) RPAR() antlr.TerminalNode {
return s.GetToken(SLQParserRPAR, 0)
}
2016-10-17 07:14:01 +03:00
2020-08-06 20:58:47 +03:00
func (s *GroupContext) AllCOMMA() []antlr.TerminalNode {
return s.GetTokens(SLQParserCOMMA)
}
2016-10-17 07:14:01 +03:00
2020-08-06 20:58:47 +03:00
func (s *GroupContext) COMMA(i int) antlr.TerminalNode {
return s.GetToken(SLQParserCOMMA, i)
2016-10-17 07:14:01 +03:00
}
2020-08-06 20:58:47 +03:00
func (s *GroupContext) GetRuleContext() antlr.RuleContext {
2016-10-17 07:14:01 +03:00
return s
}
2020-08-06 20:58:47 +03:00
func (s *GroupContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
2016-10-31 01:35:56 +03:00
return antlr.TreesStringTree(s, ruleNames, recog)
2016-10-17 07:14:01 +03:00
}
2020-08-06 20:58:47 +03:00
func (s *GroupContext) EnterRule(listener antlr.ParseTreeListener) {
2016-10-17 07:14:01 +03:00
if listenerT, ok := listener.(SLQListener); ok {
2020-08-06 20:58:47 +03:00
listenerT.EnterGroup(s)
2016-10-17 07:14:01 +03:00
}
}
2020-08-06 20:58:47 +03:00
func (s *GroupContext) ExitRule(listener antlr.ParseTreeListener) {
2016-10-17 07:14:01 +03:00
if listenerT, ok := listener.(SLQListener); ok {
2020-08-06 20:58:47 +03:00
listenerT.ExitGroup(s)
2016-10-17 07:14:01 +03:00
}
}
func (s *GroupContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
2016-10-17 07:14:01 +03:00
switch t := visitor.(type) {
case SLQVisitor:
2020-08-06 20:58:47 +03:00
return t.VisitGroup(s)
2016-10-17 07:14:01 +03:00
default:
return t.VisitChildren(s)
}
}
2020-08-06 20:58:47 +03:00
func (p *SLQParser) Group() (localctx IGroupContext) {
this := p
_ = this
2020-08-06 20:58:47 +03:00
localctx = NewGroupContext(p, p.GetParserRuleContext(), p.GetState())
p.EnterRule(localctx, 18, SLQParserRULE_group)
2020-08-06 20:58:47 +03:00
var _la int
2016-10-17 07:14:01 +03:00
defer func() {
p.ExitRule()
}()
defer func() {
if err := recover(); err != nil {
if v, ok := err.(antlr.RecognitionException); ok {
localctx.SetException(v)
p.GetErrorHandler().ReportError(p, v)
p.GetErrorHandler().Recover(p, v)
} else {
panic(err)
}
}
}()
2020-08-06 20:58:47 +03:00
p.EnterOuterAlt(localctx, 1)
{
p.SetState(123)
2020-08-06 20:58:47 +03:00
_la = p.GetTokenStream().LA(1)
2016-10-31 01:35:56 +03:00
if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&448) != 0) {
2020-08-06 20:58:47 +03:00
p.GetErrorHandler().RecoverInline(p)
} else {
p.GetErrorHandler().ReportMatch(p)
p.Consume()
}
}
{
p.SetState(124)
2020-08-06 20:58:47 +03:00
p.Match(SLQParserLPAR)
}
{
p.SetState(125)
p.Selector()
2020-08-06 20:58:47 +03:00
}
p.SetState(130)
2020-08-06 20:58:47 +03:00
p.GetErrorHandler().Sync(p)
_la = p.GetTokenStream().LA(1)
2016-10-17 07:14:01 +03:00
2020-08-06 20:58:47 +03:00
for _la == SLQParserCOMMA {
{
p.SetState(126)
2020-08-06 20:58:47 +03:00
p.Match(SLQParserCOMMA)
}
{
p.SetState(127)
p.Selector()
2020-08-06 20:58:47 +03:00
}
2016-10-17 07:14:01 +03:00
p.SetState(132)
2020-08-06 20:58:47 +03:00
p.GetErrorHandler().Sync(p)
_la = p.GetTokenStream().LA(1)
}
{
p.SetState(133)
2020-08-06 20:58:47 +03:00
p.Match(SLQParserRPAR)
2016-10-17 07:14:01 +03:00
}
return localctx
}
// ISelectorContext is an interface to support dynamic dispatch.
type ISelectorContext interface {
antlr.ParserRuleContext
// GetParser returns the parser.
GetParser() antlr.Parser
// Getter signatures
AllNAME() []antlr.TerminalNode
NAME(i int) antlr.TerminalNode
// IsSelectorContext differentiates from other interfaces.
IsSelectorContext()
}
type SelectorContext struct {
*antlr.BaseParserRuleContext
parser antlr.Parser
}
func NewEmptySelectorContext() *SelectorContext {
var p = new(SelectorContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
p.RuleIndex = SLQParserRULE_selector
return p
}
func (*SelectorContext) IsSelectorContext() {}
func NewSelectorContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *SelectorContext {
var p = new(SelectorContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
p.parser = parser
p.RuleIndex = SLQParserRULE_selector
return p
}
func (s *SelectorContext) GetParser() antlr.Parser { return s.parser }
func (s *SelectorContext) AllNAME() []antlr.TerminalNode {
return s.GetTokens(SLQParserNAME)
}
func (s *SelectorContext) NAME(i int) antlr.TerminalNode {
return s.GetToken(SLQParserNAME, i)
}
func (s *SelectorContext) GetRuleContext() antlr.RuleContext {
return s
}
func (s *SelectorContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
return antlr.TreesStringTree(s, ruleNames, recog)
}
func (s *SelectorContext) EnterRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(SLQListener); ok {
listenerT.EnterSelector(s)
}
}
func (s *SelectorContext) ExitRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(SLQListener); ok {
listenerT.ExitSelector(s)
}
}
func (s *SelectorContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
switch t := visitor.(type) {
case SLQVisitor:
return t.VisitSelector(s)
default:
return t.VisitChildren(s)
}
}
func (p *SLQParser) Selector() (localctx ISelectorContext) {
this := p
_ = this
localctx = NewSelectorContext(p, p.GetParserRuleContext(), p.GetState())
p.EnterRule(localctx, 20, SLQParserRULE_selector)
defer func() {
p.ExitRule()
}()
defer func() {
if err := recover(); err != nil {
if v, ok := err.(antlr.RecognitionException); ok {
localctx.SetException(v)
p.GetErrorHandler().ReportError(p, v)
p.GetErrorHandler().Recover(p, v)
} else {
panic(err)
}
}
}()
p.EnterOuterAlt(localctx, 1)
{
p.SetState(135)
p.Match(SLQParserNAME)
}
p.SetState(137)
p.GetErrorHandler().Sync(p)
if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 12, p.GetParserRuleContext()) == 1 {
{
p.SetState(136)
p.Match(SLQParserNAME)
}
}
return localctx
}
// ISelectorElementContext is an interface to support dynamic dispatch.
type ISelectorElementContext interface {
2016-10-17 07:14:01 +03:00
antlr.ParserRuleContext
// GetParser returns the parser.
GetParser() antlr.Parser
// Getter signatures
Selector() ISelectorContext
Alias() IAliasContext
// IsSelectorElementContext differentiates from other interfaces.
IsSelectorElementContext()
2016-10-17 07:14:01 +03:00
}
type SelectorElementContext struct {
2016-10-17 07:14:01 +03:00
*antlr.BaseParserRuleContext
parser antlr.Parser
}
func NewEmptySelectorElementContext() *SelectorElementContext {
var p = new(SelectorElementContext)
2016-10-17 07:14:01 +03:00
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
p.RuleIndex = SLQParserRULE_selectorElement
2016-10-17 07:14:01 +03:00
return p
}
func (*SelectorElementContext) IsSelectorElementContext() {}
2016-10-17 07:14:01 +03:00
func NewSelectorElementContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *SelectorElementContext {
var p = new(SelectorElementContext)
2016-10-17 07:14:01 +03:00
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
p.parser = parser
p.RuleIndex = SLQParserRULE_selectorElement
2016-10-17 07:14:01 +03:00
return p
}
func (s *SelectorElementContext) GetParser() antlr.Parser { return s.parser }
2016-10-17 07:14:01 +03:00
func (s *SelectorElementContext) Selector() ISelectorContext {
var t antlr.RuleContext
for _, ctx := range s.GetChildren() {
if _, ok := ctx.(ISelectorContext); ok {
t = ctx.(antlr.RuleContext)
break
}
}
if t == nil {
return nil
}
return t.(ISelectorContext)
2016-10-17 07:14:01 +03:00
}
func (s *SelectorElementContext) Alias() IAliasContext {
var t antlr.RuleContext
for _, ctx := range s.GetChildren() {
if _, ok := ctx.(IAliasContext); ok {
t = ctx.(antlr.RuleContext)
break
}
}
if t == nil {
return nil
}
return t.(IAliasContext)
}
func (s *SelectorElementContext) GetRuleContext() antlr.RuleContext {
2016-10-17 07:14:01 +03:00
return s
}
func (s *SelectorElementContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
2016-10-31 01:35:56 +03:00
return antlr.TreesStringTree(s, ruleNames, recog)
}
func (s *SelectorElementContext) EnterRule(listener antlr.ParseTreeListener) {
2016-10-17 07:14:01 +03:00
if listenerT, ok := listener.(SLQListener); ok {
listenerT.EnterSelectorElement(s)
2016-10-17 07:14:01 +03:00
}
}
func (s *SelectorElementContext) ExitRule(listener antlr.ParseTreeListener) {
2016-10-17 07:14:01 +03:00
if listenerT, ok := listener.(SLQListener); ok {
listenerT.ExitSelectorElement(s)
2016-10-17 07:14:01 +03:00
}
}
func (s *SelectorElementContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
2016-10-17 07:14:01 +03:00
switch t := visitor.(type) {
case SLQVisitor:
return t.VisitSelectorElement(s)
2016-10-17 07:14:01 +03:00
default:
return t.VisitChildren(s)
}
}
func (p *SLQParser) SelectorElement() (localctx ISelectorElementContext) {
this := p
_ = this
localctx = NewSelectorElementContext(p, p.GetParserRuleContext(), p.GetState())
p.EnterRule(localctx, 22, SLQParserRULE_selectorElement)
var _la int
2016-10-17 07:14:01 +03:00
defer func() {
p.ExitRule()
}()
defer func() {
if err := recover(); err != nil {
if v, ok := err.(antlr.RecognitionException); ok {
localctx.SetException(v)
p.GetErrorHandler().ReportError(p, v)
p.GetErrorHandler().Recover(p, v)
} else {
panic(err)
}
}
}()
p.EnterOuterAlt(localctx, 1)
2020-08-06 20:58:47 +03:00
{
p.SetState(139)
p.Selector()
2020-08-06 20:58:47 +03:00
}
p.SetState(141)
p.GetErrorHandler().Sync(p)
_la = p.GetTokenStream().LA(1)
if _la == SLQParserCOLON {
{
p.SetState(140)
p.Alias()
}
}
2016-10-17 07:14:01 +03:00
return localctx
}
// IAliasContext is an interface to support dynamic dispatch.
type IAliasContext interface {
antlr.ParserRuleContext
// GetParser returns the parser.
GetParser() antlr.Parser
// Getter signatures
COLON() antlr.TerminalNode
ID() antlr.TerminalNode
// IsAliasContext differentiates from other interfaces.
IsAliasContext()
}
type AliasContext struct {
*antlr.BaseParserRuleContext
parser antlr.Parser
}
func NewEmptyAliasContext() *AliasContext {
var p = new(AliasContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
p.RuleIndex = SLQParserRULE_alias
return p
}
func (*AliasContext) IsAliasContext() {}
func NewAliasContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AliasContext {
var p = new(AliasContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
p.parser = parser
p.RuleIndex = SLQParserRULE_alias
return p
}
func (s *AliasContext) GetParser() antlr.Parser { return s.parser }
func (s *AliasContext) COLON() antlr.TerminalNode {
return s.GetToken(SLQParserCOLON, 0)
}
func (s *AliasContext) ID() antlr.TerminalNode {
return s.GetToken(SLQParserID, 0)
}
func (s *AliasContext) GetRuleContext() antlr.RuleContext {
return s
}
func (s *AliasContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
return antlr.TreesStringTree(s, ruleNames, recog)
}
func (s *AliasContext) EnterRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(SLQListener); ok {
listenerT.EnterAlias(s)
}
}
func (s *AliasContext) ExitRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(SLQListener); ok {
listenerT.ExitAlias(s)
}
}
func (s *AliasContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
switch t := visitor.(type) {
case SLQVisitor:
return t.VisitAlias(s)
default:
return t.VisitChildren(s)
}
}
func (p *SLQParser) Alias() (localctx IAliasContext) {
this := p
_ = this
localctx = NewAliasContext(p, p.GetParserRuleContext(), p.GetState())
p.EnterRule(localctx, 24, SLQParserRULE_alias)
defer func() {
p.ExitRule()
}()
defer func() {
if err := recover(); err != nil {
if v, ok := err.(antlr.RecognitionException); ok {
localctx.SetException(v)
p.GetErrorHandler().ReportError(p, v)
p.GetErrorHandler().Recover(p, v)
} else {
panic(err)
}
}
}()
p.EnterOuterAlt(localctx, 1)
{
p.SetState(143)
p.Match(SLQParserCOLON)
}
{
p.SetState(144)
p.Match(SLQParserID)
}
return localctx
}
// IHandleTableContext is an interface to support dynamic dispatch.
type IHandleTableContext interface {
2016-10-17 07:14:01 +03:00
antlr.ParserRuleContext
// GetParser returns the parser.
GetParser() antlr.Parser
// Getter signatures
HANDLE() antlr.TerminalNode
NAME() antlr.TerminalNode
// IsHandleTableContext differentiates from other interfaces.
IsHandleTableContext()
2016-10-17 07:14:01 +03:00
}
type HandleTableContext struct {
2016-10-17 07:14:01 +03:00
*antlr.BaseParserRuleContext
parser antlr.Parser
}
func NewEmptyHandleTableContext() *HandleTableContext {
var p = new(HandleTableContext)
2016-10-17 07:14:01 +03:00
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
p.RuleIndex = SLQParserRULE_handleTable
2016-10-17 07:14:01 +03:00
return p
}
func (*HandleTableContext) IsHandleTableContext() {}
2016-10-17 07:14:01 +03:00
func NewHandleTableContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *HandleTableContext {
var p = new(HandleTableContext)
2016-10-17 07:14:01 +03:00
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
p.parser = parser
p.RuleIndex = SLQParserRULE_handleTable
2016-10-17 07:14:01 +03:00
return p
}
func (s *HandleTableContext) GetParser() antlr.Parser { return s.parser }
2016-10-17 07:14:01 +03:00
func (s *HandleTableContext) HANDLE() antlr.TerminalNode {
return s.GetToken(SLQParserHANDLE, 0)
2016-10-17 07:14:01 +03:00
}
func (s *HandleTableContext) NAME() antlr.TerminalNode {
return s.GetToken(SLQParserNAME, 0)
2016-10-17 07:14:01 +03:00
}
func (s *HandleTableContext) GetRuleContext() antlr.RuleContext {
2016-10-17 07:14:01 +03:00
return s
}
func (s *HandleTableContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
2016-10-31 01:35:56 +03:00
return antlr.TreesStringTree(s, ruleNames, recog)
}
func (s *HandleTableContext) EnterRule(listener antlr.ParseTreeListener) {
2016-10-17 07:14:01 +03:00
if listenerT, ok := listener.(SLQListener); ok {
listenerT.EnterHandleTable(s)
2016-10-17 07:14:01 +03:00
}
}
func (s *HandleTableContext) ExitRule(listener antlr.ParseTreeListener) {
2016-10-17 07:14:01 +03:00
if listenerT, ok := listener.(SLQListener); ok {
listenerT.ExitHandleTable(s)
2016-10-17 07:14:01 +03:00
}
}
func (s *HandleTableContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
2016-10-17 07:14:01 +03:00
switch t := visitor.(type) {
case SLQVisitor:
return t.VisitHandleTable(s)
2016-10-17 07:14:01 +03:00
default:
return t.VisitChildren(s)
}
}
func (p *SLQParser) HandleTable() (localctx IHandleTableContext) {
this := p
_ = this
localctx = NewHandleTableContext(p, p.GetParserRuleContext(), p.GetState())
p.EnterRule(localctx, 26, SLQParserRULE_handleTable)
2016-10-17 07:14:01 +03:00
defer func() {
p.ExitRule()
}()
defer func() {
if err := recover(); err != nil {
if v, ok := err.(antlr.RecognitionException); ok {
localctx.SetException(v)
p.GetErrorHandler().ReportError(p, v)
p.GetErrorHandler().Recover(p, v)
} else {
panic(err)
}
}
}()
p.EnterOuterAlt(localctx, 1)
2020-08-06 20:58:47 +03:00
{
p.SetState(146)
p.Match(SLQParserHANDLE)
2020-08-06 20:58:47 +03:00
}
{
p.SetState(147)
p.Match(SLQParserNAME)
2020-08-06 20:58:47 +03:00
}
2016-10-17 07:14:01 +03:00
return localctx
}
// IHandleContext is an interface to support dynamic dispatch.
type IHandleContext interface {
2016-10-17 07:14:01 +03:00
antlr.ParserRuleContext
// GetParser returns the parser.
GetParser() antlr.Parser
// Getter signatures
HANDLE() antlr.TerminalNode
// IsHandleContext differentiates from other interfaces.
IsHandleContext()
2016-10-17 07:14:01 +03:00
}
type HandleContext struct {
2016-10-17 07:14:01 +03:00
*antlr.BaseParserRuleContext
parser antlr.Parser
}
func NewEmptyHandleContext() *HandleContext {
var p = new(HandleContext)
2016-10-17 07:14:01 +03:00
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
p.RuleIndex = SLQParserRULE_handle
2016-10-17 07:14:01 +03:00
return p
}
func (*HandleContext) IsHandleContext() {}
2016-10-17 07:14:01 +03:00
func NewHandleContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *HandleContext {
var p = new(HandleContext)
2016-10-17 07:14:01 +03:00
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
p.parser = parser
p.RuleIndex = SLQParserRULE_handle
2016-10-17 07:14:01 +03:00
return p
}
func (s *HandleContext) GetParser() antlr.Parser { return s.parser }
2016-10-17 07:14:01 +03:00
func (s *HandleContext) HANDLE() antlr.TerminalNode {
return s.GetToken(SLQParserHANDLE, 0)
2016-10-17 07:14:01 +03:00
}
func (s *HandleContext) GetRuleContext() antlr.RuleContext {
2016-10-17 07:14:01 +03:00
return s
}
func (s *HandleContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
2016-10-31 01:35:56 +03:00
return antlr.TreesStringTree(s, ruleNames, recog)
}
func (s *HandleContext) EnterRule(listener antlr.ParseTreeListener) {
2016-10-17 07:14:01 +03:00
if listenerT, ok := listener.(SLQListener); ok {
listenerT.EnterHandle(s)
2016-10-17 07:14:01 +03:00
}
}
func (s *HandleContext) ExitRule(listener antlr.ParseTreeListener) {
2016-10-17 07:14:01 +03:00
if listenerT, ok := listener.(SLQListener); ok {
listenerT.ExitHandle(s)
2016-10-17 07:14:01 +03:00
}
}
func (s *HandleContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
2016-10-17 07:14:01 +03:00
switch t := visitor.(type) {
case SLQVisitor:
return t.VisitHandle(s)
2016-10-17 07:14:01 +03:00
default:
return t.VisitChildren(s)
}
}
func (p *SLQParser) Handle() (localctx IHandleContext) {
this := p
_ = this
localctx = NewHandleContext(p, p.GetParserRuleContext(), p.GetState())
p.EnterRule(localctx, 28, SLQParserRULE_handle)
2016-10-17 07:14:01 +03:00
defer func() {
p.ExitRule()
}()
defer func() {
if err := recover(); err != nil {
if v, ok := err.(antlr.RecognitionException); ok {
localctx.SetException(v)
p.GetErrorHandler().ReportError(p, v)
p.GetErrorHandler().Recover(p, v)
} else {
panic(err)
}
}
}()
p.EnterOuterAlt(localctx, 1)
2020-08-06 20:58:47 +03:00
{
p.SetState(149)
p.Match(SLQParserHANDLE)
2020-08-06 20:58:47 +03:00
}
2016-10-17 07:14:01 +03:00
return localctx
}
// IRowRangeContext is an interface to support dynamic dispatch.
type IRowRangeContext interface {
antlr.ParserRuleContext
// GetParser returns the parser.
GetParser() antlr.Parser
// Getter signatures
RBRA() antlr.TerminalNode
AllNN() []antlr.TerminalNode
NN(i int) antlr.TerminalNode
COLON() antlr.TerminalNode
2016-10-31 01:35:56 +03:00
// IsRowRangeContext differentiates from other interfaces.
IsRowRangeContext()
2016-10-17 07:14:01 +03:00
}
type RowRangeContext struct {
*antlr.BaseParserRuleContext
parser antlr.Parser
}
func NewEmptyRowRangeContext() *RowRangeContext {
var p = new(RowRangeContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
p.RuleIndex = SLQParserRULE_rowRange
return p
}
2016-10-31 01:35:56 +03:00
func (*RowRangeContext) IsRowRangeContext() {}
2016-10-17 07:14:01 +03:00
func NewRowRangeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RowRangeContext {
var p = new(RowRangeContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
p.parser = parser
p.RuleIndex = SLQParserRULE_rowRange
return p
}
func (s *RowRangeContext) GetParser() antlr.Parser { return s.parser }
2020-08-06 20:58:47 +03:00
func (s *RowRangeContext) RBRA() antlr.TerminalNode {
return s.GetToken(SLQParserRBRA, 0)
}
func (s *RowRangeContext) AllNN() []antlr.TerminalNode {
return s.GetTokens(SLQParserNN)
2016-10-17 07:14:01 +03:00
}
2020-08-06 20:58:47 +03:00
func (s *RowRangeContext) NN(i int) antlr.TerminalNode {
return s.GetToken(SLQParserNN, i)
2016-10-17 07:14:01 +03:00
}
func (s *RowRangeContext) COLON() antlr.TerminalNode {
return s.GetToken(SLQParserCOLON, 0)
}
func (s *RowRangeContext) GetRuleContext() antlr.RuleContext {
return s
}
2016-10-31 01:35:56 +03:00
func (s *RowRangeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
return antlr.TreesStringTree(s, ruleNames, recog)
}
2016-10-17 07:14:01 +03:00
func (s *RowRangeContext) EnterRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(SLQListener); ok {
listenerT.EnterRowRange(s)
}
}
func (s *RowRangeContext) ExitRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(SLQListener); ok {
listenerT.ExitRowRange(s)
}
}
func (s *RowRangeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
2016-10-17 07:14:01 +03:00
switch t := visitor.(type) {
case SLQVisitor:
return t.VisitRowRange(s)
default:
return t.VisitChildren(s)
}
}
func (p *SLQParser) RowRange() (localctx IRowRangeContext) {
this := p
_ = this
2016-10-17 07:14:01 +03:00
localctx = NewRowRangeContext(p, p.GetParserRuleContext(), p.GetState())
p.EnterRule(localctx, 30, SLQParserRULE_rowRange)
2016-10-17 07:14:01 +03:00
defer func() {
p.ExitRule()
}()
defer func() {
if err := recover(); err != nil {
if v, ok := err.(antlr.RecognitionException); ok {
localctx.SetException(v)
p.GetErrorHandler().ReportError(p, v)
p.GetErrorHandler().Recover(p, v)
} else {
panic(err)
}
}
}()
p.EnterOuterAlt(localctx, 1)
2020-08-06 20:58:47 +03:00
{
p.SetState(151)
2020-08-06 20:58:47 +03:00
p.Match(SLQParserT__8)
}
p.SetState(160)
2016-10-17 07:14:01 +03:00
p.GetErrorHandler().Sync(p)
if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 14, p.GetParserRuleContext()) == 1 {
2020-08-06 20:58:47 +03:00
{
p.SetState(152)
2020-08-06 20:58:47 +03:00
p.Match(SLQParserNN)
}
{
p.SetState(153)
2020-08-06 20:58:47 +03:00
p.Match(SLQParserCOLON)
}
{
p.SetState(154)
2020-08-06 20:58:47 +03:00
p.Match(SLQParserNN)
}
2016-10-17 07:14:01 +03:00
} else if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 14, p.GetParserRuleContext()) == 2 {
2020-08-06 20:58:47 +03:00
{
p.SetState(155)
2020-08-06 20:58:47 +03:00
p.Match(SLQParserNN)
}
{
p.SetState(156)
2020-08-06 20:58:47 +03:00
p.Match(SLQParserCOLON)
}
2016-10-17 07:14:01 +03:00
} else if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 14, p.GetParserRuleContext()) == 3 {
2020-08-06 20:58:47 +03:00
{
p.SetState(157)
2020-08-06 20:58:47 +03:00
p.Match(SLQParserCOLON)
}
{
p.SetState(158)
2020-08-06 20:58:47 +03:00
p.Match(SLQParserNN)
}
2016-10-17 07:14:01 +03:00
} else if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 14, p.GetParserRuleContext()) == 4 {
2020-08-06 20:58:47 +03:00
{
p.SetState(159)
2020-08-06 20:58:47 +03:00
p.Match(SLQParserNN)
}
2016-10-17 07:14:01 +03:00
2020-08-06 20:58:47 +03:00
}
{
p.SetState(162)
2020-08-06 20:58:47 +03:00
p.Match(SLQParserRBRA)
}
2016-10-17 07:14:01 +03:00
2020-08-06 20:58:47 +03:00
return localctx
}
2016-10-17 07:14:01 +03:00
2020-08-06 20:58:47 +03:00
// IFnNameContext is an interface to support dynamic dispatch.
type IFnNameContext interface {
antlr.ParserRuleContext
2016-10-17 07:14:01 +03:00
2020-08-06 20:58:47 +03:00
// GetParser returns the parser.
GetParser() antlr.Parser
// IsFnNameContext differentiates from other interfaces.
IsFnNameContext()
}
2016-10-17 07:14:01 +03:00
2020-08-06 20:58:47 +03:00
type FnNameContext struct {
*antlr.BaseParserRuleContext
parser antlr.Parser
}
func NewEmptyFnNameContext() *FnNameContext {
var p = new(FnNameContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
p.RuleIndex = SLQParserRULE_fnName
return p
}
func (*FnNameContext) IsFnNameContext() {}
func NewFnNameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *FnNameContext {
var p = new(FnNameContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
p.parser = parser
p.RuleIndex = SLQParserRULE_fnName
return p
}
func (s *FnNameContext) GetParser() antlr.Parser { return s.parser }
func (s *FnNameContext) GetRuleContext() antlr.RuleContext {
return s
}
func (s *FnNameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
return antlr.TreesStringTree(s, ruleNames, recog)
}
func (s *FnNameContext) EnterRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(SLQListener); ok {
listenerT.EnterFnName(s)
}
}
func (s *FnNameContext) ExitRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(SLQListener); ok {
listenerT.ExitFnName(s)
}
}
2016-10-17 07:14:01 +03:00
func (s *FnNameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
2020-08-06 20:58:47 +03:00
switch t := visitor.(type) {
case SLQVisitor:
return t.VisitFnName(s)
default:
return t.VisitChildren(s)
}
}
func (p *SLQParser) FnName() (localctx IFnNameContext) {
this := p
_ = this
2020-08-06 20:58:47 +03:00
localctx = NewFnNameContext(p, p.GetParserRuleContext(), p.GetState())
p.EnterRule(localctx, 32, SLQParserRULE_fnName)
2020-08-06 20:58:47 +03:00
var _la int
defer func() {
p.ExitRule()
}()
defer func() {
if err := recover(); err != nil {
if v, ok := err.(antlr.RecognitionException); ok {
localctx.SetException(v)
p.GetErrorHandler().ReportError(p, v)
p.GetErrorHandler().Recover(p, v)
} else {
panic(err)
}
}
}()
p.EnterOuterAlt(localctx, 1)
{
p.SetState(164)
2020-08-06 20:58:47 +03:00
_la = p.GetTokenStream().LA(1)
if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&261120) != 0) {
2020-08-06 20:58:47 +03:00
p.GetErrorHandler().RecoverInline(p)
} else {
p.GetErrorHandler().ReportMatch(p)
p.Consume()
}
2016-10-17 07:14:01 +03:00
}
return localctx
}
2020-08-06 20:58:47 +03:00
// IExprContext is an interface to support dynamic dispatch.
type IExprContext interface {
antlr.ParserRuleContext
// GetParser returns the parser.
GetParser() antlr.Parser
// Getter signatures
Selector() ISelectorContext
Literal() ILiteralContext
UnaryOperator() IUnaryOperatorContext
AllExpr() []IExprContext
Expr(i int) IExprContext
Fn() IFnContext
LT() antlr.TerminalNode
LT_EQ() antlr.TerminalNode
GT() antlr.TerminalNode
GT_EQ() antlr.TerminalNode
EQ() antlr.TerminalNode
NEQ() antlr.TerminalNode
2020-08-06 20:58:47 +03:00
// IsExprContext differentiates from other interfaces.
IsExprContext()
}
type ExprContext struct {
*antlr.BaseParserRuleContext
parser antlr.Parser
}
func NewEmptyExprContext() *ExprContext {
var p = new(ExprContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
p.RuleIndex = SLQParserRULE_expr
return p
}
func (*ExprContext) IsExprContext() {}
func NewExprContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ExprContext {
var p = new(ExprContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
p.parser = parser
p.RuleIndex = SLQParserRULE_expr
return p
}
func (s *ExprContext) GetParser() antlr.Parser { return s.parser }
func (s *ExprContext) Selector() ISelectorContext {
var t antlr.RuleContext
for _, ctx := range s.GetChildren() {
if _, ok := ctx.(ISelectorContext); ok {
t = ctx.(antlr.RuleContext)
break
}
}
if t == nil {
return nil
}
return t.(ISelectorContext)
2020-08-06 20:58:47 +03:00
}
func (s *ExprContext) Literal() ILiteralContext {
var t antlr.RuleContext
for _, ctx := range s.GetChildren() {
if _, ok := ctx.(ILiteralContext); ok {
t = ctx.(antlr.RuleContext)
break
}
}
2020-08-06 20:58:47 +03:00
if t == nil {
return nil
}
return t.(ILiteralContext)
}
func (s *ExprContext) UnaryOperator() IUnaryOperatorContext {
var t antlr.RuleContext
for _, ctx := range s.GetChildren() {
if _, ok := ctx.(IUnaryOperatorContext); ok {
t = ctx.(antlr.RuleContext)
break
}
}
2020-08-06 20:58:47 +03:00
if t == nil {
return nil
}
return t.(IUnaryOperatorContext)
}
func (s *ExprContext) AllExpr() []IExprContext {
children := s.GetChildren()
len := 0
for _, ctx := range children {
if _, ok := ctx.(IExprContext); ok {
len++
}
}
2020-08-06 20:58:47 +03:00
tst := make([]IExprContext, len)
i := 0
for _, ctx := range children {
if t, ok := ctx.(IExprContext); ok {
2020-08-06 20:58:47 +03:00
tst[i] = t.(IExprContext)
i++
2020-08-06 20:58:47 +03:00
}
}
return tst
}
func (s *ExprContext) Expr(i int) IExprContext {
var t antlr.RuleContext
j := 0
for _, ctx := range s.GetChildren() {
if _, ok := ctx.(IExprContext); ok {
if j == i {
t = ctx.(antlr.RuleContext)
break
}
j++
}
}
2020-08-06 20:58:47 +03:00
if t == nil {
return nil
}
return t.(IExprContext)
}
func (s *ExprContext) Fn() IFnContext {
var t antlr.RuleContext
for _, ctx := range s.GetChildren() {
if _, ok := ctx.(IFnContext); ok {
t = ctx.(antlr.RuleContext)
break
}
}
2020-08-06 20:58:47 +03:00
if t == nil {
return nil
}
return t.(IFnContext)
}
func (s *ExprContext) LT() antlr.TerminalNode {
return s.GetToken(SLQParserLT, 0)
}
func (s *ExprContext) LT_EQ() antlr.TerminalNode {
return s.GetToken(SLQParserLT_EQ, 0)
}
func (s *ExprContext) GT() antlr.TerminalNode {
return s.GetToken(SLQParserGT, 0)
}
func (s *ExprContext) GT_EQ() antlr.TerminalNode {
return s.GetToken(SLQParserGT_EQ, 0)
}
func (s *ExprContext) EQ() antlr.TerminalNode {
return s.GetToken(SLQParserEQ, 0)
}
func (s *ExprContext) NEQ() antlr.TerminalNode {
return s.GetToken(SLQParserNEQ, 0)
}
func (s *ExprContext) GetRuleContext() antlr.RuleContext {
return s
}
func (s *ExprContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
return antlr.TreesStringTree(s, ruleNames, recog)
}
func (s *ExprContext) EnterRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(SLQListener); ok {
listenerT.EnterExpr(s)
}
}
func (s *ExprContext) ExitRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(SLQListener); ok {
listenerT.ExitExpr(s)
}
}
func (s *ExprContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
2020-08-06 20:58:47 +03:00
switch t := visitor.(type) {
case SLQVisitor:
return t.VisitExpr(s)
default:
return t.VisitChildren(s)
}
}
func (p *SLQParser) Expr() (localctx IExprContext) {
return p.expr(0)
}
func (p *SLQParser) expr(_p int) (localctx IExprContext) {
this := p
_ = this
2020-08-06 20:58:47 +03:00
var _parentctx antlr.ParserRuleContext = p.GetParserRuleContext()
_parentState := p.GetState()
localctx = NewExprContext(p, p.GetParserRuleContext(), _parentState)
var _prevctx IExprContext = localctx
var _ antlr.ParserRuleContext = _prevctx // TODO: To prevent unused variable warning.
_startState := 34
p.EnterRecursionRule(localctx, 34, SLQParserRULE_expr, _p)
2020-08-06 20:58:47 +03:00
var _la int
defer func() {
p.UnrollRecursionContexts(_parentctx)
}()
defer func() {
if err := recover(); err != nil {
if v, ok := err.(antlr.RecognitionException); ok {
localctx.SetException(v)
p.GetErrorHandler().ReportError(p, v)
p.GetErrorHandler().Recover(p, v)
} else {
panic(err)
}
}
}()
var _alt int
p.EnterOuterAlt(localctx, 1)
p.SetState(173)
2020-08-06 20:58:47 +03:00
p.GetErrorHandler().Sync(p)
switch p.GetTokenStream().LA(1) {
case SLQParserNAME:
2020-08-06 20:58:47 +03:00
{
p.SetState(167)
p.Selector()
2020-08-06 20:58:47 +03:00
}
case SLQParserNULL, SLQParserNN, SLQParserNUMBER, SLQParserSTRING:
{
p.SetState(168)
2020-08-06 20:58:47 +03:00
p.Literal()
}
case SLQParserT__20, SLQParserT__21, SLQParserT__26, SLQParserT__27:
{
p.SetState(169)
2020-08-06 20:58:47 +03:00
p.UnaryOperator()
}
{
p.SetState(170)
2020-08-06 20:58:47 +03:00
p.expr(9)
}
case SLQParserT__9, SLQParserT__10, SLQParserT__11, SLQParserT__12, SLQParserT__13, SLQParserT__14, SLQParserT__15, SLQParserT__16:
{
p.SetState(172)
2020-08-06 20:58:47 +03:00
p.Fn()
}
default:
panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil))
}
p.GetParserRuleContext().SetStop(p.GetTokenStream().LT(-1))
p.SetState(202)
2020-08-06 20:58:47 +03:00
p.GetErrorHandler().Sync(p)
_alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 18, p.GetParserRuleContext())
2020-08-06 20:58:47 +03:00
for _alt != 2 && _alt != antlr.ATNInvalidAltNumber {
if _alt == 1 {
if p.GetParseListeners() != nil {
p.TriggerExitRuleEvent()
}
_prevctx = localctx
p.SetState(200)
2020-08-06 20:58:47 +03:00
p.GetErrorHandler().Sync(p)
switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 17, p.GetParserRuleContext()) {
2020-08-06 20:58:47 +03:00
case 1:
localctx = NewExprContext(p, _parentctx, _parentState)
p.PushNewRecursionContext(localctx, _startState, SLQParserRULE_expr)
p.SetState(175)
2020-08-06 20:58:47 +03:00
if !(p.Precpred(p.GetParserRuleContext(), 8)) {
panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 8)", ""))
}
{
p.SetState(176)
2020-08-06 20:58:47 +03:00
p.Match(SLQParserT__17)
}
{
p.SetState(177)
2020-08-06 20:58:47 +03:00
p.expr(9)
}
case 2:
localctx = NewExprContext(p, _parentctx, _parentState)
p.PushNewRecursionContext(localctx, _startState, SLQParserRULE_expr)
p.SetState(178)
2020-08-06 20:58:47 +03:00
if !(p.Precpred(p.GetParserRuleContext(), 7)) {
panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 7)", ""))
}
{
p.SetState(179)
2020-08-06 20:58:47 +03:00
_la = p.GetTokenStream().LA(1)
if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&1572868) != 0) {
2020-08-06 20:58:47 +03:00
p.GetErrorHandler().RecoverInline(p)
} else {
p.GetErrorHandler().ReportMatch(p)
p.Consume()
}
}
{
p.SetState(180)
2020-08-06 20:58:47 +03:00
p.expr(8)
}
case 3:
localctx = NewExprContext(p, _parentctx, _parentState)
p.PushNewRecursionContext(localctx, _startState, SLQParserRULE_expr)
p.SetState(181)
2020-08-06 20:58:47 +03:00
if !(p.Precpred(p.GetParserRuleContext(), 6)) {
panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 6)", ""))
}
{
p.SetState(182)
2020-08-06 20:58:47 +03:00
_la = p.GetTokenStream().LA(1)
if !(_la == SLQParserT__20 || _la == SLQParserT__21) {
p.GetErrorHandler().RecoverInline(p)
} else {
p.GetErrorHandler().ReportMatch(p)
p.Consume()
}
}
{
p.SetState(183)
2020-08-06 20:58:47 +03:00
p.expr(7)
}
case 4:
localctx = NewExprContext(p, _parentctx, _parentState)
p.PushNewRecursionContext(localctx, _startState, SLQParserRULE_expr)
p.SetState(184)
2020-08-06 20:58:47 +03:00
if !(p.Precpred(p.GetParserRuleContext(), 5)) {
panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 5)", ""))
}
{
p.SetState(185)
2020-08-06 20:58:47 +03:00
_la = p.GetTokenStream().LA(1)
if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&58720256) != 0) {
2020-08-06 20:58:47 +03:00
p.GetErrorHandler().RecoverInline(p)
} else {
p.GetErrorHandler().ReportMatch(p)
p.Consume()
}
}
{
p.SetState(186)
2020-08-06 20:58:47 +03:00
p.expr(6)
}
case 5:
localctx = NewExprContext(p, _parentctx, _parentState)
p.PushNewRecursionContext(localctx, _startState, SLQParserRULE_expr)
p.SetState(187)
2020-08-06 20:58:47 +03:00
if !(p.Precpred(p.GetParserRuleContext(), 4)) {
panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 4)", ""))
}
{
p.SetState(188)
2020-08-06 20:58:47 +03:00
_la = p.GetTokenStream().LA(1)
if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&32985348833280) != 0) {
2020-08-06 20:58:47 +03:00
p.GetErrorHandler().RecoverInline(p)
} else {
p.GetErrorHandler().ReportMatch(p)
p.Consume()
}
}
{
p.SetState(189)
2020-08-06 20:58:47 +03:00
p.expr(5)
}
case 6:
localctx = NewExprContext(p, _parentctx, _parentState)
p.PushNewRecursionContext(localctx, _startState, SLQParserRULE_expr)
p.SetState(190)
2020-08-06 20:58:47 +03:00
if !(p.Precpred(p.GetParserRuleContext(), 3)) {
panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 3)", ""))
}
p.SetState(194)
2020-08-06 20:58:47 +03:00
p.GetErrorHandler().Sync(p)
switch p.GetTokenStream().LA(1) {
case SLQParserEQ:
{
p.SetState(191)
2020-08-06 20:58:47 +03:00
p.Match(SLQParserEQ)
}
case SLQParserNEQ:
{
p.SetState(192)
2020-08-06 20:58:47 +03:00
p.Match(SLQParserNEQ)
}
case SLQParserT__9, SLQParserT__10, SLQParserT__11, SLQParserT__12, SLQParserT__13, SLQParserT__14, SLQParserT__15, SLQParserT__16, SLQParserT__20, SLQParserT__21, SLQParserT__26, SLQParserT__27, SLQParserNULL, SLQParserNN, SLQParserNUMBER, SLQParserNAME, SLQParserSTRING:
2020-08-06 20:58:47 +03:00
default:
panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil))
}
{
p.SetState(196)
2020-08-06 20:58:47 +03:00
p.expr(4)
}
case 7:
localctx = NewExprContext(p, _parentctx, _parentState)
p.PushNewRecursionContext(localctx, _startState, SLQParserRULE_expr)
p.SetState(197)
2020-08-06 20:58:47 +03:00
if !(p.Precpred(p.GetParserRuleContext(), 2)) {
panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 2)", ""))
}
{
p.SetState(198)
2020-08-06 20:58:47 +03:00
p.Match(SLQParserT__25)
}
{
p.SetState(199)
2020-08-06 20:58:47 +03:00
p.expr(3)
}
}
}
p.SetState(204)
2020-08-06 20:58:47 +03:00
p.GetErrorHandler().Sync(p)
_alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 18, p.GetParserRuleContext())
2020-08-06 20:58:47 +03:00
}
return localctx
}
// ILiteralContext is an interface to support dynamic dispatch.
type ILiteralContext interface {
antlr.ParserRuleContext
// GetParser returns the parser.
GetParser() antlr.Parser
// Getter signatures
NN() antlr.TerminalNode
NUMBER() antlr.TerminalNode
STRING() antlr.TerminalNode
NULL() antlr.TerminalNode
2020-08-06 20:58:47 +03:00
// IsLiteralContext differentiates from other interfaces.
IsLiteralContext()
}
type LiteralContext struct {
*antlr.BaseParserRuleContext
parser antlr.Parser
}
func NewEmptyLiteralContext() *LiteralContext {
var p = new(LiteralContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
p.RuleIndex = SLQParserRULE_literal
return p
}
func (*LiteralContext) IsLiteralContext() {}
func NewLiteralContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *LiteralContext {
var p = new(LiteralContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
p.parser = parser
p.RuleIndex = SLQParserRULE_literal
return p
}
func (s *LiteralContext) GetParser() antlr.Parser { return s.parser }
func (s *LiteralContext) NN() antlr.TerminalNode {
return s.GetToken(SLQParserNN, 0)
}
func (s *LiteralContext) NUMBER() antlr.TerminalNode {
return s.GetToken(SLQParserNUMBER, 0)
}
func (s *LiteralContext) STRING() antlr.TerminalNode {
return s.GetToken(SLQParserSTRING, 0)
}
func (s *LiteralContext) NULL() antlr.TerminalNode {
return s.GetToken(SLQParserNULL, 0)
}
func (s *LiteralContext) GetRuleContext() antlr.RuleContext {
return s
}
func (s *LiteralContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
return antlr.TreesStringTree(s, ruleNames, recog)
}
func (s *LiteralContext) EnterRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(SLQListener); ok {
listenerT.EnterLiteral(s)
}
}
func (s *LiteralContext) ExitRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(SLQListener); ok {
listenerT.ExitLiteral(s)
}
}
func (s *LiteralContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
2020-08-06 20:58:47 +03:00
switch t := visitor.(type) {
case SLQVisitor:
return t.VisitLiteral(s)
default:
return t.VisitChildren(s)
}
}
func (p *SLQParser) Literal() (localctx ILiteralContext) {
this := p
_ = this
2020-08-06 20:58:47 +03:00
localctx = NewLiteralContext(p, p.GetParserRuleContext(), p.GetState())
p.EnterRule(localctx, 36, SLQParserRULE_literal)
2020-08-06 20:58:47 +03:00
var _la int
defer func() {
p.ExitRule()
}()
defer func() {
if err := recover(); err != nil {
if v, ok := err.(antlr.RecognitionException); ok {
localctx.SetException(v)
p.GetErrorHandler().ReportError(p, v)
p.GetErrorHandler().Recover(p, v)
} else {
panic(err)
}
}
}()
p.EnterOuterAlt(localctx, 1)
{
p.SetState(205)
2020-08-06 20:58:47 +03:00
_la = p.GetTokenStream().LA(1)
if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&564874098769920) != 0) {
2020-08-06 20:58:47 +03:00
p.GetErrorHandler().RecoverInline(p)
} else {
p.GetErrorHandler().ReportMatch(p)
p.Consume()
}
}
return localctx
}
// IUnaryOperatorContext is an interface to support dynamic dispatch.
type IUnaryOperatorContext interface {
antlr.ParserRuleContext
// GetParser returns the parser.
GetParser() antlr.Parser
// IsUnaryOperatorContext differentiates from other interfaces.
IsUnaryOperatorContext()
}
type UnaryOperatorContext struct {
*antlr.BaseParserRuleContext
parser antlr.Parser
}
func NewEmptyUnaryOperatorContext() *UnaryOperatorContext {
var p = new(UnaryOperatorContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
p.RuleIndex = SLQParserRULE_unaryOperator
return p
}
func (*UnaryOperatorContext) IsUnaryOperatorContext() {}
func NewUnaryOperatorContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *UnaryOperatorContext {
var p = new(UnaryOperatorContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
p.parser = parser
p.RuleIndex = SLQParserRULE_unaryOperator
return p
}
func (s *UnaryOperatorContext) GetParser() antlr.Parser { return s.parser }
func (s *UnaryOperatorContext) GetRuleContext() antlr.RuleContext {
return s
}
func (s *UnaryOperatorContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
return antlr.TreesStringTree(s, ruleNames, recog)
}
func (s *UnaryOperatorContext) EnterRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(SLQListener); ok {
listenerT.EnterUnaryOperator(s)
}
}
func (s *UnaryOperatorContext) ExitRule(listener antlr.ParseTreeListener) {
if listenerT, ok := listener.(SLQListener); ok {
listenerT.ExitUnaryOperator(s)
}
}
func (s *UnaryOperatorContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
2020-08-06 20:58:47 +03:00
switch t := visitor.(type) {
case SLQVisitor:
return t.VisitUnaryOperator(s)
default:
return t.VisitChildren(s)
}
}
func (p *SLQParser) UnaryOperator() (localctx IUnaryOperatorContext) {
this := p
_ = this
2020-08-06 20:58:47 +03:00
localctx = NewUnaryOperatorContext(p, p.GetParserRuleContext(), p.GetState())
p.EnterRule(localctx, 38, SLQParserRULE_unaryOperator)
2020-08-06 20:58:47 +03:00
var _la int
defer func() {
p.ExitRule()
}()
defer func() {
if err := recover(); err != nil {
if v, ok := err.(antlr.RecognitionException); ok {
localctx.SetException(v)
p.GetErrorHandler().ReportError(p, v)
p.GetErrorHandler().Recover(p, v)
} else {
panic(err)
}
}
}()
p.EnterOuterAlt(localctx, 1)
{
p.SetState(207)
2020-08-06 20:58:47 +03:00
_la = p.GetTokenStream().LA(1)
if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&408944640) != 0) {
2020-08-06 20:58:47 +03:00
p.GetErrorHandler().RecoverInline(p)
} else {
p.GetErrorHandler().ReportMatch(p)
p.Consume()
}
}
return localctx
}
func (p *SLQParser) Sempred(localctx antlr.RuleContext, ruleIndex, predIndex int) bool {
switch ruleIndex {
case 17:
2020-08-06 20:58:47 +03:00
var t *ExprContext = nil
if localctx != nil {
t = localctx.(*ExprContext)
}
return p.Expr_Sempred(t, predIndex)
default:
panic("No predicate with index: " + fmt.Sprint(ruleIndex))
}
}
func (p *SLQParser) Expr_Sempred(localctx antlr.RuleContext, predIndex int) bool {
this := p
_ = this
2020-08-06 20:58:47 +03:00
switch predIndex {
case 0:
return p.Precpred(p.GetParserRuleContext(), 8)
case 1:
return p.Precpred(p.GetParserRuleContext(), 7)
case 2:
return p.Precpred(p.GetParserRuleContext(), 6)
case 3:
return p.Precpred(p.GetParserRuleContext(), 5)
case 4:
return p.Precpred(p.GetParserRuleContext(), 4)
case 5:
return p.Precpred(p.GetParserRuleContext(), 3)
case 6:
return p.Precpred(p.GetParserRuleContext(), 2)
default:
panic("No predicate with index: " + fmt.Sprint(predIndex))
}
}