mirror of
https://github.com/neilotoole/sq.git
synced 2024-12-18 21:52:28 +03:00
e4cc68b714
* moved it * what used to be libsq/slq in now libsq/ast/internal/slq
2938 lines
71 KiB
Go
2938 lines
71 KiB
Go
// Code generated from /Users/neilotoole/work/sq/sq/grammar/SLQ.g4 by ANTLR 4.7.2. DO NOT EDIT.
|
|
|
|
package slq // SLQ
|
|
import (
|
|
"fmt"
|
|
"reflect"
|
|
"strconv"
|
|
|
|
"github.com/antlr/antlr4/runtime/Go/antlr"
|
|
)
|
|
|
|
// Suppress unused import errors
|
|
var _ = fmt.Printf
|
|
var _ = reflect.Copy
|
|
var _ = strconv.Itoa
|
|
|
|
var parserATN = []uint16{
|
|
3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 52, 193,
|
|
4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7,
|
|
4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13,
|
|
9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9,
|
|
18, 3, 2, 7, 2, 38, 10, 2, 12, 2, 14, 2, 41, 11, 2, 3, 2, 3, 2, 6, 2, 45,
|
|
10, 2, 13, 2, 14, 2, 46, 3, 2, 7, 2, 50, 10, 2, 12, 2, 14, 2, 53, 11, 2,
|
|
3, 2, 7, 2, 56, 10, 2, 12, 2, 14, 2, 59, 11, 2, 3, 3, 3, 3, 3, 3, 7, 3,
|
|
64, 10, 3, 12, 3, 14, 3, 67, 11, 3, 3, 4, 3, 4, 3, 4, 7, 4, 72, 10, 4,
|
|
12, 4, 14, 4, 75, 11, 4, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5,
|
|
5, 5, 85, 10, 5, 3, 6, 3, 6, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 7, 7, 94, 10,
|
|
7, 12, 7, 14, 7, 97, 11, 7, 3, 7, 5, 7, 100, 10, 7, 3, 7, 3, 7, 3, 8, 3,
|
|
8, 3, 8, 3, 8, 3, 8, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 5, 9, 114, 10, 9, 3,
|
|
10, 3, 10, 3, 10, 3, 10, 3, 10, 7, 10, 121, 10, 10, 12, 10, 14, 10, 124,
|
|
11, 10, 3, 10, 3, 10, 3, 11, 3, 11, 3, 12, 3, 12, 3, 12, 3, 13, 3, 13,
|
|
3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 5, 14, 144,
|
|
10, 14, 3, 14, 3, 14, 3, 15, 3, 15, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16,
|
|
3, 16, 3, 16, 5, 16, 157, 10, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3,
|
|
16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16,
|
|
3, 16, 3, 16, 3, 16, 5, 16, 178, 10, 16, 3, 16, 3, 16, 3, 16, 3, 16, 7,
|
|
16, 184, 10, 16, 12, 16, 14, 16, 187, 11, 16, 3, 17, 3, 17, 3, 18, 3, 18,
|
|
3, 18, 2, 3, 30, 19, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28,
|
|
30, 32, 34, 2, 12, 3, 2, 43, 48, 3, 2, 5, 7, 3, 2, 8, 10, 3, 2, 12, 19,
|
|
4, 2, 4, 4, 21, 22, 3, 2, 23, 24, 3, 2, 25, 27, 3, 2, 43, 46, 4, 2, 40,
|
|
42, 51, 51, 4, 2, 23, 24, 29, 30, 2, 209, 2, 39, 3, 2, 2, 2, 4, 60, 3,
|
|
2, 2, 2, 6, 68, 3, 2, 2, 2, 8, 84, 3, 2, 2, 2, 10, 86, 3, 2, 2, 2, 12,
|
|
88, 3, 2, 2, 2, 14, 103, 3, 2, 2, 2, 16, 113, 3, 2, 2, 2, 18, 115, 3, 2,
|
|
2, 2, 20, 127, 3, 2, 2, 2, 22, 129, 3, 2, 2, 2, 24, 132, 3, 2, 2, 2, 26,
|
|
134, 3, 2, 2, 2, 28, 147, 3, 2, 2, 2, 30, 156, 3, 2, 2, 2, 32, 188, 3,
|
|
2, 2, 2, 34, 190, 3, 2, 2, 2, 36, 38, 7, 3, 2, 2, 37, 36, 3, 2, 2, 2, 38,
|
|
41, 3, 2, 2, 2, 39, 37, 3, 2, 2, 2, 39, 40, 3, 2, 2, 2, 40, 42, 3, 2, 2,
|
|
2, 41, 39, 3, 2, 2, 2, 42, 51, 5, 4, 3, 2, 43, 45, 7, 3, 2, 2, 44, 43,
|
|
3, 2, 2, 2, 45, 46, 3, 2, 2, 2, 46, 44, 3, 2, 2, 2, 46, 47, 3, 2, 2, 2,
|
|
47, 48, 3, 2, 2, 2, 48, 50, 5, 4, 3, 2, 49, 44, 3, 2, 2, 2, 50, 53, 3,
|
|
2, 2, 2, 51, 49, 3, 2, 2, 2, 51, 52, 3, 2, 2, 2, 52, 57, 3, 2, 2, 2, 53,
|
|
51, 3, 2, 2, 2, 54, 56, 7, 3, 2, 2, 55, 54, 3, 2, 2, 2, 56, 59, 3, 2, 2,
|
|
2, 57, 55, 3, 2, 2, 2, 57, 58, 3, 2, 2, 2, 58, 3, 3, 2, 2, 2, 59, 57, 3,
|
|
2, 2, 2, 60, 65, 5, 6, 4, 2, 61, 62, 7, 38, 2, 2, 62, 64, 5, 6, 4, 2, 63,
|
|
61, 3, 2, 2, 2, 64, 67, 3, 2, 2, 2, 65, 63, 3, 2, 2, 2, 65, 66, 3, 2, 2,
|
|
2, 66, 5, 3, 2, 2, 2, 67, 65, 3, 2, 2, 2, 68, 73, 5, 8, 5, 2, 69, 70, 7,
|
|
37, 2, 2, 70, 72, 5, 8, 5, 2, 71, 69, 3, 2, 2, 2, 72, 75, 3, 2, 2, 2, 73,
|
|
71, 3, 2, 2, 2, 73, 74, 3, 2, 2, 2, 74, 7, 3, 2, 2, 2, 75, 73, 3, 2, 2,
|
|
2, 76, 85, 5, 22, 12, 2, 77, 85, 5, 24, 13, 2, 78, 85, 5, 20, 11, 2, 79,
|
|
85, 5, 14, 8, 2, 80, 85, 5, 18, 10, 2, 81, 85, 5, 26, 14, 2, 82, 85, 5,
|
|
12, 7, 2, 83, 85, 5, 30, 16, 2, 84, 76, 3, 2, 2, 2, 84, 77, 3, 2, 2, 2,
|
|
84, 78, 3, 2, 2, 2, 84, 79, 3, 2, 2, 2, 84, 80, 3, 2, 2, 2, 84, 81, 3,
|
|
2, 2, 2, 84, 82, 3, 2, 2, 2, 84, 83, 3, 2, 2, 2, 85, 9, 3, 2, 2, 2, 86,
|
|
87, 9, 2, 2, 2, 87, 11, 3, 2, 2, 2, 88, 89, 5, 28, 15, 2, 89, 99, 7, 33,
|
|
2, 2, 90, 95, 5, 30, 16, 2, 91, 92, 7, 37, 2, 2, 92, 94, 5, 30, 16, 2,
|
|
93, 91, 3, 2, 2, 2, 94, 97, 3, 2, 2, 2, 95, 93, 3, 2, 2, 2, 95, 96, 3,
|
|
2, 2, 2, 96, 100, 3, 2, 2, 2, 97, 95, 3, 2, 2, 2, 98, 100, 7, 4, 2, 2,
|
|
99, 90, 3, 2, 2, 2, 99, 98, 3, 2, 2, 2, 99, 100, 3, 2, 2, 2, 100, 101,
|
|
3, 2, 2, 2, 101, 102, 7, 34, 2, 2, 102, 13, 3, 2, 2, 2, 103, 104, 9, 3,
|
|
2, 2, 104, 105, 7, 33, 2, 2, 105, 106, 5, 16, 9, 2, 106, 107, 7, 34, 2,
|
|
2, 107, 15, 3, 2, 2, 2, 108, 109, 7, 49, 2, 2, 109, 110, 5, 10, 6, 2, 110,
|
|
111, 7, 49, 2, 2, 111, 114, 3, 2, 2, 2, 112, 114, 7, 49, 2, 2, 113, 108,
|
|
3, 2, 2, 2, 113, 112, 3, 2, 2, 2, 114, 17, 3, 2, 2, 2, 115, 116, 9, 4,
|
|
2, 2, 116, 117, 7, 33, 2, 2, 117, 122, 7, 49, 2, 2, 118, 119, 7, 37, 2,
|
|
2, 119, 121, 7, 49, 2, 2, 120, 118, 3, 2, 2, 2, 121, 124, 3, 2, 2, 2, 122,
|
|
120, 3, 2, 2, 2, 122, 123, 3, 2, 2, 2, 123, 125, 3, 2, 2, 2, 124, 122,
|
|
3, 2, 2, 2, 125, 126, 7, 34, 2, 2, 126, 19, 3, 2, 2, 2, 127, 128, 7, 49,
|
|
2, 2, 128, 21, 3, 2, 2, 2, 129, 130, 7, 50, 2, 2, 130, 131, 7, 49, 2, 2,
|
|
131, 23, 3, 2, 2, 2, 132, 133, 7, 50, 2, 2, 133, 25, 3, 2, 2, 2, 134, 143,
|
|
7, 11, 2, 2, 135, 136, 7, 41, 2, 2, 136, 137, 7, 39, 2, 2, 137, 144, 7,
|
|
41, 2, 2, 138, 139, 7, 41, 2, 2, 139, 144, 7, 39, 2, 2, 140, 141, 7, 39,
|
|
2, 2, 141, 144, 7, 41, 2, 2, 142, 144, 7, 41, 2, 2, 143, 135, 3, 2, 2,
|
|
2, 143, 138, 3, 2, 2, 2, 143, 140, 3, 2, 2, 2, 143, 142, 3, 2, 2, 2, 143,
|
|
144, 3, 2, 2, 2, 144, 145, 3, 2, 2, 2, 145, 146, 7, 36, 2, 2, 146, 27,
|
|
3, 2, 2, 2, 147, 148, 9, 5, 2, 2, 148, 29, 3, 2, 2, 2, 149, 150, 8, 16,
|
|
1, 2, 150, 157, 7, 49, 2, 2, 151, 157, 5, 32, 17, 2, 152, 153, 5, 34, 18,
|
|
2, 153, 154, 5, 30, 16, 11, 154, 157, 3, 2, 2, 2, 155, 157, 5, 12, 7, 2,
|
|
156, 149, 3, 2, 2, 2, 156, 151, 3, 2, 2, 2, 156, 152, 3, 2, 2, 2, 156,
|
|
155, 3, 2, 2, 2, 157, 185, 3, 2, 2, 2, 158, 159, 12, 10, 2, 2, 159, 160,
|
|
7, 20, 2, 2, 160, 184, 5, 30, 16, 11, 161, 162, 12, 9, 2, 2, 162, 163,
|
|
9, 6, 2, 2, 163, 184, 5, 30, 16, 10, 164, 165, 12, 8, 2, 2, 165, 166, 9,
|
|
7, 2, 2, 166, 184, 5, 30, 16, 9, 167, 168, 12, 7, 2, 2, 168, 169, 9, 8,
|
|
2, 2, 169, 184, 5, 30, 16, 8, 170, 171, 12, 6, 2, 2, 171, 172, 9, 9, 2,
|
|
2, 172, 184, 5, 30, 16, 7, 173, 177, 12, 5, 2, 2, 174, 178, 7, 48, 2, 2,
|
|
175, 178, 7, 47, 2, 2, 176, 178, 3, 2, 2, 2, 177, 174, 3, 2, 2, 2, 177,
|
|
175, 3, 2, 2, 2, 177, 176, 3, 2, 2, 2, 178, 179, 3, 2, 2, 2, 179, 184,
|
|
5, 30, 16, 6, 180, 181, 12, 4, 2, 2, 181, 182, 7, 28, 2, 2, 182, 184, 5,
|
|
30, 16, 5, 183, 158, 3, 2, 2, 2, 183, 161, 3, 2, 2, 2, 183, 164, 3, 2,
|
|
2, 2, 183, 167, 3, 2, 2, 2, 183, 170, 3, 2, 2, 2, 183, 173, 3, 2, 2, 2,
|
|
183, 180, 3, 2, 2, 2, 184, 187, 3, 2, 2, 2, 185, 183, 3, 2, 2, 2, 185,
|
|
186, 3, 2, 2, 2, 186, 31, 3, 2, 2, 2, 187, 185, 3, 2, 2, 2, 188, 189, 9,
|
|
10, 2, 2, 189, 33, 3, 2, 2, 2, 190, 191, 9, 11, 2, 2, 191, 35, 3, 2, 2,
|
|
2, 18, 39, 46, 51, 57, 65, 73, 84, 95, 99, 113, 122, 143, 156, 177, 183,
|
|
185,
|
|
}
|
|
var deserializer = antlr.NewATNDeserializer(nil)
|
|
var deserializedATN = deserializer.DeserializeFromUInt16(parserATN)
|
|
|
|
var literalNames = []string{
|
|
"", "';'", "'*'", "'join'", "'JOIN'", "'j'", "'group'", "'GROUP'", "'g'",
|
|
"'.['", "'sum'", "'SUM'", "'avg'", "'AVG'", "'count'", "'COUNT'", "'where'",
|
|
"'WHERE'", "'||'", "'/'", "'%'", "'+'", "'-'", "'<<'", "'>>'", "'&'", "'&&'",
|
|
"'~'", "'!'", "", "", "'('", "')'", "'['", "']'", "','", "'|'", "':'",
|
|
"", "", "", "'<='", "'<'", "'>='", "'>'", "'!='", "'=='",
|
|
}
|
|
var symbolicNames = []string{
|
|
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
|
|
"", "", "", "", "", "", "", "", "", "", "", "ID", "WS", "LPAR", "RPAR",
|
|
"LBRA", "RBRA", "COMMA", "PIPE", "COLON", "NULL", "NN", "NUMBER", "LT_EQ",
|
|
"LT", "GT_EQ", "GT", "NEQ", "EQ", "SEL", "DATASOURCE", "STRING", "LINECOMMENT",
|
|
}
|
|
|
|
var ruleNames = []string{
|
|
"stmtList", "query", "segment", "element", "cmpr", "fn", "join", "joinConstraint",
|
|
"group", "selElement", "dsTblElement", "dsElement", "rowRange", "fnName",
|
|
"expr", "literal", "unaryOperator",
|
|
}
|
|
var decisionToDFA = make([]*antlr.DFA, len(deserializedATN.DecisionToState))
|
|
|
|
func init() {
|
|
for index, ds := range deserializedATN.DecisionToState {
|
|
decisionToDFA[index] = antlr.NewDFA(ds, index)
|
|
}
|
|
}
|
|
|
|
type SLQParser struct {
|
|
*antlr.BaseParser
|
|
}
|
|
|
|
func NewSLQParser(input antlr.TokenStream) *SLQParser {
|
|
this := new(SLQParser)
|
|
|
|
this.BaseParser = antlr.NewBaseParser(input)
|
|
|
|
this.Interpreter = antlr.NewParserATNSimulator(this, deserializedATN, decisionToDFA, antlr.NewPredictionContextCache())
|
|
this.RuleNames = ruleNames
|
|
this.LiteralNames = literalNames
|
|
this.SymbolicNames = symbolicNames
|
|
this.GrammarFileName = "SLQ.g4"
|
|
|
|
return this
|
|
}
|
|
|
|
// SLQParser tokens.
|
|
const (
|
|
SLQParserEOF = antlr.TokenEOF
|
|
SLQParserT__0 = 1
|
|
SLQParserT__1 = 2
|
|
SLQParserT__2 = 3
|
|
SLQParserT__3 = 4
|
|
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
|
|
SLQParserSEL = 47
|
|
SLQParserDATASOURCE = 48
|
|
SLQParserSTRING = 49
|
|
SLQParserLINECOMMENT = 50
|
|
)
|
|
|
|
// SLQParser rules.
|
|
const (
|
|
SLQParserRULE_stmtList = 0
|
|
SLQParserRULE_query = 1
|
|
SLQParserRULE_segment = 2
|
|
SLQParserRULE_element = 3
|
|
SLQParserRULE_cmpr = 4
|
|
SLQParserRULE_fn = 5
|
|
SLQParserRULE_join = 6
|
|
SLQParserRULE_joinConstraint = 7
|
|
SLQParserRULE_group = 8
|
|
SLQParserRULE_selElement = 9
|
|
SLQParserRULE_dsTblElement = 10
|
|
SLQParserRULE_dsElement = 11
|
|
SLQParserRULE_rowRange = 12
|
|
SLQParserRULE_fnName = 13
|
|
SLQParserRULE_expr = 14
|
|
SLQParserRULE_literal = 15
|
|
SLQParserRULE_unaryOperator = 16
|
|
)
|
|
|
|
// IStmtListContext is an interface to support dynamic dispatch.
|
|
type IStmtListContext interface {
|
|
antlr.ParserRuleContext
|
|
|
|
// GetParser returns the parser.
|
|
GetParser() antlr.Parser
|
|
|
|
// 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 {
|
|
var ts = s.GetTypedRuleContexts(reflect.TypeOf((*IQueryContext)(nil)).Elem())
|
|
var tst = make([]IQueryContext, len(ts))
|
|
|
|
for i, t := range ts {
|
|
if t != nil {
|
|
tst[i] = t.(IQueryContext)
|
|
}
|
|
}
|
|
|
|
return tst
|
|
}
|
|
|
|
func (s *StmtListContext) Query(i int) IQueryContext {
|
|
var t = s.GetTypedRuleContext(reflect.TypeOf((*IQueryContext)(nil)).Elem(), i)
|
|
|
|
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{} {
|
|
switch t := visitor.(type) {
|
|
case SLQVisitor:
|
|
return t.VisitStmtList(s)
|
|
|
|
default:
|
|
return t.VisitChildren(s)
|
|
}
|
|
}
|
|
|
|
func (p *SLQParser) StmtList() (localctx IStmtListContext) {
|
|
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(37)
|
|
p.GetErrorHandler().Sync(p)
|
|
_la = p.GetTokenStream().LA(1)
|
|
|
|
for _la == SLQParserT__0 {
|
|
{
|
|
p.SetState(34)
|
|
p.Match(SLQParserT__0)
|
|
}
|
|
|
|
p.SetState(39)
|
|
p.GetErrorHandler().Sync(p)
|
|
_la = p.GetTokenStream().LA(1)
|
|
}
|
|
{
|
|
p.SetState(40)
|
|
p.Query()
|
|
}
|
|
p.SetState(49)
|
|
p.GetErrorHandler().Sync(p)
|
|
_alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 2, p.GetParserRuleContext())
|
|
|
|
for _alt != 2 && _alt != antlr.ATNInvalidAltNumber {
|
|
if _alt == 1 {
|
|
p.SetState(42)
|
|
p.GetErrorHandler().Sync(p)
|
|
_la = p.GetTokenStream().LA(1)
|
|
|
|
for ok := true; ok; ok = _la == SLQParserT__0 {
|
|
{
|
|
p.SetState(41)
|
|
p.Match(SLQParserT__0)
|
|
}
|
|
|
|
p.SetState(44)
|
|
p.GetErrorHandler().Sync(p)
|
|
_la = p.GetTokenStream().LA(1)
|
|
}
|
|
{
|
|
p.SetState(46)
|
|
p.Query()
|
|
}
|
|
|
|
}
|
|
p.SetState(51)
|
|
p.GetErrorHandler().Sync(p)
|
|
_alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 2, p.GetParserRuleContext())
|
|
}
|
|
p.SetState(55)
|
|
p.GetErrorHandler().Sync(p)
|
|
_la = p.GetTokenStream().LA(1)
|
|
|
|
for _la == SLQParserT__0 {
|
|
{
|
|
p.SetState(52)
|
|
p.Match(SLQParserT__0)
|
|
}
|
|
|
|
p.SetState(57)
|
|
p.GetErrorHandler().Sync(p)
|
|
_la = p.GetTokenStream().LA(1)
|
|
}
|
|
|
|
return localctx
|
|
}
|
|
|
|
// IQueryContext is an interface to support dynamic dispatch.
|
|
type IQueryContext interface {
|
|
antlr.ParserRuleContext
|
|
|
|
// GetParser returns the parser.
|
|
GetParser() antlr.Parser
|
|
|
|
// IsQueryContext differentiates from other interfaces.
|
|
IsQueryContext()
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
func (*QueryContext) IsQueryContext() {}
|
|
|
|
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 {
|
|
var ts = s.GetTypedRuleContexts(reflect.TypeOf((*ISegmentContext)(nil)).Elem())
|
|
var tst = make([]ISegmentContext, len(ts))
|
|
|
|
for i, t := range ts {
|
|
if t != nil {
|
|
tst[i] = t.(ISegmentContext)
|
|
}
|
|
}
|
|
|
|
return tst
|
|
}
|
|
|
|
func (s *QueryContext) Segment(i int) ISegmentContext {
|
|
var t = s.GetTypedRuleContext(reflect.TypeOf((*ISegmentContext)(nil)).Elem(), i)
|
|
|
|
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
|
|
}
|
|
|
|
func (s *QueryContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
|
|
return antlr.TreesStringTree(s, ruleNames, recog)
|
|
}
|
|
|
|
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{} {
|
|
switch t := visitor.(type) {
|
|
case SLQVisitor:
|
|
return t.VisitQuery(s)
|
|
|
|
default:
|
|
return t.VisitChildren(s)
|
|
}
|
|
}
|
|
|
|
func (p *SLQParser) Query() (localctx IQueryContext) {
|
|
localctx = NewQueryContext(p, p.GetParserRuleContext(), p.GetState())
|
|
p.EnterRule(localctx, 2, SLQParserRULE_query)
|
|
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(58)
|
|
p.Segment()
|
|
}
|
|
p.SetState(63)
|
|
p.GetErrorHandler().Sync(p)
|
|
_la = p.GetTokenStream().LA(1)
|
|
|
|
for _la == SLQParserPIPE {
|
|
{
|
|
p.SetState(59)
|
|
p.Match(SLQParserPIPE)
|
|
}
|
|
{
|
|
p.SetState(60)
|
|
p.Segment()
|
|
}
|
|
|
|
p.SetState(65)
|
|
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
|
|
|
|
// IsSegmentContext differentiates from other interfaces.
|
|
IsSegmentContext()
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
func (*SegmentContext) IsSegmentContext() {}
|
|
|
|
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 {
|
|
var ts = s.GetTypedRuleContexts(reflect.TypeOf((*IElementContext)(nil)).Elem())
|
|
var tst = make([]IElementContext, len(ts))
|
|
|
|
for i, t := range ts {
|
|
if t != nil {
|
|
tst[i] = t.(IElementContext)
|
|
}
|
|
}
|
|
|
|
return tst
|
|
}
|
|
|
|
func (s *SegmentContext) Element(i int) IElementContext {
|
|
var t = s.GetTypedRuleContext(reflect.TypeOf((*IElementContext)(nil)).Elem(), i)
|
|
|
|
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
|
|
}
|
|
|
|
func (s *SegmentContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
|
|
return antlr.TreesStringTree(s, ruleNames, recog)
|
|
}
|
|
|
|
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{} {
|
|
switch t := visitor.(type) {
|
|
case SLQVisitor:
|
|
return t.VisitSegment(s)
|
|
|
|
default:
|
|
return t.VisitChildren(s)
|
|
}
|
|
}
|
|
|
|
func (p *SLQParser) Segment() (localctx ISegmentContext) {
|
|
localctx = NewSegmentContext(p, p.GetParserRuleContext(), p.GetState())
|
|
p.EnterRule(localctx, 4, SLQParserRULE_segment)
|
|
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(66)
|
|
p.Element()
|
|
}
|
|
|
|
p.SetState(71)
|
|
p.GetErrorHandler().Sync(p)
|
|
_la = p.GetTokenStream().LA(1)
|
|
|
|
for _la == SLQParserCOMMA {
|
|
{
|
|
p.SetState(67)
|
|
p.Match(SLQParserCOMMA)
|
|
}
|
|
{
|
|
p.SetState(68)
|
|
p.Element()
|
|
}
|
|
|
|
p.SetState(73)
|
|
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
|
|
|
|
// IsElementContext differentiates from other interfaces.
|
|
IsElementContext()
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
func (*ElementContext) IsElementContext() {}
|
|
|
|
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) DsTblElement() IDsTblElementContext {
|
|
var t = s.GetTypedRuleContext(reflect.TypeOf((*IDsTblElementContext)(nil)).Elem(), 0)
|
|
|
|
if t == nil {
|
|
return nil
|
|
}
|
|
|
|
return t.(IDsTblElementContext)
|
|
}
|
|
|
|
func (s *ElementContext) DsElement() IDsElementContext {
|
|
var t = s.GetTypedRuleContext(reflect.TypeOf((*IDsElementContext)(nil)).Elem(), 0)
|
|
|
|
if t == nil {
|
|
return nil
|
|
}
|
|
|
|
return t.(IDsElementContext)
|
|
}
|
|
|
|
func (s *ElementContext) SelElement() ISelElementContext {
|
|
var t = s.GetTypedRuleContext(reflect.TypeOf((*ISelElementContext)(nil)).Elem(), 0)
|
|
|
|
if t == nil {
|
|
return nil
|
|
}
|
|
|
|
return t.(ISelElementContext)
|
|
}
|
|
|
|
func (s *ElementContext) Join() IJoinContext {
|
|
var t = s.GetTypedRuleContext(reflect.TypeOf((*IJoinContext)(nil)).Elem(), 0)
|
|
|
|
if t == nil {
|
|
return nil
|
|
}
|
|
|
|
return t.(IJoinContext)
|
|
}
|
|
|
|
func (s *ElementContext) Group() IGroupContext {
|
|
var t = s.GetTypedRuleContext(reflect.TypeOf((*IGroupContext)(nil)).Elem(), 0)
|
|
|
|
if t == nil {
|
|
return nil
|
|
}
|
|
|
|
return t.(IGroupContext)
|
|
}
|
|
|
|
func (s *ElementContext) RowRange() IRowRangeContext {
|
|
var t = s.GetTypedRuleContext(reflect.TypeOf((*IRowRangeContext)(nil)).Elem(), 0)
|
|
|
|
if t == nil {
|
|
return nil
|
|
}
|
|
|
|
return t.(IRowRangeContext)
|
|
}
|
|
|
|
func (s *ElementContext) Fn() IFnContext {
|
|
var t = s.GetTypedRuleContext(reflect.TypeOf((*IFnContext)(nil)).Elem(), 0)
|
|
|
|
if t == nil {
|
|
return nil
|
|
}
|
|
|
|
return t.(IFnContext)
|
|
}
|
|
|
|
func (s *ElementContext) Expr() IExprContext {
|
|
var t = s.GetTypedRuleContext(reflect.TypeOf((*IExprContext)(nil)).Elem(), 0)
|
|
|
|
if t == nil {
|
|
return nil
|
|
}
|
|
|
|
return t.(IExprContext)
|
|
}
|
|
|
|
func (s *ElementContext) GetRuleContext() antlr.RuleContext {
|
|
return s
|
|
}
|
|
|
|
func (s *ElementContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
|
|
return antlr.TreesStringTree(s, ruleNames, recog)
|
|
}
|
|
|
|
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{} {
|
|
switch t := visitor.(type) {
|
|
case SLQVisitor:
|
|
return t.VisitElement(s)
|
|
|
|
default:
|
|
return t.VisitChildren(s)
|
|
}
|
|
}
|
|
|
|
func (p *SLQParser) Element() (localctx IElementContext) {
|
|
localctx = NewElementContext(p, p.GetParserRuleContext(), p.GetState())
|
|
p.EnterRule(localctx, 6, SLQParserRULE_element)
|
|
|
|
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(82)
|
|
p.GetErrorHandler().Sync(p)
|
|
switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 6, p.GetParserRuleContext()) {
|
|
case 1:
|
|
p.EnterOuterAlt(localctx, 1)
|
|
{
|
|
p.SetState(74)
|
|
p.DsTblElement()
|
|
}
|
|
|
|
case 2:
|
|
p.EnterOuterAlt(localctx, 2)
|
|
{
|
|
p.SetState(75)
|
|
p.DsElement()
|
|
}
|
|
|
|
case 3:
|
|
p.EnterOuterAlt(localctx, 3)
|
|
{
|
|
p.SetState(76)
|
|
p.SelElement()
|
|
}
|
|
|
|
case 4:
|
|
p.EnterOuterAlt(localctx, 4)
|
|
{
|
|
p.SetState(77)
|
|
p.Join()
|
|
}
|
|
|
|
case 5:
|
|
p.EnterOuterAlt(localctx, 5)
|
|
{
|
|
p.SetState(78)
|
|
p.Group()
|
|
}
|
|
|
|
case 6:
|
|
p.EnterOuterAlt(localctx, 6)
|
|
{
|
|
p.SetState(79)
|
|
p.RowRange()
|
|
}
|
|
|
|
case 7:
|
|
p.EnterOuterAlt(localctx, 7)
|
|
{
|
|
p.SetState(80)
|
|
p.Fn()
|
|
}
|
|
|
|
case 8:
|
|
p.EnterOuterAlt(localctx, 8)
|
|
{
|
|
p.SetState(81)
|
|
p.expr(0)
|
|
}
|
|
|
|
}
|
|
|
|
return localctx
|
|
}
|
|
|
|
// ICmprContext is an interface to support dynamic dispatch.
|
|
type ICmprContext interface {
|
|
antlr.ParserRuleContext
|
|
|
|
// GetParser returns the parser.
|
|
GetParser() antlr.Parser
|
|
|
|
// IsCmprContext differentiates from other interfaces.
|
|
IsCmprContext()
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
func (*CmprContext) IsCmprContext() {}
|
|
|
|
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
|
|
}
|
|
|
|
func (s *CmprContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
|
|
return antlr.TreesStringTree(s, ruleNames, recog)
|
|
}
|
|
|
|
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{} {
|
|
switch t := visitor.(type) {
|
|
case SLQVisitor:
|
|
return t.VisitCmpr(s)
|
|
|
|
default:
|
|
return t.VisitChildren(s)
|
|
}
|
|
}
|
|
|
|
func (p *SLQParser) Cmpr() (localctx ICmprContext) {
|
|
localctx = NewCmprContext(p, p.GetParserRuleContext(), p.GetState())
|
|
p.EnterRule(localctx, 8, SLQParserRULE_cmpr)
|
|
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(84)
|
|
_la = p.GetTokenStream().LA(1)
|
|
|
|
if !(((_la-41)&-(0x1f+1)) == 0 && ((1<<uint((_la-41)))&((1<<(SLQParserLT_EQ-41))|(1<<(SLQParserLT-41))|(1<<(SLQParserGT_EQ-41))|(1<<(SLQParserGT-41))|(1<<(SLQParserNEQ-41))|(1<<(SLQParserEQ-41)))) != 0) {
|
|
p.GetErrorHandler().RecoverInline(p)
|
|
} else {
|
|
p.GetErrorHandler().ReportMatch(p)
|
|
p.Consume()
|
|
}
|
|
}
|
|
|
|
return localctx
|
|
}
|
|
|
|
// IFnContext is an interface to support dynamic dispatch.
|
|
type IFnContext interface {
|
|
antlr.ParserRuleContext
|
|
|
|
// GetParser returns the parser.
|
|
GetParser() antlr.Parser
|
|
|
|
// IsFnContext differentiates from other interfaces.
|
|
IsFnContext()
|
|
}
|
|
|
|
type FnContext struct {
|
|
*antlr.BaseParserRuleContext
|
|
parser antlr.Parser
|
|
}
|
|
|
|
func NewEmptyFnContext() *FnContext {
|
|
var p = new(FnContext)
|
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
|
p.RuleIndex = SLQParserRULE_fn
|
|
return p
|
|
}
|
|
|
|
func (*FnContext) IsFnContext() {}
|
|
|
|
func NewFnContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *FnContext {
|
|
var p = new(FnContext)
|
|
|
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
|
|
|
p.parser = parser
|
|
p.RuleIndex = SLQParserRULE_fn
|
|
|
|
return p
|
|
}
|
|
|
|
func (s *FnContext) GetParser() antlr.Parser { return s.parser }
|
|
|
|
func (s *FnContext) FnName() IFnNameContext {
|
|
var t = s.GetTypedRuleContext(reflect.TypeOf((*IFnNameContext)(nil)).Elem(), 0)
|
|
|
|
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)
|
|
}
|
|
|
|
func (s *FnContext) AllExpr() []IExprContext {
|
|
var ts = s.GetTypedRuleContexts(reflect.TypeOf((*IExprContext)(nil)).Elem())
|
|
var tst = make([]IExprContext, len(ts))
|
|
|
|
for i, t := range ts {
|
|
if t != nil {
|
|
tst[i] = t.(IExprContext)
|
|
}
|
|
}
|
|
|
|
return tst
|
|
}
|
|
|
|
func (s *FnContext) Expr(i int) IExprContext {
|
|
var t = s.GetTypedRuleContext(reflect.TypeOf((*IExprContext)(nil)).Elem(), i)
|
|
|
|
if t == nil {
|
|
return nil
|
|
}
|
|
|
|
return t.(IExprContext)
|
|
}
|
|
|
|
func (s *FnContext) AllCOMMA() []antlr.TerminalNode {
|
|
return s.GetTokens(SLQParserCOMMA)
|
|
}
|
|
|
|
func (s *FnContext) COMMA(i int) antlr.TerminalNode {
|
|
return s.GetToken(SLQParserCOMMA, i)
|
|
}
|
|
|
|
func (s *FnContext) GetRuleContext() antlr.RuleContext {
|
|
return s
|
|
}
|
|
|
|
func (s *FnContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
|
|
return antlr.TreesStringTree(s, ruleNames, recog)
|
|
}
|
|
|
|
func (s *FnContext) EnterRule(listener antlr.ParseTreeListener) {
|
|
if listenerT, ok := listener.(SLQListener); ok {
|
|
listenerT.EnterFn(s)
|
|
}
|
|
}
|
|
|
|
func (s *FnContext) ExitRule(listener antlr.ParseTreeListener) {
|
|
if listenerT, ok := listener.(SLQListener); ok {
|
|
listenerT.ExitFn(s)
|
|
}
|
|
}
|
|
|
|
func (s *FnContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
|
switch t := visitor.(type) {
|
|
case SLQVisitor:
|
|
return t.VisitFn(s)
|
|
|
|
default:
|
|
return t.VisitChildren(s)
|
|
}
|
|
}
|
|
|
|
func (p *SLQParser) Fn() (localctx IFnContext) {
|
|
localctx = NewFnContext(p, p.GetParserRuleContext(), p.GetState())
|
|
p.EnterRule(localctx, 10, SLQParserRULE_fn)
|
|
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(86)
|
|
p.FnName()
|
|
}
|
|
{
|
|
p.SetState(87)
|
|
p.Match(SLQParserLPAR)
|
|
}
|
|
p.SetState(97)
|
|
p.GetErrorHandler().Sync(p)
|
|
|
|
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, SLQParserSEL, SLQParserSTRING:
|
|
{
|
|
p.SetState(88)
|
|
p.expr(0)
|
|
}
|
|
p.SetState(93)
|
|
p.GetErrorHandler().Sync(p)
|
|
_la = p.GetTokenStream().LA(1)
|
|
|
|
for _la == SLQParserCOMMA {
|
|
{
|
|
p.SetState(89)
|
|
p.Match(SLQParserCOMMA)
|
|
}
|
|
{
|
|
p.SetState(90)
|
|
p.expr(0)
|
|
}
|
|
|
|
p.SetState(95)
|
|
p.GetErrorHandler().Sync(p)
|
|
_la = p.GetTokenStream().LA(1)
|
|
}
|
|
|
|
case SLQParserT__1:
|
|
{
|
|
p.SetState(96)
|
|
p.Match(SLQParserT__1)
|
|
}
|
|
|
|
case SLQParserRPAR:
|
|
|
|
default:
|
|
}
|
|
{
|
|
p.SetState(99)
|
|
p.Match(SLQParserRPAR)
|
|
}
|
|
|
|
return localctx
|
|
}
|
|
|
|
// IJoinContext is an interface to support dynamic dispatch.
|
|
type IJoinContext interface {
|
|
antlr.ParserRuleContext
|
|
|
|
// GetParser returns the parser.
|
|
GetParser() antlr.Parser
|
|
|
|
// IsJoinContext differentiates from other interfaces.
|
|
IsJoinContext()
|
|
}
|
|
|
|
type JoinContext struct {
|
|
*antlr.BaseParserRuleContext
|
|
parser antlr.Parser
|
|
}
|
|
|
|
func NewEmptyJoinContext() *JoinContext {
|
|
var p = new(JoinContext)
|
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
|
p.RuleIndex = SLQParserRULE_join
|
|
return p
|
|
}
|
|
|
|
func (*JoinContext) IsJoinContext() {}
|
|
|
|
func NewJoinContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *JoinContext {
|
|
var p = new(JoinContext)
|
|
|
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
|
|
|
p.parser = parser
|
|
p.RuleIndex = SLQParserRULE_join
|
|
|
|
return p
|
|
}
|
|
|
|
func (s *JoinContext) GetParser() antlr.Parser { return s.parser }
|
|
|
|
func (s *JoinContext) LPAR() antlr.TerminalNode {
|
|
return s.GetToken(SLQParserLPAR, 0)
|
|
}
|
|
|
|
func (s *JoinContext) JoinConstraint() IJoinConstraintContext {
|
|
var t = s.GetTypedRuleContext(reflect.TypeOf((*IJoinConstraintContext)(nil)).Elem(), 0)
|
|
|
|
if t == nil {
|
|
return nil
|
|
}
|
|
|
|
return t.(IJoinConstraintContext)
|
|
}
|
|
|
|
func (s *JoinContext) RPAR() antlr.TerminalNode {
|
|
return s.GetToken(SLQParserRPAR, 0)
|
|
}
|
|
|
|
func (s *JoinContext) GetRuleContext() antlr.RuleContext {
|
|
return s
|
|
}
|
|
|
|
func (s *JoinContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
|
|
return antlr.TreesStringTree(s, ruleNames, recog)
|
|
}
|
|
|
|
func (s *JoinContext) EnterRule(listener antlr.ParseTreeListener) {
|
|
if listenerT, ok := listener.(SLQListener); ok {
|
|
listenerT.EnterJoin(s)
|
|
}
|
|
}
|
|
|
|
func (s *JoinContext) ExitRule(listener antlr.ParseTreeListener) {
|
|
if listenerT, ok := listener.(SLQListener); ok {
|
|
listenerT.ExitJoin(s)
|
|
}
|
|
}
|
|
|
|
func (s *JoinContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
|
switch t := visitor.(type) {
|
|
case SLQVisitor:
|
|
return t.VisitJoin(s)
|
|
|
|
default:
|
|
return t.VisitChildren(s)
|
|
}
|
|
}
|
|
|
|
func (p *SLQParser) Join() (localctx IJoinContext) {
|
|
localctx = NewJoinContext(p, p.GetParserRuleContext(), p.GetState())
|
|
p.EnterRule(localctx, 12, SLQParserRULE_join)
|
|
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(101)
|
|
_la = p.GetTokenStream().LA(1)
|
|
|
|
if !(((_la)&-(0x1f+1)) == 0 && ((1<<uint(_la))&((1<<SLQParserT__2)|(1<<SLQParserT__3)|(1<<SLQParserT__4))) != 0) {
|
|
p.GetErrorHandler().RecoverInline(p)
|
|
} else {
|
|
p.GetErrorHandler().ReportMatch(p)
|
|
p.Consume()
|
|
}
|
|
}
|
|
{
|
|
p.SetState(102)
|
|
p.Match(SLQParserLPAR)
|
|
}
|
|
{
|
|
p.SetState(103)
|
|
p.JoinConstraint()
|
|
}
|
|
{
|
|
p.SetState(104)
|
|
p.Match(SLQParserRPAR)
|
|
}
|
|
|
|
return localctx
|
|
}
|
|
|
|
// IJoinConstraintContext is an interface to support dynamic dispatch.
|
|
type IJoinConstraintContext interface {
|
|
antlr.ParserRuleContext
|
|
|
|
// GetParser returns the parser.
|
|
GetParser() antlr.Parser
|
|
|
|
// IsJoinConstraintContext differentiates from other interfaces.
|
|
IsJoinConstraintContext()
|
|
}
|
|
|
|
type JoinConstraintContext struct {
|
|
*antlr.BaseParserRuleContext
|
|
parser antlr.Parser
|
|
}
|
|
|
|
func NewEmptyJoinConstraintContext() *JoinConstraintContext {
|
|
var p = new(JoinConstraintContext)
|
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
|
p.RuleIndex = SLQParserRULE_joinConstraint
|
|
return p
|
|
}
|
|
|
|
func (*JoinConstraintContext) IsJoinConstraintContext() {}
|
|
|
|
func NewJoinConstraintContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *JoinConstraintContext {
|
|
var p = new(JoinConstraintContext)
|
|
|
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
|
|
|
p.parser = parser
|
|
p.RuleIndex = SLQParserRULE_joinConstraint
|
|
|
|
return p
|
|
}
|
|
|
|
func (s *JoinConstraintContext) GetParser() antlr.Parser { return s.parser }
|
|
|
|
func (s *JoinConstraintContext) AllSEL() []antlr.TerminalNode {
|
|
return s.GetTokens(SLQParserSEL)
|
|
}
|
|
|
|
func (s *JoinConstraintContext) SEL(i int) antlr.TerminalNode {
|
|
return s.GetToken(SLQParserSEL, i)
|
|
}
|
|
|
|
func (s *JoinConstraintContext) Cmpr() ICmprContext {
|
|
var t = s.GetTypedRuleContext(reflect.TypeOf((*ICmprContext)(nil)).Elem(), 0)
|
|
|
|
if t == nil {
|
|
return nil
|
|
}
|
|
|
|
return t.(ICmprContext)
|
|
}
|
|
|
|
func (s *JoinConstraintContext) GetRuleContext() antlr.RuleContext {
|
|
return s
|
|
}
|
|
|
|
func (s *JoinConstraintContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
|
|
return antlr.TreesStringTree(s, ruleNames, recog)
|
|
}
|
|
|
|
func (s *JoinConstraintContext) EnterRule(listener antlr.ParseTreeListener) {
|
|
if listenerT, ok := listener.(SLQListener); ok {
|
|
listenerT.EnterJoinConstraint(s)
|
|
}
|
|
}
|
|
|
|
func (s *JoinConstraintContext) ExitRule(listener antlr.ParseTreeListener) {
|
|
if listenerT, ok := listener.(SLQListener); ok {
|
|
listenerT.ExitJoinConstraint(s)
|
|
}
|
|
}
|
|
|
|
func (s *JoinConstraintContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
|
switch t := visitor.(type) {
|
|
case SLQVisitor:
|
|
return t.VisitJoinConstraint(s)
|
|
|
|
default:
|
|
return t.VisitChildren(s)
|
|
}
|
|
}
|
|
|
|
func (p *SLQParser) JoinConstraint() (localctx IJoinConstraintContext) {
|
|
localctx = NewJoinConstraintContext(p, p.GetParserRuleContext(), p.GetState())
|
|
p.EnterRule(localctx, 14, SLQParserRULE_joinConstraint)
|
|
|
|
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(111)
|
|
p.GetErrorHandler().Sync(p)
|
|
switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 9, p.GetParserRuleContext()) {
|
|
case 1:
|
|
p.EnterOuterAlt(localctx, 1)
|
|
{
|
|
p.SetState(106)
|
|
p.Match(SLQParserSEL)
|
|
}
|
|
{
|
|
p.SetState(107)
|
|
p.Cmpr()
|
|
}
|
|
{
|
|
p.SetState(108)
|
|
p.Match(SLQParserSEL)
|
|
}
|
|
|
|
case 2:
|
|
p.EnterOuterAlt(localctx, 2)
|
|
{
|
|
p.SetState(110)
|
|
p.Match(SLQParserSEL)
|
|
}
|
|
|
|
}
|
|
|
|
return localctx
|
|
}
|
|
|
|
// IGroupContext is an interface to support dynamic dispatch.
|
|
type IGroupContext interface {
|
|
antlr.ParserRuleContext
|
|
|
|
// GetParser returns the parser.
|
|
GetParser() antlr.Parser
|
|
|
|
// IsGroupContext differentiates from other interfaces.
|
|
IsGroupContext()
|
|
}
|
|
|
|
type GroupContext struct {
|
|
*antlr.BaseParserRuleContext
|
|
parser antlr.Parser
|
|
}
|
|
|
|
func NewEmptyGroupContext() *GroupContext {
|
|
var p = new(GroupContext)
|
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
|
p.RuleIndex = SLQParserRULE_group
|
|
return p
|
|
}
|
|
|
|
func (*GroupContext) IsGroupContext() {}
|
|
|
|
func NewGroupContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *GroupContext {
|
|
var p = new(GroupContext)
|
|
|
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
|
|
|
p.parser = parser
|
|
p.RuleIndex = SLQParserRULE_group
|
|
|
|
return p
|
|
}
|
|
|
|
func (s *GroupContext) GetParser() antlr.Parser { return s.parser }
|
|
|
|
func (s *GroupContext) LPAR() antlr.TerminalNode {
|
|
return s.GetToken(SLQParserLPAR, 0)
|
|
}
|
|
|
|
func (s *GroupContext) AllSEL() []antlr.TerminalNode {
|
|
return s.GetTokens(SLQParserSEL)
|
|
}
|
|
|
|
func (s *GroupContext) SEL(i int) antlr.TerminalNode {
|
|
return s.GetToken(SLQParserSEL, i)
|
|
}
|
|
|
|
func (s *GroupContext) RPAR() antlr.TerminalNode {
|
|
return s.GetToken(SLQParserRPAR, 0)
|
|
}
|
|
|
|
func (s *GroupContext) AllCOMMA() []antlr.TerminalNode {
|
|
return s.GetTokens(SLQParserCOMMA)
|
|
}
|
|
|
|
func (s *GroupContext) COMMA(i int) antlr.TerminalNode {
|
|
return s.GetToken(SLQParserCOMMA, i)
|
|
}
|
|
|
|
func (s *GroupContext) GetRuleContext() antlr.RuleContext {
|
|
return s
|
|
}
|
|
|
|
func (s *GroupContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
|
|
return antlr.TreesStringTree(s, ruleNames, recog)
|
|
}
|
|
|
|
func (s *GroupContext) EnterRule(listener antlr.ParseTreeListener) {
|
|
if listenerT, ok := listener.(SLQListener); ok {
|
|
listenerT.EnterGroup(s)
|
|
}
|
|
}
|
|
|
|
func (s *GroupContext) ExitRule(listener antlr.ParseTreeListener) {
|
|
if listenerT, ok := listener.(SLQListener); ok {
|
|
listenerT.ExitGroup(s)
|
|
}
|
|
}
|
|
|
|
func (s *GroupContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
|
switch t := visitor.(type) {
|
|
case SLQVisitor:
|
|
return t.VisitGroup(s)
|
|
|
|
default:
|
|
return t.VisitChildren(s)
|
|
}
|
|
}
|
|
|
|
func (p *SLQParser) Group() (localctx IGroupContext) {
|
|
localctx = NewGroupContext(p, p.GetParserRuleContext(), p.GetState())
|
|
p.EnterRule(localctx, 16, SLQParserRULE_group)
|
|
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(113)
|
|
_la = p.GetTokenStream().LA(1)
|
|
|
|
if !(((_la)&-(0x1f+1)) == 0 && ((1<<uint(_la))&((1<<SLQParserT__5)|(1<<SLQParserT__6)|(1<<SLQParserT__7))) != 0) {
|
|
p.GetErrorHandler().RecoverInline(p)
|
|
} else {
|
|
p.GetErrorHandler().ReportMatch(p)
|
|
p.Consume()
|
|
}
|
|
}
|
|
{
|
|
p.SetState(114)
|
|
p.Match(SLQParserLPAR)
|
|
}
|
|
{
|
|
p.SetState(115)
|
|
p.Match(SLQParserSEL)
|
|
}
|
|
p.SetState(120)
|
|
p.GetErrorHandler().Sync(p)
|
|
_la = p.GetTokenStream().LA(1)
|
|
|
|
for _la == SLQParserCOMMA {
|
|
{
|
|
p.SetState(116)
|
|
p.Match(SLQParserCOMMA)
|
|
}
|
|
{
|
|
p.SetState(117)
|
|
p.Match(SLQParserSEL)
|
|
}
|
|
|
|
p.SetState(122)
|
|
p.GetErrorHandler().Sync(p)
|
|
_la = p.GetTokenStream().LA(1)
|
|
}
|
|
{
|
|
p.SetState(123)
|
|
p.Match(SLQParserRPAR)
|
|
}
|
|
|
|
return localctx
|
|
}
|
|
|
|
// ISelElementContext is an interface to support dynamic dispatch.
|
|
type ISelElementContext interface {
|
|
antlr.ParserRuleContext
|
|
|
|
// GetParser returns the parser.
|
|
GetParser() antlr.Parser
|
|
|
|
// IsSelElementContext differentiates from other interfaces.
|
|
IsSelElementContext()
|
|
}
|
|
|
|
type SelElementContext struct {
|
|
*antlr.BaseParserRuleContext
|
|
parser antlr.Parser
|
|
}
|
|
|
|
func NewEmptySelElementContext() *SelElementContext {
|
|
var p = new(SelElementContext)
|
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
|
p.RuleIndex = SLQParserRULE_selElement
|
|
return p
|
|
}
|
|
|
|
func (*SelElementContext) IsSelElementContext() {}
|
|
|
|
func NewSelElementContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *SelElementContext {
|
|
var p = new(SelElementContext)
|
|
|
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
|
|
|
p.parser = parser
|
|
p.RuleIndex = SLQParserRULE_selElement
|
|
|
|
return p
|
|
}
|
|
|
|
func (s *SelElementContext) GetParser() antlr.Parser { return s.parser }
|
|
|
|
func (s *SelElementContext) SEL() antlr.TerminalNode {
|
|
return s.GetToken(SLQParserSEL, 0)
|
|
}
|
|
|
|
func (s *SelElementContext) GetRuleContext() antlr.RuleContext {
|
|
return s
|
|
}
|
|
|
|
func (s *SelElementContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
|
|
return antlr.TreesStringTree(s, ruleNames, recog)
|
|
}
|
|
|
|
func (s *SelElementContext) EnterRule(listener antlr.ParseTreeListener) {
|
|
if listenerT, ok := listener.(SLQListener); ok {
|
|
listenerT.EnterSelElement(s)
|
|
}
|
|
}
|
|
|
|
func (s *SelElementContext) ExitRule(listener antlr.ParseTreeListener) {
|
|
if listenerT, ok := listener.(SLQListener); ok {
|
|
listenerT.ExitSelElement(s)
|
|
}
|
|
}
|
|
|
|
func (s *SelElementContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
|
switch t := visitor.(type) {
|
|
case SLQVisitor:
|
|
return t.VisitSelElement(s)
|
|
|
|
default:
|
|
return t.VisitChildren(s)
|
|
}
|
|
}
|
|
|
|
func (p *SLQParser) SelElement() (localctx ISelElementContext) {
|
|
localctx = NewSelElementContext(p, p.GetParserRuleContext(), p.GetState())
|
|
p.EnterRule(localctx, 18, SLQParserRULE_selElement)
|
|
|
|
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(125)
|
|
p.Match(SLQParserSEL)
|
|
}
|
|
|
|
return localctx
|
|
}
|
|
|
|
// IDsTblElementContext is an interface to support dynamic dispatch.
|
|
type IDsTblElementContext interface {
|
|
antlr.ParserRuleContext
|
|
|
|
// GetParser returns the parser.
|
|
GetParser() antlr.Parser
|
|
|
|
// IsDsTblElementContext differentiates from other interfaces.
|
|
IsDsTblElementContext()
|
|
}
|
|
|
|
type DsTblElementContext struct {
|
|
*antlr.BaseParserRuleContext
|
|
parser antlr.Parser
|
|
}
|
|
|
|
func NewEmptyDsTblElementContext() *DsTblElementContext {
|
|
var p = new(DsTblElementContext)
|
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
|
p.RuleIndex = SLQParserRULE_dsTblElement
|
|
return p
|
|
}
|
|
|
|
func (*DsTblElementContext) IsDsTblElementContext() {}
|
|
|
|
func NewDsTblElementContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *DsTblElementContext {
|
|
var p = new(DsTblElementContext)
|
|
|
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
|
|
|
p.parser = parser
|
|
p.RuleIndex = SLQParserRULE_dsTblElement
|
|
|
|
return p
|
|
}
|
|
|
|
func (s *DsTblElementContext) GetParser() antlr.Parser { return s.parser }
|
|
|
|
func (s *DsTblElementContext) DATASOURCE() antlr.TerminalNode {
|
|
return s.GetToken(SLQParserDATASOURCE, 0)
|
|
}
|
|
|
|
func (s *DsTblElementContext) SEL() antlr.TerminalNode {
|
|
return s.GetToken(SLQParserSEL, 0)
|
|
}
|
|
|
|
func (s *DsTblElementContext) GetRuleContext() antlr.RuleContext {
|
|
return s
|
|
}
|
|
|
|
func (s *DsTblElementContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
|
|
return antlr.TreesStringTree(s, ruleNames, recog)
|
|
}
|
|
|
|
func (s *DsTblElementContext) EnterRule(listener antlr.ParseTreeListener) {
|
|
if listenerT, ok := listener.(SLQListener); ok {
|
|
listenerT.EnterDsTblElement(s)
|
|
}
|
|
}
|
|
|
|
func (s *DsTblElementContext) ExitRule(listener antlr.ParseTreeListener) {
|
|
if listenerT, ok := listener.(SLQListener); ok {
|
|
listenerT.ExitDsTblElement(s)
|
|
}
|
|
}
|
|
|
|
func (s *DsTblElementContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
|
switch t := visitor.(type) {
|
|
case SLQVisitor:
|
|
return t.VisitDsTblElement(s)
|
|
|
|
default:
|
|
return t.VisitChildren(s)
|
|
}
|
|
}
|
|
|
|
func (p *SLQParser) DsTblElement() (localctx IDsTblElementContext) {
|
|
localctx = NewDsTblElementContext(p, p.GetParserRuleContext(), p.GetState())
|
|
p.EnterRule(localctx, 20, SLQParserRULE_dsTblElement)
|
|
|
|
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(127)
|
|
p.Match(SLQParserDATASOURCE)
|
|
}
|
|
{
|
|
p.SetState(128)
|
|
p.Match(SLQParserSEL)
|
|
}
|
|
|
|
return localctx
|
|
}
|
|
|
|
// IDsElementContext is an interface to support dynamic dispatch.
|
|
type IDsElementContext interface {
|
|
antlr.ParserRuleContext
|
|
|
|
// GetParser returns the parser.
|
|
GetParser() antlr.Parser
|
|
|
|
// IsDsElementContext differentiates from other interfaces.
|
|
IsDsElementContext()
|
|
}
|
|
|
|
type DsElementContext struct {
|
|
*antlr.BaseParserRuleContext
|
|
parser antlr.Parser
|
|
}
|
|
|
|
func NewEmptyDsElementContext() *DsElementContext {
|
|
var p = new(DsElementContext)
|
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
|
p.RuleIndex = SLQParserRULE_dsElement
|
|
return p
|
|
}
|
|
|
|
func (*DsElementContext) IsDsElementContext() {}
|
|
|
|
func NewDsElementContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *DsElementContext {
|
|
var p = new(DsElementContext)
|
|
|
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
|
|
|
p.parser = parser
|
|
p.RuleIndex = SLQParserRULE_dsElement
|
|
|
|
return p
|
|
}
|
|
|
|
func (s *DsElementContext) GetParser() antlr.Parser { return s.parser }
|
|
|
|
func (s *DsElementContext) DATASOURCE() antlr.TerminalNode {
|
|
return s.GetToken(SLQParserDATASOURCE, 0)
|
|
}
|
|
|
|
func (s *DsElementContext) GetRuleContext() antlr.RuleContext {
|
|
return s
|
|
}
|
|
|
|
func (s *DsElementContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
|
|
return antlr.TreesStringTree(s, ruleNames, recog)
|
|
}
|
|
|
|
func (s *DsElementContext) EnterRule(listener antlr.ParseTreeListener) {
|
|
if listenerT, ok := listener.(SLQListener); ok {
|
|
listenerT.EnterDsElement(s)
|
|
}
|
|
}
|
|
|
|
func (s *DsElementContext) ExitRule(listener antlr.ParseTreeListener) {
|
|
if listenerT, ok := listener.(SLQListener); ok {
|
|
listenerT.ExitDsElement(s)
|
|
}
|
|
}
|
|
|
|
func (s *DsElementContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
|
switch t := visitor.(type) {
|
|
case SLQVisitor:
|
|
return t.VisitDsElement(s)
|
|
|
|
default:
|
|
return t.VisitChildren(s)
|
|
}
|
|
}
|
|
|
|
func (p *SLQParser) DsElement() (localctx IDsElementContext) {
|
|
localctx = NewDsElementContext(p, p.GetParserRuleContext(), p.GetState())
|
|
p.EnterRule(localctx, 22, SLQParserRULE_dsElement)
|
|
|
|
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(130)
|
|
p.Match(SLQParserDATASOURCE)
|
|
}
|
|
|
|
return localctx
|
|
}
|
|
|
|
// IRowRangeContext is an interface to support dynamic dispatch.
|
|
type IRowRangeContext interface {
|
|
antlr.ParserRuleContext
|
|
|
|
// GetParser returns the parser.
|
|
GetParser() antlr.Parser
|
|
|
|
// IsRowRangeContext differentiates from other interfaces.
|
|
IsRowRangeContext()
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
func (*RowRangeContext) IsRowRangeContext() {}
|
|
|
|
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 }
|
|
|
|
func (s *RowRangeContext) RBRA() antlr.TerminalNode {
|
|
return s.GetToken(SLQParserRBRA, 0)
|
|
}
|
|
|
|
func (s *RowRangeContext) AllNN() []antlr.TerminalNode {
|
|
return s.GetTokens(SLQParserNN)
|
|
}
|
|
|
|
func (s *RowRangeContext) NN(i int) antlr.TerminalNode {
|
|
return s.GetToken(SLQParserNN, i)
|
|
}
|
|
|
|
func (s *RowRangeContext) COLON() antlr.TerminalNode {
|
|
return s.GetToken(SLQParserCOLON, 0)
|
|
}
|
|
|
|
func (s *RowRangeContext) GetRuleContext() antlr.RuleContext {
|
|
return s
|
|
}
|
|
|
|
func (s *RowRangeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
|
|
return antlr.TreesStringTree(s, ruleNames, recog)
|
|
}
|
|
|
|
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{} {
|
|
switch t := visitor.(type) {
|
|
case SLQVisitor:
|
|
return t.VisitRowRange(s)
|
|
|
|
default:
|
|
return t.VisitChildren(s)
|
|
}
|
|
}
|
|
|
|
func (p *SLQParser) RowRange() (localctx IRowRangeContext) {
|
|
localctx = NewRowRangeContext(p, p.GetParserRuleContext(), p.GetState())
|
|
p.EnterRule(localctx, 24, SLQParserRULE_rowRange)
|
|
|
|
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(132)
|
|
p.Match(SLQParserT__8)
|
|
}
|
|
p.SetState(141)
|
|
p.GetErrorHandler().Sync(p)
|
|
|
|
if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 11, p.GetParserRuleContext()) == 1 {
|
|
{
|
|
p.SetState(133)
|
|
p.Match(SLQParserNN)
|
|
}
|
|
{
|
|
p.SetState(134)
|
|
p.Match(SLQParserCOLON)
|
|
}
|
|
{
|
|
p.SetState(135)
|
|
p.Match(SLQParserNN)
|
|
}
|
|
|
|
} else if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 11, p.GetParserRuleContext()) == 2 {
|
|
{
|
|
p.SetState(136)
|
|
p.Match(SLQParserNN)
|
|
}
|
|
{
|
|
p.SetState(137)
|
|
p.Match(SLQParserCOLON)
|
|
}
|
|
|
|
} else if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 11, p.GetParserRuleContext()) == 3 {
|
|
{
|
|
p.SetState(138)
|
|
p.Match(SLQParserCOLON)
|
|
}
|
|
{
|
|
p.SetState(139)
|
|
p.Match(SLQParserNN)
|
|
}
|
|
|
|
} else if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 11, p.GetParserRuleContext()) == 4 {
|
|
{
|
|
p.SetState(140)
|
|
p.Match(SLQParserNN)
|
|
}
|
|
|
|
}
|
|
{
|
|
p.SetState(143)
|
|
p.Match(SLQParserRBRA)
|
|
}
|
|
|
|
return localctx
|
|
}
|
|
|
|
// IFnNameContext is an interface to support dynamic dispatch.
|
|
type IFnNameContext interface {
|
|
antlr.ParserRuleContext
|
|
|
|
// GetParser returns the parser.
|
|
GetParser() antlr.Parser
|
|
|
|
// IsFnNameContext differentiates from other interfaces.
|
|
IsFnNameContext()
|
|
}
|
|
|
|
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)
|
|
}
|
|
}
|
|
|
|
func (s *FnNameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
|
switch t := visitor.(type) {
|
|
case SLQVisitor:
|
|
return t.VisitFnName(s)
|
|
|
|
default:
|
|
return t.VisitChildren(s)
|
|
}
|
|
}
|
|
|
|
func (p *SLQParser) FnName() (localctx IFnNameContext) {
|
|
localctx = NewFnNameContext(p, p.GetParserRuleContext(), p.GetState())
|
|
p.EnterRule(localctx, 26, SLQParserRULE_fnName)
|
|
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(145)
|
|
_la = p.GetTokenStream().LA(1)
|
|
|
|
if !(((_la)&-(0x1f+1)) == 0 && ((1<<uint(_la))&((1<<SLQParserT__9)|(1<<SLQParserT__10)|(1<<SLQParserT__11)|(1<<SLQParserT__12)|(1<<SLQParserT__13)|(1<<SLQParserT__14)|(1<<SLQParserT__15)|(1<<SLQParserT__16))) != 0) {
|
|
p.GetErrorHandler().RecoverInline(p)
|
|
} else {
|
|
p.GetErrorHandler().ReportMatch(p)
|
|
p.Consume()
|
|
}
|
|
}
|
|
|
|
return localctx
|
|
}
|
|
|
|
// IExprContext is an interface to support dynamic dispatch.
|
|
type IExprContext interface {
|
|
antlr.ParserRuleContext
|
|
|
|
// GetParser returns the parser.
|
|
GetParser() antlr.Parser
|
|
|
|
// 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) SEL() antlr.TerminalNode {
|
|
return s.GetToken(SLQParserSEL, 0)
|
|
}
|
|
|
|
func (s *ExprContext) Literal() ILiteralContext {
|
|
var t = s.GetTypedRuleContext(reflect.TypeOf((*ILiteralContext)(nil)).Elem(), 0)
|
|
|
|
if t == nil {
|
|
return nil
|
|
}
|
|
|
|
return t.(ILiteralContext)
|
|
}
|
|
|
|
func (s *ExprContext) UnaryOperator() IUnaryOperatorContext {
|
|
var t = s.GetTypedRuleContext(reflect.TypeOf((*IUnaryOperatorContext)(nil)).Elem(), 0)
|
|
|
|
if t == nil {
|
|
return nil
|
|
}
|
|
|
|
return t.(IUnaryOperatorContext)
|
|
}
|
|
|
|
func (s *ExprContext) AllExpr() []IExprContext {
|
|
var ts = s.GetTypedRuleContexts(reflect.TypeOf((*IExprContext)(nil)).Elem())
|
|
var tst = make([]IExprContext, len(ts))
|
|
|
|
for i, t := range ts {
|
|
if t != nil {
|
|
tst[i] = t.(IExprContext)
|
|
}
|
|
}
|
|
|
|
return tst
|
|
}
|
|
|
|
func (s *ExprContext) Expr(i int) IExprContext {
|
|
var t = s.GetTypedRuleContext(reflect.TypeOf((*IExprContext)(nil)).Elem(), i)
|
|
|
|
if t == nil {
|
|
return nil
|
|
}
|
|
|
|
return t.(IExprContext)
|
|
}
|
|
|
|
func (s *ExprContext) Fn() IFnContext {
|
|
var t = s.GetTypedRuleContext(reflect.TypeOf((*IFnContext)(nil)).Elem(), 0)
|
|
|
|
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{} {
|
|
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) {
|
|
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 := 28
|
|
p.EnterRecursionRule(localctx, 28, SLQParserRULE_expr, _p)
|
|
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(154)
|
|
p.GetErrorHandler().Sync(p)
|
|
|
|
switch p.GetTokenStream().LA(1) {
|
|
case SLQParserSEL:
|
|
{
|
|
p.SetState(148)
|
|
p.Match(SLQParserSEL)
|
|
}
|
|
|
|
case SLQParserNULL, SLQParserNN, SLQParserNUMBER, SLQParserSTRING:
|
|
{
|
|
p.SetState(149)
|
|
p.Literal()
|
|
}
|
|
|
|
case SLQParserT__20, SLQParserT__21, SLQParserT__26, SLQParserT__27:
|
|
{
|
|
p.SetState(150)
|
|
p.UnaryOperator()
|
|
}
|
|
{
|
|
p.SetState(151)
|
|
p.expr(9)
|
|
}
|
|
|
|
case SLQParserT__9, SLQParserT__10, SLQParserT__11, SLQParserT__12, SLQParserT__13, SLQParserT__14, SLQParserT__15, SLQParserT__16:
|
|
{
|
|
p.SetState(153)
|
|
p.Fn()
|
|
}
|
|
|
|
default:
|
|
panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil))
|
|
}
|
|
p.GetParserRuleContext().SetStop(p.GetTokenStream().LT(-1))
|
|
p.SetState(183)
|
|
p.GetErrorHandler().Sync(p)
|
|
_alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 15, p.GetParserRuleContext())
|
|
|
|
for _alt != 2 && _alt != antlr.ATNInvalidAltNumber {
|
|
if _alt == 1 {
|
|
if p.GetParseListeners() != nil {
|
|
p.TriggerExitRuleEvent()
|
|
}
|
|
_prevctx = localctx
|
|
p.SetState(181)
|
|
p.GetErrorHandler().Sync(p)
|
|
switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 14, p.GetParserRuleContext()) {
|
|
case 1:
|
|
localctx = NewExprContext(p, _parentctx, _parentState)
|
|
p.PushNewRecursionContext(localctx, _startState, SLQParserRULE_expr)
|
|
p.SetState(156)
|
|
|
|
if !(p.Precpred(p.GetParserRuleContext(), 8)) {
|
|
panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 8)", ""))
|
|
}
|
|
{
|
|
p.SetState(157)
|
|
p.Match(SLQParserT__17)
|
|
}
|
|
{
|
|
p.SetState(158)
|
|
p.expr(9)
|
|
}
|
|
|
|
case 2:
|
|
localctx = NewExprContext(p, _parentctx, _parentState)
|
|
p.PushNewRecursionContext(localctx, _startState, SLQParserRULE_expr)
|
|
p.SetState(159)
|
|
|
|
if !(p.Precpred(p.GetParserRuleContext(), 7)) {
|
|
panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 7)", ""))
|
|
}
|
|
{
|
|
p.SetState(160)
|
|
_la = p.GetTokenStream().LA(1)
|
|
|
|
if !(((_la)&-(0x1f+1)) == 0 && ((1<<uint(_la))&((1<<SLQParserT__1)|(1<<SLQParserT__18)|(1<<SLQParserT__19))) != 0) {
|
|
p.GetErrorHandler().RecoverInline(p)
|
|
} else {
|
|
p.GetErrorHandler().ReportMatch(p)
|
|
p.Consume()
|
|
}
|
|
}
|
|
{
|
|
p.SetState(161)
|
|
p.expr(8)
|
|
}
|
|
|
|
case 3:
|
|
localctx = NewExprContext(p, _parentctx, _parentState)
|
|
p.PushNewRecursionContext(localctx, _startState, SLQParserRULE_expr)
|
|
p.SetState(162)
|
|
|
|
if !(p.Precpred(p.GetParserRuleContext(), 6)) {
|
|
panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 6)", ""))
|
|
}
|
|
{
|
|
p.SetState(163)
|
|
_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(164)
|
|
p.expr(7)
|
|
}
|
|
|
|
case 4:
|
|
localctx = NewExprContext(p, _parentctx, _parentState)
|
|
p.PushNewRecursionContext(localctx, _startState, SLQParserRULE_expr)
|
|
p.SetState(165)
|
|
|
|
if !(p.Precpred(p.GetParserRuleContext(), 5)) {
|
|
panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 5)", ""))
|
|
}
|
|
{
|
|
p.SetState(166)
|
|
_la = p.GetTokenStream().LA(1)
|
|
|
|
if !(((_la)&-(0x1f+1)) == 0 && ((1<<uint(_la))&((1<<SLQParserT__22)|(1<<SLQParserT__23)|(1<<SLQParserT__24))) != 0) {
|
|
p.GetErrorHandler().RecoverInline(p)
|
|
} else {
|
|
p.GetErrorHandler().ReportMatch(p)
|
|
p.Consume()
|
|
}
|
|
}
|
|
{
|
|
p.SetState(167)
|
|
p.expr(6)
|
|
}
|
|
|
|
case 5:
|
|
localctx = NewExprContext(p, _parentctx, _parentState)
|
|
p.PushNewRecursionContext(localctx, _startState, SLQParserRULE_expr)
|
|
p.SetState(168)
|
|
|
|
if !(p.Precpred(p.GetParserRuleContext(), 4)) {
|
|
panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 4)", ""))
|
|
}
|
|
{
|
|
p.SetState(169)
|
|
_la = p.GetTokenStream().LA(1)
|
|
|
|
if !(((_la-41)&-(0x1f+1)) == 0 && ((1<<uint((_la-41)))&((1<<(SLQParserLT_EQ-41))|(1<<(SLQParserLT-41))|(1<<(SLQParserGT_EQ-41))|(1<<(SLQParserGT-41)))) != 0) {
|
|
p.GetErrorHandler().RecoverInline(p)
|
|
} else {
|
|
p.GetErrorHandler().ReportMatch(p)
|
|
p.Consume()
|
|
}
|
|
}
|
|
{
|
|
p.SetState(170)
|
|
p.expr(5)
|
|
}
|
|
|
|
case 6:
|
|
localctx = NewExprContext(p, _parentctx, _parentState)
|
|
p.PushNewRecursionContext(localctx, _startState, SLQParserRULE_expr)
|
|
p.SetState(171)
|
|
|
|
if !(p.Precpred(p.GetParserRuleContext(), 3)) {
|
|
panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 3)", ""))
|
|
}
|
|
p.SetState(175)
|
|
p.GetErrorHandler().Sync(p)
|
|
|
|
switch p.GetTokenStream().LA(1) {
|
|
case SLQParserEQ:
|
|
{
|
|
p.SetState(172)
|
|
p.Match(SLQParserEQ)
|
|
}
|
|
|
|
case SLQParserNEQ:
|
|
{
|
|
p.SetState(173)
|
|
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, SLQParserSEL, SLQParserSTRING:
|
|
|
|
default:
|
|
panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil))
|
|
}
|
|
{
|
|
p.SetState(177)
|
|
p.expr(4)
|
|
}
|
|
|
|
case 7:
|
|
localctx = NewExprContext(p, _parentctx, _parentState)
|
|
p.PushNewRecursionContext(localctx, _startState, SLQParserRULE_expr)
|
|
p.SetState(178)
|
|
|
|
if !(p.Precpred(p.GetParserRuleContext(), 2)) {
|
|
panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 2)", ""))
|
|
}
|
|
{
|
|
p.SetState(179)
|
|
p.Match(SLQParserT__25)
|
|
}
|
|
{
|
|
p.SetState(180)
|
|
p.expr(3)
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
p.SetState(185)
|
|
p.GetErrorHandler().Sync(p)
|
|
_alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 15, p.GetParserRuleContext())
|
|
}
|
|
|
|
return localctx
|
|
}
|
|
|
|
// ILiteralContext is an interface to support dynamic dispatch.
|
|
type ILiteralContext interface {
|
|
antlr.ParserRuleContext
|
|
|
|
// GetParser returns the parser.
|
|
GetParser() antlr.Parser
|
|
|
|
// 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{} {
|
|
switch t := visitor.(type) {
|
|
case SLQVisitor:
|
|
return t.VisitLiteral(s)
|
|
|
|
default:
|
|
return t.VisitChildren(s)
|
|
}
|
|
}
|
|
|
|
func (p *SLQParser) Literal() (localctx ILiteralContext) {
|
|
localctx = NewLiteralContext(p, p.GetParserRuleContext(), p.GetState())
|
|
p.EnterRule(localctx, 30, SLQParserRULE_literal)
|
|
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(186)
|
|
_la = p.GetTokenStream().LA(1)
|
|
|
|
if !(((_la-38)&-(0x1f+1)) == 0 && ((1<<uint((_la-38)))&((1<<(SLQParserNULL-38))|(1<<(SLQParserNN-38))|(1<<(SLQParserNUMBER-38))|(1<<(SLQParserSTRING-38)))) != 0) {
|
|
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{} {
|
|
switch t := visitor.(type) {
|
|
case SLQVisitor:
|
|
return t.VisitUnaryOperator(s)
|
|
|
|
default:
|
|
return t.VisitChildren(s)
|
|
}
|
|
}
|
|
|
|
func (p *SLQParser) UnaryOperator() (localctx IUnaryOperatorContext) {
|
|
localctx = NewUnaryOperatorContext(p, p.GetParserRuleContext(), p.GetState())
|
|
p.EnterRule(localctx, 32, SLQParserRULE_unaryOperator)
|
|
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(188)
|
|
_la = p.GetTokenStream().LA(1)
|
|
|
|
if !(((_la)&-(0x1f+1)) == 0 && ((1<<uint(_la))&((1<<SLQParserT__20)|(1<<SLQParserT__21)|(1<<SLQParserT__26)|(1<<SLQParserT__27))) != 0) {
|
|
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 14:
|
|
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 {
|
|
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))
|
|
}
|
|
}
|