@pgtyped/query
Advanced tools
Comparing version 0.11.0 to 0.12.0
/// <reference types="node" /> | ||
import { AsyncQueue } from '@pgtyped/wire'; | ||
import tls from 'tls'; | ||
import * as tls from 'tls'; | ||
import { IInterpolatedQuery, QueryParam } from './preprocessor'; | ||
@@ -54,3 +54,3 @@ import { MappableType } from './type'; | ||
*/ | ||
export declare function getTypeData(query: string, name: string, queue: AsyncQueue): Promise<TypeData>; | ||
export declare function getTypeData(query: string, queue: AsyncQueue): Promise<TypeData>; | ||
interface TypeRow { | ||
@@ -63,3 +63,3 @@ oid: string; | ||
export declare function reduceTypeRows(typeRows: TypeRow[]): Record<string, MappableType>; | ||
export declare function getTypes(queryData: IInterpolatedQuery, name: string, queue: AsyncQueue): Promise<IQueryTypes | IParseError>; | ||
export declare function getTypes(queryData: IInterpolatedQuery, queue: AsyncQueue): Promise<IQueryTypes | IParseError>; | ||
export {}; |
@@ -93,3 +93,3 @@ "use strict"; | ||
*/ | ||
function getTypeData(query, name, queue) { | ||
function getTypeData(query, queue) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -175,5 +175,5 @@ const uniqueName = crypto_1.default.createHash('md5').update(query).digest('hex'); | ||
} | ||
function getTypes(queryData, name, queue) { | ||
function getTypes(queryData, queue) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const typeData = yield getTypeData(queryData.query, name, queue); | ||
const typeData = yield getTypeData(queryData.query, queue); | ||
if ('errorCode' in typeData) { | ||
@@ -180,0 +180,0 @@ return typeData; |
@@ -8,7 +8,13 @@ import { ParseEvent } from './logger'; | ||
} | ||
export interface ParamKey { | ||
name: string; | ||
required: boolean; | ||
} | ||
export declare type ParamTransform = { | ||
type: TransformType.Scalar; | ||
} | { | ||
type: TransformType.PickTuple | TransformType.ArraySpread | TransformType.PickArraySpread; | ||
keys: string[]; | ||
type: TransformType.ArraySpread; | ||
} | { | ||
type: TransformType.PickTuple | TransformType.PickArraySpread; | ||
keys: ParamKey[]; | ||
}; | ||
@@ -18,2 +24,3 @@ export interface Param { | ||
transform: ParamTransform; | ||
required: boolean; | ||
codeRefs: { | ||
@@ -47,5 +54,5 @@ defined?: CodeInterval; | ||
}; | ||
declare function parseText(text: string, fileName?: string): SQLParseResult; | ||
declare function parseText(text: string): SQLParseResult; | ||
export { prettyPrintEvents } from './logger'; | ||
export declare type SQLQueryAST = Query; | ||
export default parseText; |
@@ -101,3 +101,5 @@ "use strict"; | ||
assert('keys' in this.currentTransform && this.currentTransform.keys); | ||
this.currentTransform.keys.push(ctx.text); | ||
const required = !!ctx.C_REQUIRED_MARK(); | ||
const name = ctx.ID().text; | ||
this.currentTransform.keys.push({ name, required }); | ||
} | ||
@@ -135,3 +137,3 @@ enterStatementBody(ctx) { | ||
assert(b); | ||
const [partA, ignored, partB] = [ | ||
const [partA, , partB] = [ | ||
body.slice(0, a), | ||
@@ -145,5 +147,7 @@ body.slice(a, b), | ||
enterParamId(ctx) { | ||
const paramName = ctx.text; | ||
var _a, _b; | ||
assert(this.currentQuery.params); | ||
assert(this.currentQuery.usedParamSet); | ||
const paramName = ctx.ID().text; | ||
const required = !!ctx.S_REQUIRED_MARK(); | ||
this.currentQuery.usedParamSet[paramName] = true; | ||
@@ -153,3 +157,3 @@ const reference = this.currentQuery.params.find((p) => p.name === paramName); | ||
a: ctx.start.startIndex, | ||
b: ctx.start.stopIndex, | ||
b: (_b = (_a = ctx.stop) === null || _a === void 0 ? void 0 : _a.stopIndex) !== null && _b !== void 0 ? _b : ctx.start.stopIndex, | ||
line: ctx.start.line, | ||
@@ -161,2 +165,3 @@ col: ctx.start.charPositionInLine, | ||
name: paramName, | ||
required, | ||
transform: { type: TransformType.Scalar }, | ||
@@ -169,2 +174,3 @@ codeRefs: { | ||
else { | ||
reference.required = reference.required || required; | ||
reference.codeRefs.used.push(useLoc); | ||
@@ -174,4 +180,4 @@ } | ||
} | ||
function parseText(text, fileName = 'undefined.sql') { | ||
const logger = new logger_1.Logger(text); | ||
function parseText(text) { | ||
const logger = new logger_1.Logger(); | ||
const inputStream = antlr4ts_1.CharStreams.fromString(text); | ||
@@ -178,0 +184,0 @@ const lexer = new SQLLexer_1.SQLLexer(inputStream); |
@@ -39,7 +39,5 @@ import { ANTLRErrorListener } from 'antlr4ts'; | ||
parseEvents: ParseEvent[]; | ||
private text; | ||
constructor(text: string); | ||
logEvent(event: ParseEvent): void; | ||
syntaxError(recognizer: any, symbol: any, line: number, col: number, msg: string, e: RecognitionException | undefined): void; | ||
syntaxError(_recognizer: any, symbol: any, line: number, col: number, msg: string, _e: RecognitionException | undefined): void; | ||
} | ||
export {}; |
@@ -28,3 +28,2 @@ "use strict"; | ||
let colored = ''; | ||
let i = 0; | ||
for (const interval of intervals) { | ||
@@ -37,3 +36,2 @@ const a = str.slice(0, interval.a + offset); | ||
str = colored; | ||
i++; | ||
} | ||
@@ -83,5 +81,4 @@ return colored; | ||
class Logger { | ||
constructor(text) { | ||
constructor() { | ||
this.parseEvents = []; | ||
this.text = text; | ||
} | ||
@@ -91,3 +88,3 @@ logEvent(event) { | ||
} | ||
syntaxError(recognizer, symbol, line, col, msg, e) { | ||
syntaxError(_recognizer, symbol, line, col, msg, _e) { | ||
this.logEvent({ | ||
@@ -94,0 +91,0 @@ type: ParseEventType.Error, |
@@ -8,18 +8,20 @@ import { ATN } from "antlr4ts/atn/ATN"; | ||
static readonly OPEN_COMMENT = 2; | ||
static readonly WORD = 3; | ||
static readonly EOF_STATEMENT = 4; | ||
static readonly WSL = 5; | ||
static readonly STRING = 6; | ||
static readonly PARAM_MARK = 7; | ||
static readonly WS = 8; | ||
static readonly TRANSFORM_ARROW = 9; | ||
static readonly SPREAD = 10; | ||
static readonly NAME_TAG = 11; | ||
static readonly TYPE_TAG = 12; | ||
static readonly OB = 13; | ||
static readonly CB = 14; | ||
static readonly COMMA = 15; | ||
static readonly ANY = 16; | ||
static readonly CLOSE_COMMENT = 17; | ||
static readonly CAST = 18; | ||
static readonly S_REQUIRED_MARK = 3; | ||
static readonly WORD = 4; | ||
static readonly EOF_STATEMENT = 5; | ||
static readonly WSL = 6; | ||
static readonly STRING = 7; | ||
static readonly PARAM_MARK = 8; | ||
static readonly WS = 9; | ||
static readonly TRANSFORM_ARROW = 10; | ||
static readonly SPREAD = 11; | ||
static readonly NAME_TAG = 12; | ||
static readonly TYPE_TAG = 13; | ||
static readonly OB = 14; | ||
static readonly CB = 15; | ||
static readonly COMMA = 16; | ||
static readonly C_REQUIRED_MARK = 17; | ||
static readonly ANY = 18; | ||
static readonly CLOSE_COMMENT = 19; | ||
static readonly CAST = 20; | ||
static readonly COMMENT = 1; | ||
@@ -26,0 +28,0 @@ static readonly channelNames: string[]; |
@@ -47,18 +47,20 @@ "use strict"; | ||
SQLLexer.OPEN_COMMENT = 2; | ||
SQLLexer.WORD = 3; | ||
SQLLexer.EOF_STATEMENT = 4; | ||
SQLLexer.WSL = 5; | ||
SQLLexer.STRING = 6; | ||
SQLLexer.PARAM_MARK = 7; | ||
SQLLexer.WS = 8; | ||
SQLLexer.TRANSFORM_ARROW = 9; | ||
SQLLexer.SPREAD = 10; | ||
SQLLexer.NAME_TAG = 11; | ||
SQLLexer.TYPE_TAG = 12; | ||
SQLLexer.OB = 13; | ||
SQLLexer.CB = 14; | ||
SQLLexer.COMMA = 15; | ||
SQLLexer.ANY = 16; | ||
SQLLexer.CLOSE_COMMENT = 17; | ||
SQLLexer.CAST = 18; | ||
SQLLexer.S_REQUIRED_MARK = 3; | ||
SQLLexer.WORD = 4; | ||
SQLLexer.EOF_STATEMENT = 5; | ||
SQLLexer.WSL = 6; | ||
SQLLexer.STRING = 7; | ||
SQLLexer.PARAM_MARK = 8; | ||
SQLLexer.WS = 9; | ||
SQLLexer.TRANSFORM_ARROW = 10; | ||
SQLLexer.SPREAD = 11; | ||
SQLLexer.NAME_TAG = 12; | ||
SQLLexer.TYPE_TAG = 13; | ||
SQLLexer.OB = 14; | ||
SQLLexer.CB = 15; | ||
SQLLexer.COMMA = 16; | ||
SQLLexer.C_REQUIRED_MARK = 17; | ||
SQLLexer.ANY = 18; | ||
SQLLexer.CLOSE_COMMENT = 19; | ||
SQLLexer.CAST = 20; | ||
SQLLexer.COMMENT = 1; | ||
@@ -74,18 +76,20 @@ // tslint:disable:no-trailing-whitespace | ||
SQLLexer.ruleNames = [ | ||
"QUOT", "ID", "OPEN_COMMENT", "SID", "WORD", "SPECIAL", "EOF_STATEMENT", | ||
"WSL", "STRING", "PARAM_MARK", "CAST", "CID", "WS", "TRANSFORM_ARROW", | ||
"SPREAD", "NAME_TAG", "TYPE_TAG", "OB", "CB", "COMMA", "ANY", "CLOSE_COMMENT", | ||
"QUOT", "ID", "OPEN_COMMENT", "SID", "S_REQUIRED_MARK", "WORD", "SPECIAL", | ||
"EOF_STATEMENT", "WSL", "STRING", "PARAM_MARK", "CAST", "CID", "WS", "TRANSFORM_ARROW", | ||
"SPREAD", "NAME_TAG", "TYPE_TAG", "OB", "CB", "COMMA", "C_REQUIRED_MARK", | ||
"ANY", "CLOSE_COMMENT", | ||
]; | ||
SQLLexer._LITERAL_NAMES = [ | ||
undefined, undefined, "'/*'", undefined, "';'", undefined, undefined, | ||
"':'", undefined, "'->'", "'...'", "'@name'", "'@param'", "'('", "')'", | ||
"','", undefined, "'*/'", "'::'", | ||
undefined, undefined, "'/*'", undefined, undefined, "';'", undefined, | ||
undefined, "':'", undefined, "'->'", "'...'", "'@name'", "'@param'", "'('", | ||
"')'", "','", undefined, undefined, "'*/'", "'::'", | ||
]; | ||
SQLLexer._SYMBOLIC_NAMES = [ | ||
undefined, "ID", "OPEN_COMMENT", "WORD", "EOF_STATEMENT", "WSL", "STRING", | ||
"PARAM_MARK", "WS", "TRANSFORM_ARROW", "SPREAD", "NAME_TAG", "TYPE_TAG", | ||
"OB", "CB", "COMMA", "ANY", "CLOSE_COMMENT", "CAST", | ||
undefined, "ID", "OPEN_COMMENT", "S_REQUIRED_MARK", "WORD", "EOF_STATEMENT", | ||
"WSL", "STRING", "PARAM_MARK", "WS", "TRANSFORM_ARROW", "SPREAD", "NAME_TAG", | ||
"TYPE_TAG", "OB", "CB", "COMMA", "C_REQUIRED_MARK", "ANY", "CLOSE_COMMENT", | ||
"CAST", | ||
]; | ||
SQLLexer.VOCABULARY = new VocabularyImpl_1.VocabularyImpl(SQLLexer._LITERAL_NAMES, SQLLexer._SYMBOLIC_NAMES, []); | ||
SQLLexer._serializedATN = "\x03\uC91D\uCABA\u058D\uAFBA\u4F53\u0607\uEA8B\uC241\x02\x14\x99\b\x01" + | ||
SQLLexer._serializedATN = "\x03\uC91D\uCABA\u058D\uAFBA\u4F53\u0607\uEA8B\uC241\x02\x16\xA1\b\x01" + | ||
"\b\x01\x04\x02\t\x02\x04\x03\t\x03\x04\x04\t\x04\x04\x05\t\x05\x04\x06" + | ||
@@ -95,62 +99,66 @@ "\t\x06\x04\x07\t\x07\x04\b\t\b\x04\t\t\t\x04\n\t\n\x04\v\t\v\x04\f\t\f" + | ||
"\x12\t\x12\x04\x13\t\x13\x04\x14\t\x14\x04\x15\t\x15\x04\x16\t\x16\x04" + | ||
"\x17\t\x17\x03\x02\x03\x02\x03\x03\x03\x03\x07\x035\n\x03\f\x03\x0E\x03" + | ||
"8\v\x03\x03\x04\x03\x04\x03\x04\x03\x04\x03\x04\x03\x05\x03\x05\x03\x05" + | ||
"\x03\x05\x03\x06\x06\x06D\n\x06\r\x06\x0E\x06E\x03\x07\x06\x07I\n\x07" + | ||
"\r\x07\x0E\x07J\x03\x07\x03\x07\x03\b\x03\b\x03\t\x06\tR\n\t\r\t\x0E\t" + | ||
"S\x03\t\x03\t\x03\n\x03\n\x03\n\x07\n[\n\n\f\n\x0E\n^\v\n\x03\n\x03\n" + | ||
"\x05\nb\n\n\x03\v\x03\v\x03\f\x03\f\x03\f\x03\f\x03\f\x03\r\x03\r\x03" + | ||
"\r\x03\r\x03\x0E\x06\x0Ep\n\x0E\r\x0E\x0E\x0Eq\x03\x0E\x03\x0E\x03\x0F" + | ||
"\x03\x0F\x03\x0F\x03\x10\x03\x10\x03\x10\x03\x10\x03\x11\x03\x11\x03\x11" + | ||
"\x03\x11\x03\x11\x03\x11\x03\x12\x03\x12\x03\x12\x03\x12\x03\x12\x03\x12" + | ||
"\x03\x12\x03\x13\x03\x13\x03\x14\x03\x14\x03\x15\x03\x15\x03\x16\x06\x16" + | ||
"\x91\n\x16\r\x16\x0E\x16\x92\x03\x17\x03\x17\x03\x17\x03\x17\x03\x17\x04" + | ||
"\\\x92\x02\x02\x18\x04\x02\x02\x06\x02\x03\b\x02\x04\n\x02\x02\f\x02\x05" + | ||
"\x0E\x02\x02\x10\x02\x06\x12\x02\x07\x14\x02\b\x16\x02\t\x18\x02\x14\x1A" + | ||
"\x02\x02\x1C\x02\n\x1E\x02\v \x02\f\"\x02\r$\x02\x0E&\x02\x0F(\x02\x10" + | ||
"*\x02\x11,\x02\x12.\x02\x13\x04\x02\x03\x07\x05\x02C\\aac|\x06\x022;C" + | ||
"\\aac|\t\x02#(*1>B]]_`bb}\x80\x05\x02\v\f\x0F\x0F\"\"\x03\x02^^\x02\x9D" + | ||
"\x02\b\x03\x02\x02\x02\x02\n\x03\x02\x02\x02\x02\f\x03\x02\x02\x02\x02" + | ||
"\x0E\x03\x02\x02\x02\x02\x10\x03\x02\x02\x02\x02\x12\x03\x02\x02\x02\x02" + | ||
"\x14\x03\x02\x02\x02\x02\x16\x03\x02\x02\x02\x02\x18\x03\x02\x02\x02\x03" + | ||
"\x1A\x03\x02\x02\x02\x03\x1C\x03\x02\x02\x02\x03\x1E\x03\x02\x02\x02\x03" + | ||
" \x03\x02\x02\x02\x03\"\x03\x02\x02\x02\x03$\x03\x02\x02\x02\x03&\x03" + | ||
"\x02\x02\x02\x03(\x03\x02\x02\x02\x03*\x03\x02\x02\x02\x03,\x03\x02\x02" + | ||
"\x02\x03.\x03\x02\x02\x02\x040\x03\x02\x02\x02\x062\x03\x02\x02\x02\b" + | ||
"9\x03\x02\x02\x02\n>\x03\x02\x02\x02\fC\x03\x02\x02\x02\x0EH\x03\x02\x02" + | ||
"\x02\x10N\x03\x02\x02\x02\x12Q\x03\x02\x02\x02\x14W\x03\x02\x02\x02\x16" + | ||
"c\x03\x02\x02\x02\x18e\x03\x02\x02\x02\x1Aj\x03\x02\x02\x02\x1Co\x03\x02" + | ||
"\x02\x02\x1Eu\x03\x02\x02\x02 x\x03\x02\x02\x02\"|\x03\x02\x02\x02$\x82" + | ||
"\x03\x02\x02\x02&\x89\x03\x02\x02\x02(\x8B\x03\x02\x02\x02*\x8D\x03\x02" + | ||
"\x02\x02,\x90\x03\x02\x02\x02.\x94\x03\x02\x02\x0201\x07)\x02\x021\x05" + | ||
"\x03\x02\x02\x0226\t\x02\x02\x0235\t\x03\x02\x0243\x03\x02\x02\x0258\x03" + | ||
"\x02\x02\x0264\x03\x02\x02\x0267\x03\x02\x02\x027\x07\x03\x02\x02\x02" + | ||
"86\x03\x02\x02\x029:\x071\x02\x02:;\x07,\x02\x02;<\x03\x02\x02\x02<=\b" + | ||
"\x04\x02\x02=\t\x03\x02\x02\x02>?\x05\x06\x03\x02?@\x03\x02\x02\x02@A" + | ||
"\b\x05\x03\x02A\v\x03\x02\x02\x02BD\t\x03\x02\x02CB\x03\x02\x02\x02DE" + | ||
"\x03\x02\x02\x02EC\x03\x02\x02\x02EF\x03\x02\x02\x02F\r\x03\x02\x02\x02" + | ||
"GI\t\x04\x02\x02HG\x03\x02\x02\x02IJ\x03\x02\x02\x02JH\x03\x02\x02\x02" + | ||
"JK\x03\x02\x02\x02KL\x03\x02\x02\x02LM\b\x07\x04\x02M\x0F\x03\x02\x02" + | ||
"\x02NO\x07=\x02\x02O\x11\x03\x02\x02\x02PR\t\x05\x02\x02QP\x03\x02\x02" + | ||
"\x02RS\x03\x02\x02\x02SQ\x03\x02\x02\x02ST\x03\x02\x02\x02TU\x03\x02\x02" + | ||
"\x02UV\b\t\x05\x02V\x13\x03\x02\x02\x02Wa\x05\x04\x02\x02Xb\x05\x04\x02" + | ||
"\x02Y[\v\x02\x02\x02ZY\x03\x02\x02\x02[^\x03\x02\x02\x02\\]\x03\x02\x02" + | ||
"\x02\\Z\x03\x02\x02\x02]_\x03\x02\x02\x02^\\\x03\x02\x02\x02_`\n\x06\x02" + | ||
"\x02`b\x05\x04\x02\x02aX\x03\x02\x02\x02a\\\x03\x02\x02\x02b\x15\x03\x02" + | ||
"\x02\x02cd\x07<\x02\x02d\x17\x03\x02\x02\x02ef\x07<\x02\x02fg\x07<\x02" + | ||
"\x02gh\x03\x02\x02\x02hi\b\f\x04\x02i\x19\x03\x02\x02\x02jk\x05\x06\x03" + | ||
"\x02kl\x03\x02\x02\x02lm\b\r\x03\x02m\x1B\x03\x02\x02\x02np\t\x05\x02" + | ||
"\x02on\x03\x02\x02\x02pq\x03\x02\x02\x02qo\x03\x02\x02\x02qr\x03\x02\x02" + | ||
"\x02rs\x03\x02\x02\x02st\b\x0E\x05\x02t\x1D\x03\x02\x02\x02uv\x07/\x02" + | ||
"\x02vw\x07@\x02\x02w\x1F\x03\x02\x02\x02xy\x070\x02\x02yz\x070\x02\x02" + | ||
"z{\x070\x02\x02{!\x03\x02\x02\x02|}\x07B\x02\x02}~\x07p\x02\x02~\x7F\x07" + | ||
"c\x02\x02\x7F\x80\x07o\x02\x02\x80\x81\x07g\x02\x02\x81#\x03\x02\x02\x02" + | ||
"\x82\x83\x07B\x02\x02\x83\x84\x07r\x02\x02\x84\x85\x07c\x02\x02\x85\x86" + | ||
"\x07t\x02\x02\x86\x87\x07c\x02\x02\x87\x88\x07o\x02\x02\x88%\x03\x02\x02" + | ||
"\x02\x89\x8A\x07*\x02\x02\x8A\'\x03\x02\x02\x02\x8B\x8C\x07+\x02\x02\x8C" + | ||
")\x03\x02\x02\x02\x8D\x8E\x07.\x02\x02\x8E+\x03\x02\x02\x02\x8F\x91\v" + | ||
"\x02\x02\x02\x90\x8F\x03\x02\x02\x02\x91\x92\x03\x02\x02\x02\x92\x93\x03" + | ||
"\x02\x02\x02\x92\x90\x03\x02\x02\x02\x93-\x03\x02\x02\x02\x94\x95\x07" + | ||
",\x02\x02\x95\x96\x071\x02\x02\x96\x97\x03\x02\x02\x02\x97\x98\b\x17\x06" + | ||
"\x02\x98/\x03\x02\x02\x02\f\x02\x036EJS\\aq\x92\x07\x04\x03\x02\t\x03" + | ||
"\x02\t\x05\x02\b\x02\x02\x04\x02\x02"; | ||
"\x17\t\x17\x04\x18\t\x18\x04\x19\t\x19\x03\x02\x03\x02\x03\x03\x03\x03" + | ||
"\x07\x039\n\x03\f\x03\x0E\x03<\v\x03\x03\x04\x03\x04\x03\x04\x03\x04\x03" + | ||
"\x04\x03\x05\x03\x05\x03\x05\x03\x05\x03\x06\x03\x06\x03\x07\x06\x07J" + | ||
"\n\x07\r\x07\x0E\x07K\x03\b\x06\bO\n\b\r\b\x0E\bP\x03\b\x03\b\x03\t\x03" + | ||
"\t\x03\n\x06\nX\n\n\r\n\x0E\nY\x03\n\x03\n\x03\v\x03\v\x03\v\x07\va\n" + | ||
"\v\f\v\x0E\vd\v\v\x03\v\x03\v\x05\vh\n\v\x03\f\x03\f\x03\r\x03\r\x03\r" + | ||
"\x03\r\x03\r\x03\x0E\x03\x0E\x03\x0E\x03\x0E\x03\x0F\x06\x0Fv\n\x0F\r" + | ||
"\x0F\x0E\x0Fw\x03\x0F\x03\x0F\x03\x10\x03\x10\x03\x10\x03\x11\x03\x11" + | ||
"\x03\x11\x03\x11\x03\x12\x03\x12\x03\x12\x03\x12\x03\x12\x03\x12\x03\x13" + | ||
"\x03\x13\x03\x13\x03\x13\x03\x13\x03\x13\x03\x13\x03\x14\x03\x14\x03\x15" + | ||
"\x03\x15\x03\x16\x03\x16\x03\x17\x03\x17\x03\x18\x06\x18\x99\n\x18\r\x18" + | ||
"\x0E\x18\x9A\x03\x19\x03\x19\x03\x19\x03\x19\x03\x19\x04b\x9A\x02\x02" + | ||
"\x1A\x04\x02\x02\x06\x02\x03\b\x02\x04\n\x02\x02\f\x02\x05\x0E\x02\x06" + | ||
"\x10\x02\x02\x12\x02\x07\x14\x02\b\x16\x02\t\x18\x02\n\x1A\x02\x16\x1C" + | ||
"\x02\x02\x1E\x02\v \x02\f\"\x02\r$\x02\x0E&\x02\x0F(\x02\x10*\x02\x11" + | ||
",\x02\x12.\x02\x130\x02\x142\x02\x15\x04\x02\x03\x07\x05\x02C\\aac|\x06" + | ||
"\x022;C\\aac|\t\x02#(*1>B]]_`bb}\x80\x05\x02\v\f\x0F\x0F\"\"\x03\x02^" + | ||
"^\x02\xA5\x02\b\x03\x02\x02\x02\x02\n\x03\x02\x02\x02\x02\f\x03\x02\x02" + | ||
"\x02\x02\x0E\x03\x02\x02\x02\x02\x10\x03\x02\x02\x02\x02\x12\x03\x02\x02" + | ||
"\x02\x02\x14\x03\x02\x02\x02\x02\x16\x03\x02\x02\x02\x02\x18\x03\x02\x02" + | ||
"\x02\x02\x1A\x03\x02\x02\x02\x03\x1C\x03\x02\x02\x02\x03\x1E\x03\x02\x02" + | ||
"\x02\x03 \x03\x02\x02\x02\x03\"\x03\x02\x02\x02\x03$\x03\x02\x02\x02\x03" + | ||
"&\x03\x02\x02\x02\x03(\x03\x02\x02\x02\x03*\x03\x02\x02\x02\x03,\x03\x02" + | ||
"\x02\x02\x03.\x03\x02\x02\x02\x030\x03\x02\x02\x02\x032\x03\x02\x02\x02" + | ||
"\x044\x03\x02\x02\x02\x066\x03\x02\x02\x02\b=\x03\x02\x02\x02\nB\x03\x02" + | ||
"\x02\x02\fF\x03\x02\x02\x02\x0EI\x03\x02\x02\x02\x10N\x03\x02\x02\x02" + | ||
"\x12T\x03\x02\x02\x02\x14W\x03\x02\x02\x02\x16]\x03\x02\x02\x02\x18i\x03" + | ||
"\x02\x02\x02\x1Ak\x03\x02\x02\x02\x1Cp\x03\x02\x02\x02\x1Eu\x03\x02\x02" + | ||
"\x02 {\x03\x02\x02\x02\"~\x03\x02\x02\x02$\x82\x03\x02\x02\x02&\x88\x03" + | ||
"\x02\x02\x02(\x8F\x03\x02\x02\x02*\x91\x03\x02\x02\x02,\x93\x03\x02\x02" + | ||
"\x02.\x95\x03\x02\x02\x020\x98\x03\x02\x02\x022\x9C\x03\x02\x02\x0245" + | ||
"\x07)\x02\x025\x05\x03\x02\x02\x026:\t\x02\x02\x0279\t\x03\x02\x0287\x03" + | ||
"\x02\x02\x029<\x03\x02\x02\x02:8\x03\x02\x02\x02:;\x03\x02\x02\x02;\x07" + | ||
"\x03\x02\x02\x02<:\x03\x02\x02\x02=>\x071\x02\x02>?\x07,\x02\x02?@\x03" + | ||
"\x02\x02\x02@A\b\x04\x02\x02A\t\x03\x02\x02\x02BC\x05\x06\x03\x02CD\x03" + | ||
"\x02\x02\x02DE\b\x05\x03\x02E\v\x03\x02\x02\x02FG\x07#\x02\x02G\r\x03" + | ||
"\x02\x02\x02HJ\t\x03\x02\x02IH\x03\x02\x02\x02JK\x03\x02\x02\x02KI\x03" + | ||
"\x02\x02\x02KL\x03\x02\x02\x02L\x0F\x03\x02\x02\x02MO\t\x04\x02\x02NM" + | ||
"\x03\x02\x02\x02OP\x03\x02\x02\x02PN\x03\x02\x02\x02PQ\x03\x02\x02\x02" + | ||
"QR\x03\x02\x02\x02RS\b\b\x04\x02S\x11\x03\x02\x02\x02TU\x07=\x02\x02U" + | ||
"\x13\x03\x02\x02\x02VX\t\x05\x02\x02WV\x03\x02\x02\x02XY\x03\x02\x02\x02" + | ||
"YW\x03\x02\x02\x02YZ\x03\x02\x02\x02Z[\x03\x02\x02\x02[\\\b\n\x05\x02" + | ||
"\\\x15\x03\x02\x02\x02]g\x05\x04\x02\x02^h\x05\x04\x02\x02_a\v\x02\x02" + | ||
"\x02`_\x03\x02\x02\x02ad\x03\x02\x02\x02bc\x03\x02\x02\x02b`\x03\x02\x02" + | ||
"\x02ce\x03\x02\x02\x02db\x03\x02\x02\x02ef\n\x06\x02\x02fh\x05\x04\x02" + | ||
"\x02g^\x03\x02\x02\x02gb\x03\x02\x02\x02h\x17\x03\x02\x02\x02ij\x07<\x02" + | ||
"\x02j\x19\x03\x02\x02\x02kl\x07<\x02\x02lm\x07<\x02\x02mn\x03\x02\x02" + | ||
"\x02no\b\r\x04\x02o\x1B\x03\x02\x02\x02pq\x05\x06\x03\x02qr\x03\x02\x02" + | ||
"\x02rs\b\x0E\x03\x02s\x1D\x03\x02\x02\x02tv\t\x05\x02\x02ut\x03\x02\x02" + | ||
"\x02vw\x03\x02\x02\x02wu\x03\x02\x02\x02wx\x03\x02\x02\x02xy\x03\x02\x02" + | ||
"\x02yz\b\x0F\x05\x02z\x1F\x03\x02\x02\x02{|\x07/\x02\x02|}\x07@\x02\x02" + | ||
"}!\x03\x02\x02\x02~\x7F\x070\x02\x02\x7F\x80\x070\x02\x02\x80\x81\x07" + | ||
"0\x02\x02\x81#\x03\x02\x02\x02\x82\x83\x07B\x02\x02\x83\x84\x07p\x02\x02" + | ||
"\x84\x85\x07c\x02\x02\x85\x86\x07o\x02\x02\x86\x87\x07g\x02\x02\x87%\x03" + | ||
"\x02\x02\x02\x88\x89\x07B\x02\x02\x89\x8A\x07r\x02\x02\x8A\x8B\x07c\x02" + | ||
"\x02\x8B\x8C\x07t\x02\x02\x8C\x8D\x07c\x02\x02\x8D\x8E\x07o\x02\x02\x8E" + | ||
"\'\x03\x02\x02\x02\x8F\x90\x07*\x02\x02\x90)\x03\x02\x02\x02\x91\x92\x07" + | ||
"+\x02\x02\x92+\x03\x02\x02\x02\x93\x94\x07.\x02\x02\x94-\x03\x02\x02\x02" + | ||
"\x95\x96\x07#\x02\x02\x96/\x03\x02\x02\x02\x97\x99\v\x02\x02\x02\x98\x97" + | ||
"\x03\x02\x02\x02\x99\x9A\x03\x02\x02\x02\x9A\x9B\x03\x02\x02\x02\x9A\x98" + | ||
"\x03\x02\x02\x02\x9B1\x03\x02\x02\x02\x9C\x9D\x07,\x02\x02\x9D\x9E\x07" + | ||
"1\x02\x02\x9E\x9F\x03\x02\x02\x02\x9F\xA0\b\x19\x06\x02\xA03\x03\x02\x02" + | ||
"\x02\f\x02\x03:KPYbgw\x9A\x07\x04\x03\x02\t\x03\x02\t\x06\x02\b\x02\x02" + | ||
"\x04\x02\x02"; | ||
//# sourceMappingURL=SQLLexer.js.map |
@@ -13,18 +13,20 @@ import { ATN } from "antlr4ts/atn/ATN"; | ||
static readonly OPEN_COMMENT = 2; | ||
static readonly WORD = 3; | ||
static readonly EOF_STATEMENT = 4; | ||
static readonly WSL = 5; | ||
static readonly STRING = 6; | ||
static readonly PARAM_MARK = 7; | ||
static readonly WS = 8; | ||
static readonly TRANSFORM_ARROW = 9; | ||
static readonly SPREAD = 10; | ||
static readonly NAME_TAG = 11; | ||
static readonly TYPE_TAG = 12; | ||
static readonly OB = 13; | ||
static readonly CB = 14; | ||
static readonly COMMA = 15; | ||
static readonly ANY = 16; | ||
static readonly CLOSE_COMMENT = 17; | ||
static readonly CAST = 18; | ||
static readonly S_REQUIRED_MARK = 3; | ||
static readonly WORD = 4; | ||
static readonly EOF_STATEMENT = 5; | ||
static readonly WSL = 6; | ||
static readonly STRING = 7; | ||
static readonly PARAM_MARK = 8; | ||
static readonly WS = 9; | ||
static readonly TRANSFORM_ARROW = 10; | ||
static readonly SPREAD = 11; | ||
static readonly NAME_TAG = 12; | ||
static readonly TYPE_TAG = 13; | ||
static readonly OB = 14; | ||
static readonly CB = 15; | ||
static readonly COMMA = 16; | ||
static readonly C_REQUIRED_MARK = 17; | ||
static readonly ANY = 18; | ||
static readonly CLOSE_COMMENT = 19; | ||
static readonly CAST = 20; | ||
static readonly RULE_input = 0; | ||
@@ -169,2 +171,3 @@ static readonly RULE_query = 1; | ||
ID(): TerminalNode; | ||
S_REQUIRED_MARK(): TerminalNode | undefined; | ||
constructor(parent: ParserRuleContext | undefined, invokingState: number); | ||
@@ -250,2 +253,3 @@ get ruleIndex(): number; | ||
ID(): TerminalNode; | ||
C_REQUIRED_MARK(): TerminalNode | undefined; | ||
constructor(parent: ParserRuleContext | undefined, invokingState: number); | ||
@@ -252,0 +256,0 @@ get ruleIndex(): number; |
@@ -389,2 +389,3 @@ "use strict"; | ||
this.enterRule(_localctx, 16, SQLParser.RULE_paramId); | ||
let _la; | ||
try { | ||
@@ -395,2 +396,11 @@ this.enterOuterAlt(_localctx, 1); | ||
this.match(SQLParser.ID); | ||
this.state = 92; | ||
this._errHandler.sync(this); | ||
_la = this._input.LA(1); | ||
if (_la === SQLParser.S_REQUIRED_MARK) { | ||
{ | ||
this.state = 91; | ||
this.match(SQLParser.S_REQUIRED_MARK); | ||
} | ||
} | ||
} | ||
@@ -420,5 +430,5 @@ } | ||
{ | ||
this.state = 92; | ||
this.state = 94; | ||
this.match(SQLParser.NAME_TAG); | ||
this.state = 93; | ||
this.state = 95; | ||
this.queryName(); | ||
@@ -449,7 +459,7 @@ } | ||
{ | ||
this.state = 95; | ||
this.state = 97; | ||
this.match(SQLParser.TYPE_TAG); | ||
this.state = 96; | ||
this.state = 98; | ||
this.paramName(); | ||
this.state = 97; | ||
this.state = 99; | ||
this.paramTransform(); | ||
@@ -480,5 +490,5 @@ } | ||
{ | ||
this.state = 99; | ||
this.state = 101; | ||
this.match(SQLParser.TRANSFORM_ARROW); | ||
this.state = 100; | ||
this.state = 102; | ||
this.transformRule(); | ||
@@ -507,9 +517,9 @@ } | ||
try { | ||
this.state = 105; | ||
this.state = 107; | ||
this._errHandler.sync(this); | ||
switch (this.interpreter.adaptivePredict(this._input, 6, this._ctx)) { | ||
switch (this.interpreter.adaptivePredict(this._input, 7, this._ctx)) { | ||
case 1: | ||
this.enterOuterAlt(_localctx, 1); | ||
{ | ||
this.state = 102; | ||
this.state = 104; | ||
this.spreadTransform(); | ||
@@ -521,3 +531,3 @@ } | ||
{ | ||
this.state = 103; | ||
this.state = 105; | ||
this.pickTransform(); | ||
@@ -529,3 +539,3 @@ } | ||
{ | ||
this.state = 104; | ||
this.state = 106; | ||
this.spreadPickTransform(); | ||
@@ -558,7 +568,7 @@ } | ||
{ | ||
this.state = 107; | ||
this.state = 109; | ||
this.match(SQLParser.OB); | ||
this.state = 108; | ||
this.state = 110; | ||
this.match(SQLParser.SPREAD); | ||
this.state = 109; | ||
this.state = 111; | ||
this.match(SQLParser.CB); | ||
@@ -591,9 +601,9 @@ } | ||
{ | ||
this.state = 111; | ||
this.state = 113; | ||
this.match(SQLParser.OB); | ||
this.state = 112; | ||
this.state = 114; | ||
this.key(); | ||
this.state = 117; | ||
this.state = 119; | ||
this._errHandler.sync(this); | ||
_alt = this.interpreter.adaptivePredict(this._input, 7, this._ctx); | ||
_alt = this.interpreter.adaptivePredict(this._input, 8, this._ctx); | ||
while (_alt !== 2 && _alt !== ATN_1.ATN.INVALID_ALT_NUMBER) { | ||
@@ -603,5 +613,5 @@ if (_alt === 1) { | ||
{ | ||
this.state = 113; | ||
this.state = 115; | ||
this.match(SQLParser.COMMA); | ||
this.state = 114; | ||
this.state = 116; | ||
this.key(); | ||
@@ -611,7 +621,7 @@ } | ||
} | ||
this.state = 119; | ||
this.state = 121; | ||
this._errHandler.sync(this); | ||
_alt = this.interpreter.adaptivePredict(this._input, 7, this._ctx); | ||
_alt = this.interpreter.adaptivePredict(this._input, 8, this._ctx); | ||
} | ||
this.state = 121; | ||
this.state = 123; | ||
this._errHandler.sync(this); | ||
@@ -621,7 +631,7 @@ _la = this._input.LA(1); | ||
{ | ||
this.state = 120; | ||
this.state = 122; | ||
this.match(SQLParser.COMMA); | ||
} | ||
} | ||
this.state = 123; | ||
this.state = 125; | ||
this.match(SQLParser.CB); | ||
@@ -652,9 +662,9 @@ } | ||
{ | ||
this.state = 125; | ||
this.state = 127; | ||
this.match(SQLParser.OB); | ||
this.state = 126; | ||
this.state = 128; | ||
this.pickTransform(); | ||
this.state = 127; | ||
this.state = 129; | ||
this.match(SQLParser.SPREAD); | ||
this.state = 128; | ||
this.state = 130; | ||
this.match(SQLParser.CB); | ||
@@ -682,7 +692,17 @@ } | ||
this.enterRule(_localctx, 32, SQLParser.RULE_key); | ||
let _la; | ||
try { | ||
this.enterOuterAlt(_localctx, 1); | ||
{ | ||
this.state = 130; | ||
this.state = 132; | ||
this.match(SQLParser.ID); | ||
this.state = 134; | ||
this._errHandler.sync(this); | ||
_la = this._input.LA(1); | ||
if (_la === SQLParser.C_REQUIRED_MARK) { | ||
{ | ||
this.state = 133; | ||
this.match(SQLParser.C_REQUIRED_MARK); | ||
} | ||
} | ||
} | ||
@@ -712,3 +732,3 @@ } | ||
{ | ||
this.state = 132; | ||
this.state = 136; | ||
this.match(SQLParser.ID); | ||
@@ -739,3 +759,3 @@ } | ||
{ | ||
this.state = 134; | ||
this.state = 138; | ||
this.match(SQLParser.ID); | ||
@@ -769,18 +789,20 @@ } | ||
SQLParser.OPEN_COMMENT = 2; | ||
SQLParser.WORD = 3; | ||
SQLParser.EOF_STATEMENT = 4; | ||
SQLParser.WSL = 5; | ||
SQLParser.STRING = 6; | ||
SQLParser.PARAM_MARK = 7; | ||
SQLParser.WS = 8; | ||
SQLParser.TRANSFORM_ARROW = 9; | ||
SQLParser.SPREAD = 10; | ||
SQLParser.NAME_TAG = 11; | ||
SQLParser.TYPE_TAG = 12; | ||
SQLParser.OB = 13; | ||
SQLParser.CB = 14; | ||
SQLParser.COMMA = 15; | ||
SQLParser.ANY = 16; | ||
SQLParser.CLOSE_COMMENT = 17; | ||
SQLParser.CAST = 18; | ||
SQLParser.S_REQUIRED_MARK = 3; | ||
SQLParser.WORD = 4; | ||
SQLParser.EOF_STATEMENT = 5; | ||
SQLParser.WSL = 6; | ||
SQLParser.STRING = 7; | ||
SQLParser.PARAM_MARK = 8; | ||
SQLParser.WS = 9; | ||
SQLParser.TRANSFORM_ARROW = 10; | ||
SQLParser.SPREAD = 11; | ||
SQLParser.NAME_TAG = 12; | ||
SQLParser.TYPE_TAG = 13; | ||
SQLParser.OB = 14; | ||
SQLParser.CB = 15; | ||
SQLParser.COMMA = 16; | ||
SQLParser.C_REQUIRED_MARK = 17; | ||
SQLParser.ANY = 18; | ||
SQLParser.CLOSE_COMMENT = 19; | ||
SQLParser.CAST = 20; | ||
SQLParser.RULE_input = 0; | ||
@@ -813,13 +835,14 @@ SQLParser.RULE_query = 1; | ||
SQLParser._LITERAL_NAMES = [ | ||
undefined, undefined, "'/*'", undefined, "';'", undefined, undefined, | ||
"':'", undefined, "'->'", "'...'", "'@name'", "'@param'", "'('", "')'", | ||
"','", undefined, "'*/'", "'::'", | ||
undefined, undefined, "'/*'", undefined, undefined, "';'", undefined, | ||
undefined, "':'", undefined, "'->'", "'...'", "'@name'", "'@param'", "'('", | ||
"')'", "','", undefined, undefined, "'*/'", "'::'", | ||
]; | ||
SQLParser._SYMBOLIC_NAMES = [ | ||
undefined, "ID", "OPEN_COMMENT", "WORD", "EOF_STATEMENT", "WSL", "STRING", | ||
"PARAM_MARK", "WS", "TRANSFORM_ARROW", "SPREAD", "NAME_TAG", "TYPE_TAG", | ||
"OB", "CB", "COMMA", "ANY", "CLOSE_COMMENT", "CAST", | ||
undefined, "ID", "OPEN_COMMENT", "S_REQUIRED_MARK", "WORD", "EOF_STATEMENT", | ||
"WSL", "STRING", "PARAM_MARK", "WS", "TRANSFORM_ARROW", "SPREAD", "NAME_TAG", | ||
"TYPE_TAG", "OB", "CB", "COMMA", "C_REQUIRED_MARK", "ANY", "CLOSE_COMMENT", | ||
"CAST", | ||
]; | ||
SQLParser.VOCABULARY = new VocabularyImpl_1.VocabularyImpl(SQLParser._LITERAL_NAMES, SQLParser._SYMBOLIC_NAMES, []); | ||
SQLParser._serializedATN = "\x03\uC91D\uCABA\u058D\uAFBA\u4F53\u0607\uEA8B\uC241\x03\x14\x8B\x04\x02" + | ||
SQLParser._serializedATN = "\x03\uC91D\uCABA\u058D\uAFBA\u4F53\u0607\uEA8B\uC241\x03\x16\x8F\x04\x02" + | ||
"\t\x02\x04\x03\t\x03\x04\x04\t\x04\x04\x05\t\x05\x04\x06\t\x06\x04\x07" + | ||
@@ -834,44 +857,47 @@ "\t\x07\x04\b\t\b\x04\t\t\t\x04\n\t\n\x04\v\t\v\x04\f\t\f\x04\r\t\r\x04" + | ||
"\n\x07\f\x07\x0E\x07V\v\x07\x03\b\x03\b\x03\t\x03\t\x03\t\x03\n\x03\n" + | ||
"\x03\v\x03\v\x03\v\x03\f\x03\f\x03\f\x03\f\x03\r\x03\r\x03\r\x03\x0E\x03" + | ||
"\x0E\x03\x0E\x05\x0El\n\x0E\x03\x0F\x03\x0F\x03\x0F\x03\x0F\x03\x10\x03" + | ||
"\x10\x03\x10\x03\x10\x07\x10v\n\x10\f\x10\x0E\x10y\v\x10\x03\x10\x05\x10" + | ||
"|\n\x10\x03\x10\x03\x10\x03\x11\x03\x11\x03\x11\x03\x11\x03\x11\x03\x12" + | ||
"\x03\x12\x03\x13\x03\x13\x03\x14\x03\x14\x03\x14\x03F\x02\x02\x15\x02" + | ||
"\x02\x04\x02\x06\x02\b\x02\n\x02\f\x02\x0E\x02\x10\x02\x12\x02\x14\x02" + | ||
"\x16\x02\x18\x02\x1A\x02\x1C\x02\x1E\x02 \x02\"\x02$\x02&\x02\x02\x04" + | ||
"\x03\x02\r\r\x05\x02\x03\x03\x05\x05\b\b\x02\x82\x02/\x03\x02\x02\x02" + | ||
"\x045\x03\x02\x02\x02\x068\x03\x02\x02\x02\bB\x03\x02\x02\x02\nK\x03\x02" + | ||
"\x02\x02\fN\x03\x02\x02\x02\x0EW\x03\x02\x02\x02\x10Y\x03\x02\x02\x02" + | ||
"\x12\\\x03\x02\x02\x02\x14^\x03\x02\x02\x02\x16a\x03\x02\x02\x02\x18e" + | ||
"\x03\x02\x02\x02\x1Ak\x03\x02\x02\x02\x1Cm\x03\x02\x02\x02\x1Eq\x03\x02" + | ||
"\x02\x02 \x7F\x03\x02\x02\x02\"\x84\x03\x02\x02\x02$\x86\x03\x02\x02\x02" + | ||
"&\x88\x03\x02\x02\x02(*\x05\b\x05\x02)(\x03\x02\x02\x02*-\x03\x02\x02" + | ||
"\x02+)\x03\x02\x02\x02+,\x03\x02\x02\x02,.\x03\x02\x02\x02-+\x03\x02\x02" + | ||
"\x02.0\x05\x04\x03\x02/+\x03\x02\x02\x0201\x03\x02\x02\x021/\x03\x02\x02" + | ||
"\x0212\x03\x02\x02\x0223\x03\x02\x02\x0234\x07\x02\x02\x034\x03\x03\x02" + | ||
"\x02\x0256\x05\x06\x04\x0267\x05\n\x06\x027\x05\x03\x02\x02\x0289\x07" + | ||
"\x04\x02\x029=\x05\x14\v\x02:<\x05\x16\f\x02;:\x03\x02\x02\x02<?\x03\x02" + | ||
"\x02\x02=;\x03\x02\x02\x02=>\x03\x02\x02\x02>@\x03\x02\x02\x02?=\x03\x02" + | ||
"\x02\x02@A\x07\x13\x02\x02A\x07\x03\x02\x02\x02BF\x07\x04\x02\x02CE\n" + | ||
"\x02\x02\x02DC\x03\x02\x02\x02EH\x03\x02\x02\x02FG\x03\x02\x02\x02FD\x03" + | ||
"\x02\x02\x02GI\x03\x02\x02\x02HF\x03\x02\x02\x02IJ\x07\x13\x02\x02J\t" + | ||
"\x03\x02\x02\x02KL\x05\f\x07\x02LM\x07\x06\x02\x02M\v\x03\x02\x02\x02" + | ||
"NT\x05\x0E\b\x02OS\x05\b\x05\x02PS\x05\x10\t\x02QS\x05\x0E\b\x02RO\x03" + | ||
"\x02\x02\x02RP\x03\x02\x02\x02RQ\x03\x02\x02\x02SV\x03\x02\x02\x02TR\x03" + | ||
"\x02\x02\x02TU\x03\x02\x02\x02U\r\x03\x02\x02\x02VT\x03\x02\x02\x02WX" + | ||
"\t\x03\x02\x02X\x0F\x03\x02\x02\x02YZ\x07\t\x02\x02Z[\x05\x12\n\x02[\x11" + | ||
"\x03\x02\x02\x02\\]\x07\x03\x02\x02]\x13\x03\x02\x02\x02^_\x07\r\x02\x02" + | ||
"_`\x05$\x13\x02`\x15\x03\x02\x02\x02ab\x07\x0E\x02\x02bc\x05&\x14\x02" + | ||
"cd\x05\x18\r\x02d\x17\x03\x02\x02\x02ef\x07\v\x02\x02fg\x05\x1A\x0E\x02" + | ||
"g\x19\x03\x02\x02\x02hl\x05\x1C\x0F\x02il\x05\x1E\x10\x02jl\x05 \x11\x02" + | ||
"kh\x03\x02\x02\x02ki\x03\x02\x02\x02kj\x03\x02\x02\x02l\x1B\x03\x02\x02" + | ||
"\x02mn\x07\x0F\x02\x02no\x07\f\x02\x02op\x07\x10\x02\x02p\x1D\x03\x02" + | ||
"\x02\x02qr\x07\x0F\x02\x02rw\x05\"\x12\x02st\x07\x11\x02\x02tv\x05\"\x12" + | ||
"\x02us\x03\x02\x02\x02vy\x03\x02\x02\x02wu\x03\x02\x02\x02wx\x03\x02\x02" + | ||
"\x02x{\x03\x02\x02\x02yw\x03\x02\x02\x02z|\x07\x11\x02\x02{z\x03\x02\x02" + | ||
"\x02{|\x03\x02\x02\x02|}\x03\x02\x02\x02}~\x07\x10\x02\x02~\x1F\x03\x02" + | ||
"\x02\x02\x7F\x80\x07\x0F\x02\x02\x80\x81\x05\x1E\x10\x02\x81\x82\x07\f" + | ||
"\x02\x02\x82\x83\x07\x10\x02\x02\x83!\x03\x02\x02\x02\x84\x85\x07\x03" + | ||
"\x02\x02\x85#\x03\x02\x02\x02\x86\x87\x07\x03\x02\x02\x87%\x03\x02\x02" + | ||
"\x02\x88\x89\x07\x03\x02\x02\x89\'\x03\x02\x02\x02\v+1=FRTkw{"; | ||
"\x05\n_\n\n\x03\v\x03\v\x03\v\x03\f\x03\f\x03\f\x03\f\x03\r\x03\r\x03" + | ||
"\r\x03\x0E\x03\x0E\x03\x0E\x05\x0En\n\x0E\x03\x0F\x03\x0F\x03\x0F\x03" + | ||
"\x0F\x03\x10\x03\x10\x03\x10\x03\x10\x07\x10x\n\x10\f\x10\x0E\x10{\v\x10" + | ||
"\x03\x10\x05\x10~\n\x10\x03\x10\x03\x10\x03\x11\x03\x11\x03\x11\x03\x11" + | ||
"\x03\x11\x03\x12\x03\x12\x05\x12\x89\n\x12\x03\x13\x03\x13\x03\x14\x03" + | ||
"\x14\x03\x14\x03F\x02\x02\x15\x02\x02\x04\x02\x06\x02\b\x02\n\x02\f\x02" + | ||
"\x0E\x02\x10\x02\x12\x02\x14\x02\x16\x02\x18\x02\x1A\x02\x1C\x02\x1E\x02" + | ||
" \x02\"\x02$\x02&\x02\x02\x04\x03\x02\x0E\x0E\x05\x02\x03\x03\x06\x06" + | ||
"\t\t\x02\x88\x02/\x03\x02\x02\x02\x045\x03\x02\x02\x02\x068\x03\x02\x02" + | ||
"\x02\bB\x03\x02\x02\x02\nK\x03\x02\x02\x02\fN\x03\x02\x02\x02\x0EW\x03" + | ||
"\x02\x02\x02\x10Y\x03\x02\x02\x02\x12\\\x03\x02\x02\x02\x14`\x03\x02\x02" + | ||
"\x02\x16c\x03\x02\x02\x02\x18g\x03\x02\x02\x02\x1Am\x03\x02\x02\x02\x1C" + | ||
"o\x03\x02\x02\x02\x1Es\x03\x02\x02\x02 \x81\x03\x02\x02\x02\"\x86\x03" + | ||
"\x02\x02\x02$\x8A\x03\x02\x02\x02&\x8C\x03\x02\x02\x02(*\x05\b\x05\x02" + | ||
")(\x03\x02\x02\x02*-\x03\x02\x02\x02+)\x03\x02\x02\x02+,\x03\x02\x02\x02" + | ||
",.\x03\x02\x02\x02-+\x03\x02\x02\x02.0\x05\x04\x03\x02/+\x03\x02\x02\x02" + | ||
"01\x03\x02\x02\x021/\x03\x02\x02\x0212\x03\x02\x02\x0223\x03\x02\x02\x02" + | ||
"34\x07\x02\x02\x034\x03\x03\x02\x02\x0256\x05\x06\x04\x0267\x05\n\x06" + | ||
"\x027\x05\x03\x02\x02\x0289\x07\x04\x02\x029=\x05\x14\v\x02:<\x05\x16" + | ||
"\f\x02;:\x03\x02\x02\x02<?\x03\x02\x02\x02=;\x03\x02\x02\x02=>\x03\x02" + | ||
"\x02\x02>@\x03\x02\x02\x02?=\x03\x02\x02\x02@A\x07\x15\x02\x02A\x07\x03" + | ||
"\x02\x02\x02BF\x07\x04\x02\x02CE\n\x02\x02\x02DC\x03\x02\x02\x02EH\x03" + | ||
"\x02\x02\x02FG\x03\x02\x02\x02FD\x03\x02\x02\x02GI\x03\x02\x02\x02HF\x03" + | ||
"\x02\x02\x02IJ\x07\x15\x02\x02J\t\x03\x02\x02\x02KL\x05\f\x07\x02LM\x07" + | ||
"\x07\x02\x02M\v\x03\x02\x02\x02NT\x05\x0E\b\x02OS\x05\b\x05\x02PS\x05" + | ||
"\x10\t\x02QS\x05\x0E\b\x02RO\x03\x02\x02\x02RP\x03\x02\x02\x02RQ\x03\x02" + | ||
"\x02\x02SV\x03\x02\x02\x02TR\x03\x02\x02\x02TU\x03\x02\x02\x02U\r\x03" + | ||
"\x02\x02\x02VT\x03\x02\x02\x02WX\t\x03\x02\x02X\x0F\x03\x02\x02\x02YZ" + | ||
"\x07\n\x02\x02Z[\x05\x12\n\x02[\x11\x03\x02\x02\x02\\^\x07\x03\x02\x02" + | ||
"]_\x07\x05\x02\x02^]\x03\x02\x02\x02^_\x03\x02\x02\x02_\x13\x03\x02\x02" + | ||
"\x02`a\x07\x0E\x02\x02ab\x05$\x13\x02b\x15\x03\x02\x02\x02cd\x07\x0F\x02" + | ||
"\x02de\x05&\x14\x02ef\x05\x18\r\x02f\x17\x03\x02\x02\x02gh\x07\f\x02\x02" + | ||
"hi\x05\x1A\x0E\x02i\x19\x03\x02\x02\x02jn\x05\x1C\x0F\x02kn\x05\x1E\x10" + | ||
"\x02ln\x05 \x11\x02mj\x03\x02\x02\x02mk\x03\x02\x02\x02ml\x03\x02\x02" + | ||
"\x02n\x1B\x03\x02\x02\x02op\x07\x10\x02\x02pq\x07\r\x02\x02qr\x07\x11" + | ||
"\x02\x02r\x1D\x03\x02\x02\x02st\x07\x10\x02\x02ty\x05\"\x12\x02uv\x07" + | ||
"\x12\x02\x02vx\x05\"\x12\x02wu\x03\x02\x02\x02x{\x03\x02\x02\x02yw\x03" + | ||
"\x02\x02\x02yz\x03\x02\x02\x02z}\x03\x02\x02\x02{y\x03\x02\x02\x02|~\x07" + | ||
"\x12\x02\x02}|\x03\x02\x02\x02}~\x03\x02\x02\x02~\x7F\x03\x02\x02\x02" + | ||
"\x7F\x80\x07\x11\x02\x02\x80\x1F\x03\x02\x02\x02\x81\x82\x07\x10\x02\x02" + | ||
"\x82\x83\x05\x1E\x10\x02\x83\x84\x07\r\x02\x02\x84\x85\x07\x11\x02\x02" + | ||
"\x85!\x03\x02\x02\x02\x86\x88\x07\x03\x02\x02\x87\x89\x07\x13\x02\x02" + | ||
"\x88\x87\x03\x02\x02\x02\x88\x89\x03\x02\x02\x02\x89#\x03\x02\x02\x02" + | ||
"\x8A\x8B\x07\x03\x02\x02\x8B%\x03\x02\x02\x02\x8C\x8D\x07\x03\x02\x02" + | ||
"\x8D\'\x03\x02\x02\x02\r+1=FRT^my}\x88"; | ||
class InputContext extends ParserRuleContext_1.ParserRuleContext { | ||
@@ -1192,2 +1218,3 @@ EOF() { return this.getToken(SQLParser.EOF, 0); } | ||
ID() { return this.getToken(SQLParser.ID, 0); } | ||
S_REQUIRED_MARK() { return this.tryGetToken(SQLParser.S_REQUIRED_MARK, 0); } | ||
constructor(parent, invokingState) { | ||
@@ -1477,2 +1504,3 @@ super(parent, invokingState); | ||
ID() { return this.getToken(SQLParser.ID, 0); } | ||
C_REQUIRED_MARK() { return this.tryGetToken(SQLParser.C_REQUIRED_MARK, 0); } | ||
constructor(parent, invokingState) { | ||
@@ -1479,0 +1507,0 @@ super(parent, invokingState); |
@@ -1,2 +0,2 @@ | ||
import ts from 'typescript'; | ||
import * as ts from 'typescript'; | ||
import parseQuery, { Query } from './query'; | ||
@@ -3,0 +3,0 @@ import { ParseEvent } from '../sql/logger'; |
"use strict"; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -6,3 +13,3 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const typescript_1 = __importDefault(require("typescript")); | ||
const ts = __importStar(require("typescript")); | ||
const query_1 = __importDefault(require("./query")); | ||
@@ -14,3 +21,3 @@ exports.parseTSQuery = query_1.default; | ||
function parseNode(node) { | ||
if (node.kind === typescript_1.default.SyntaxKind.TaggedTemplateExpression) { | ||
if (node.kind === ts.SyntaxKind.TaggedTemplateExpression) { | ||
const queryName = node.parent.getChildren()[0].getText(); | ||
@@ -31,3 +38,3 @@ const taggedTemplateNode = node; | ||
} | ||
typescript_1.default.forEachChild(node, parseNode); | ||
ts.forEachChild(node, parseNode); | ||
} | ||
@@ -45,3 +52,3 @@ const queries = []; | ||
const parseCode = (fileContent, fileName = 'unnamed.ts') => { | ||
const sourceFile = typescript_1.default.createSourceFile(fileName, fileContent, typescript_1.default.ScriptTarget.ES2015, true); | ||
const sourceFile = ts.createSourceFile(fileName, fileContent, ts.ScriptTarget.ES2015, true); | ||
return parseFile(sourceFile); | ||
@@ -48,0 +55,0 @@ }; |
@@ -13,6 +13,7 @@ import { ATN } from "antlr4ts/atn/ATN"; | ||
static readonly WORD = 7; | ||
static readonly SPECIAL = 8; | ||
static readonly EOF_STATEMENT = 9; | ||
static readonly WSL = 10; | ||
static readonly STRING = 11; | ||
static readonly REQUIRED_MARK = 8; | ||
static readonly SPECIAL = 9; | ||
static readonly EOF_STATEMENT = 10; | ||
static readonly WSL = 11; | ||
static readonly STRING = 12; | ||
static readonly channelNames: string[]; | ||
@@ -19,0 +20,0 @@ static readonly modeNames: string[]; |
@@ -52,6 +52,7 @@ "use strict"; | ||
QueryLexer.WORD = 7; | ||
QueryLexer.SPECIAL = 8; | ||
QueryLexer.EOF_STATEMENT = 9; | ||
QueryLexer.WSL = 10; | ||
QueryLexer.STRING = 11; | ||
QueryLexer.REQUIRED_MARK = 8; | ||
QueryLexer.SPECIAL = 9; | ||
QueryLexer.EOF_STATEMENT = 10; | ||
QueryLexer.WSL = 11; | ||
QueryLexer.STRING = 12; | ||
// tslint:disable:no-trailing-whitespace | ||
@@ -67,49 +68,53 @@ QueryLexer.channelNames = [ | ||
"QUOT", "ID", "SID", "SINGULAR_PARAM_MARK", "PLURAL_PARAM_MARK", "COMMA", | ||
"OB", "CB", "WORD", "SPECIAL", "EOF_STATEMENT", "WSL", "STRING", | ||
"OB", "CB", "WORD", "REQUIRED_MARK", "SPECIAL", "EOF_STATEMENT", "WSL", | ||
"STRING", | ||
]; | ||
QueryLexer._LITERAL_NAMES = [ | ||
undefined, undefined, "'$'", "'$$'", "','", "'('", "')'", undefined, undefined, | ||
"';'", | ||
undefined, undefined, "'$'", "'$$'", "','", "'('", "')'", undefined, "'!'", | ||
undefined, "';'", | ||
]; | ||
QueryLexer._SYMBOLIC_NAMES = [ | ||
undefined, "ID", "SINGULAR_PARAM_MARK", "PLURAL_PARAM_MARK", "COMMA", | ||
"OB", "CB", "WORD", "SPECIAL", "EOF_STATEMENT", "WSL", "STRING", | ||
"OB", "CB", "WORD", "REQUIRED_MARK", "SPECIAL", "EOF_STATEMENT", "WSL", | ||
"STRING", | ||
]; | ||
QueryLexer.VOCABULARY = new VocabularyImpl_1.VocabularyImpl(QueryLexer._LITERAL_NAMES, QueryLexer._SYMBOLIC_NAMES, []); | ||
QueryLexer._serializedATN = "\x03\uC91D\uCABA\u058D\uAFBA\u4F53\u0607\uEA8B\uC241\x02\rT\b\x01\x04" + | ||
QueryLexer._serializedATN = "\x03\uC91D\uCABA\u058D\uAFBA\u4F53\u0607\uEA8B\uC241\x02\x0EX\b\x01\x04" + | ||
"\x02\t\x02\x04\x03\t\x03\x04\x04\t\x04\x04\x05\t\x05\x04\x06\t\x06\x04" + | ||
"\x07\t\x07\x04\b\t\b\x04\t\t\t\x04\n\t\n\x04\v\t\v\x04\f\t\f\x04\r\t\r" + | ||
"\x04\x0E\t\x0E\x03\x02\x03\x02\x03\x03\x03\x03\x07\x03\"\n\x03\f\x03\x0E" + | ||
"\x03%\v\x03\x03\x04\x03\x04\x03\x04\x03\x04\x03\x05\x03\x05\x03\x06\x03" + | ||
"\x06\x03\x06\x03\x07\x03\x07\x03\b\x03\b\x03\t\x03\t\x03\n\x06\n7\n\n" + | ||
"\r\n\x0E\n8\x03\v\x06\v<\n\v\r\v\x0E\v=\x03\f\x03\f\x03\r\x06\rC\n\r\r" + | ||
"\r\x0E\rD\x03\r\x03\r\x03\x0E\x03\x0E\x03\x0E\x07\x0EL\n\x0E\f\x0E\x0E" + | ||
"\x0EO\v\x0E\x03\x0E\x03\x0E\x05\x0ES\n\x0E\x03M\x02\x02\x0F\x03\x02\x02" + | ||
"\x05\x02\x03\x07\x02\x02\t\x02\x04\v\x02\x05\r\x02\x06\x0F\x02\x07\x11" + | ||
"\x02\b\x13\x02\t\x15\x02\n\x17\x02\v\x19\x02\f\x1B\x02\r\x03\x02\x07\x05" + | ||
"\x02C\\aac|\x06\x022;C\\aac|\v\x02#(,-/1<<>B]]_`bb}\x80\x05\x02\v\f\x0F" + | ||
"\x0F\"\"\x03\x02^^\x02W\x02\x07\x03\x02\x02\x02\x02\t\x03\x02\x02\x02" + | ||
"\x02\v\x03\x02\x02\x02\x02\r\x03\x02\x02\x02\x02\x0F\x03\x02\x02\x02\x02" + | ||
"\x11\x03\x02\x02\x02\x02\x13\x03\x02\x02\x02\x02\x15\x03\x02\x02\x02\x02" + | ||
"\x17\x03\x02\x02\x02\x02\x19\x03\x02\x02\x02\x02\x1B\x03\x02\x02\x02\x03" + | ||
"\x1D\x03\x02\x02\x02\x05\x1F\x03\x02\x02\x02\x07&\x03\x02\x02\x02\t*\x03" + | ||
"\x02\x02\x02\v,\x03\x02\x02\x02\r/\x03\x02\x02\x02\x0F1\x03\x02\x02\x02" + | ||
"\x113\x03\x02\x02\x02\x136\x03\x02\x02\x02\x15;\x03\x02\x02\x02\x17?\x03" + | ||
"\x02\x02\x02\x19B\x03\x02\x02\x02\x1BH\x03\x02\x02\x02\x1D\x1E\x07)\x02" + | ||
"\x02\x1E\x04\x03\x02\x02\x02\x1F#\t\x02\x02\x02 \"\t\x03\x02\x02! \x03" + | ||
"\x02\x02\x02\"%\x03\x02\x02\x02#!\x03\x02\x02\x02#$\x03\x02\x02\x02$\x06" + | ||
"\x03\x02\x02\x02%#\x03\x02\x02\x02&\'\x05\x05\x03\x02\'(\x03\x02\x02\x02" + | ||
"()\b\x04\x02\x02)\b\x03\x02\x02\x02*+\x07&\x02\x02+\n\x03\x02\x02\x02" + | ||
",-\x07&\x02\x02-.\x07&\x02\x02.\f\x03\x02\x02\x02/0\x07.\x02\x020\x0E" + | ||
"\x03\x02\x02\x0212\x07*\x02\x022\x10\x03\x02\x02\x0234\x07+\x02\x024\x12" + | ||
"\x03\x02\x02\x0257\t\x03\x02\x0265\x03\x02\x02\x0278\x03\x02\x02\x028" + | ||
"6\x03\x02\x02\x0289\x03\x02\x02\x029\x14\x03\x02\x02\x02:<\t\x04\x02\x02" + | ||
";:\x03\x02\x02\x02<=\x03\x02\x02\x02=;\x03\x02\x02\x02=>\x03\x02\x02\x02" + | ||
">\x16\x03\x02\x02\x02?@\x07=\x02\x02@\x18\x03\x02\x02\x02AC\t\x05\x02" + | ||
"\x02BA\x03\x02\x02\x02CD\x03\x02\x02\x02DB\x03\x02\x02\x02DE\x03\x02\x02" + | ||
"\x02EF\x03\x02\x02\x02FG\b\r\x03\x02G\x1A\x03\x02\x02\x02HR\x05\x03\x02" + | ||
"\x02IS\x05\x03\x02\x02JL\v\x02\x02\x02KJ\x03\x02\x02\x02LO\x03\x02\x02" + | ||
"\x02MN\x03\x02\x02\x02MK\x03\x02\x02\x02NP\x03\x02\x02\x02OM\x03\x02\x02" + | ||
"\x02PQ\n\x06\x02\x02QS\x05\x03\x02\x02RI\x03\x02\x02\x02RM\x03\x02\x02" + | ||
"\x02S\x1C\x03\x02\x02\x02\t\x02#8=DMR\x04\t\x03\x02\b\x02\x02"; | ||
"\x04\x0E\t\x0E\x04\x0F\t\x0F\x03\x02\x03\x02\x03\x03\x03\x03\x07\x03$" + | ||
"\n\x03\f\x03\x0E\x03\'\v\x03\x03\x04\x03\x04\x03\x04\x03\x04\x03\x05\x03" + | ||
"\x05\x03\x06\x03\x06\x03\x06\x03\x07\x03\x07\x03\b\x03\b\x03\t\x03\t\x03" + | ||
"\n\x06\n9\n\n\r\n\x0E\n:\x03\v\x03\v\x03\f\x06\f@\n\f\r\f\x0E\fA\x03\r" + | ||
"\x03\r\x03\x0E\x06\x0EG\n\x0E\r\x0E\x0E\x0EH\x03\x0E\x03\x0E\x03\x0F\x03" + | ||
"\x0F\x03\x0F\x07\x0FP\n\x0F\f\x0F\x0E\x0FS\v\x0F\x03\x0F\x03\x0F\x05\x0F" + | ||
"W\n\x0F\x03Q\x02\x02\x10\x03\x02\x02\x05\x02\x03\x07\x02\x02\t\x02\x04" + | ||
"\v\x02\x05\r\x02\x06\x0F\x02\x07\x11\x02\b\x13\x02\t\x15\x02\n\x17\x02" + | ||
"\v\x19\x02\f\x1B\x02\r\x1D\x02\x0E\x03\x02\x07\x05\x02C\\aac|\x06\x02" + | ||
"2;C\\aac|\v\x02$(,-/1<<>B]]_`bb}\x80\x05\x02\v\f\x0F\x0F\"\"\x03\x02^" + | ||
"^\x02[\x02\x07\x03\x02\x02\x02\x02\t\x03\x02\x02\x02\x02\v\x03\x02\x02" + | ||
"\x02\x02\r\x03\x02\x02\x02\x02\x0F\x03\x02\x02\x02\x02\x11\x03\x02\x02" + | ||
"\x02\x02\x13\x03\x02\x02\x02\x02\x15\x03\x02\x02\x02\x02\x17\x03\x02\x02" + | ||
"\x02\x02\x19\x03\x02\x02\x02\x02\x1B\x03\x02\x02\x02\x02\x1D\x03\x02\x02" + | ||
"\x02\x03\x1F\x03\x02\x02\x02\x05!\x03\x02\x02\x02\x07(\x03\x02\x02\x02" + | ||
"\t,\x03\x02\x02\x02\v.\x03\x02\x02\x02\r1\x03\x02\x02\x02\x0F3\x03\x02" + | ||
"\x02\x02\x115\x03\x02\x02\x02\x138\x03\x02\x02\x02\x15<\x03\x02\x02\x02" + | ||
"\x17?\x03\x02\x02\x02\x19C\x03\x02\x02\x02\x1BF\x03\x02\x02\x02\x1DL\x03" + | ||
"\x02\x02\x02\x1F \x07)\x02\x02 \x04\x03\x02\x02\x02!%\t\x02\x02\x02\"" + | ||
"$\t\x03\x02\x02#\"\x03\x02\x02\x02$\'\x03\x02\x02\x02%#\x03\x02\x02\x02" + | ||
"%&\x03\x02\x02\x02&\x06\x03\x02\x02\x02\'%\x03\x02\x02\x02()\x05\x05\x03" + | ||
"\x02)*\x03\x02\x02\x02*+\b\x04\x02\x02+\b\x03\x02\x02\x02,-\x07&\x02\x02" + | ||
"-\n\x03\x02\x02\x02./\x07&\x02\x02/0\x07&\x02\x020\f\x03\x02\x02\x021" + | ||
"2\x07.\x02\x022\x0E\x03\x02\x02\x0234\x07*\x02\x024\x10\x03\x02\x02\x02" + | ||
"56\x07+\x02\x026\x12\x03\x02\x02\x0279\t\x03\x02\x0287\x03\x02\x02\x02" + | ||
"9:\x03\x02\x02\x02:8\x03\x02\x02\x02:;\x03\x02\x02\x02;\x14\x03\x02\x02" + | ||
"\x02<=\x07#\x02\x02=\x16\x03\x02\x02\x02>@\t\x04\x02\x02?>\x03\x02\x02" + | ||
"\x02@A\x03\x02\x02\x02A?\x03\x02\x02\x02AB\x03\x02\x02\x02B\x18\x03\x02" + | ||
"\x02\x02CD\x07=\x02\x02D\x1A\x03\x02\x02\x02EG\t\x05\x02\x02FE\x03\x02" + | ||
"\x02\x02GH\x03\x02\x02\x02HF\x03\x02\x02\x02HI\x03\x02\x02\x02IJ\x03\x02" + | ||
"\x02\x02JK\b\x0E\x03\x02K\x1C\x03\x02\x02\x02LV\x05\x03\x02\x02MW\x05" + | ||
"\x03\x02\x02NP\v\x02\x02\x02ON\x03\x02\x02\x02PS\x03\x02\x02\x02QR\x03" + | ||
"\x02\x02\x02QO\x03\x02\x02\x02RT\x03\x02\x02\x02SQ\x03\x02\x02\x02TU\n" + | ||
"\x06\x02\x02UW\x05\x03\x02\x02VM\x03\x02\x02\x02VQ\x03\x02\x02\x02W\x1E" + | ||
"\x03\x02\x02\x02\t\x02%:AHQV\x04\t\x03\x02\b\x02\x02"; | ||
//# sourceMappingURL=QueryLexer.js.map |
@@ -18,10 +18,11 @@ import { ATN } from "antlr4ts/atn/ATN"; | ||
static readonly WORD = 7; | ||
static readonly SPECIAL = 8; | ||
static readonly EOF_STATEMENT = 9; | ||
static readonly WSL = 10; | ||
static readonly STRING = 11; | ||
static readonly REQUIRED_MARK = 8; | ||
static readonly SPECIAL = 9; | ||
static readonly EOF_STATEMENT = 10; | ||
static readonly WSL = 11; | ||
static readonly STRING = 12; | ||
static readonly RULE_input = 0; | ||
static readonly RULE_query = 1; | ||
static readonly RULE_ignored = 2; | ||
static readonly RULE_param = 3; | ||
static readonly RULE_param = 2; | ||
static readonly RULE_ignored = 3; | ||
static readonly RULE_scalarParam = 4; | ||
@@ -31,4 +32,5 @@ static readonly RULE_pickParam = 5; | ||
static readonly RULE_arrayParam = 7; | ||
static readonly RULE_paramName = 8; | ||
static readonly RULE_pickKey = 9; | ||
static readonly RULE_scalarParamName = 8; | ||
static readonly RULE_paramName = 9; | ||
static readonly RULE_pickKey = 10; | ||
static readonly ruleNames: string[]; | ||
@@ -46,4 +48,4 @@ private static readonly _LITERAL_NAMES; | ||
query(): QueryContext; | ||
param(): ParamContext; | ||
ignored(): IgnoredContext; | ||
param(): ParamContext; | ||
scalarParam(): ScalarParamContext; | ||
@@ -53,2 +55,3 @@ pickParam(): PickParamContext; | ||
arrayParam(): ArrayParamContext; | ||
scalarParamName(): ScalarParamNameContext; | ||
paramName(): ParamNameContext; | ||
@@ -81,2 +84,13 @@ pickKey(): PickKeyContext; | ||
} | ||
export declare class ParamContext extends ParserRuleContext { | ||
pickParam(): PickParamContext | undefined; | ||
arrayPickParam(): ArrayPickParamContext | undefined; | ||
scalarParam(): ScalarParamContext | undefined; | ||
arrayParam(): ArrayParamContext | undefined; | ||
constructor(parent: ParserRuleContext | undefined, invokingState: number); | ||
get ruleIndex(): number; | ||
enterRule(listener: QueryParserListener): void; | ||
exitRule(listener: QueryParserListener): void; | ||
accept<Result>(visitor: QueryParserVisitor<Result>): Result; | ||
} | ||
export declare class IgnoredContext extends ParserRuleContext { | ||
@@ -97,2 +111,4 @@ ID(): TerminalNode[]; | ||
SPECIAL(i: number): TerminalNode; | ||
REQUIRED_MARK(): TerminalNode[]; | ||
REQUIRED_MARK(i: number): TerminalNode; | ||
constructor(parent: ParserRuleContext | undefined, invokingState: number); | ||
@@ -104,16 +120,5 @@ get ruleIndex(): number; | ||
} | ||
export declare class ParamContext extends ParserRuleContext { | ||
pickParam(): PickParamContext | undefined; | ||
arrayPickParam(): ArrayPickParamContext | undefined; | ||
scalarParam(): ScalarParamContext | undefined; | ||
arrayParam(): ArrayParamContext | undefined; | ||
constructor(parent: ParserRuleContext | undefined, invokingState: number); | ||
get ruleIndex(): number; | ||
enterRule(listener: QueryParserListener): void; | ||
exitRule(listener: QueryParserListener): void; | ||
accept<Result>(visitor: QueryParserVisitor<Result>): Result; | ||
} | ||
export declare class ScalarParamContext extends ParserRuleContext { | ||
SINGULAR_PARAM_MARK(): TerminalNode; | ||
paramName(): ParamNameContext; | ||
scalarParamName(): ScalarParamNameContext; | ||
constructor(parent: ParserRuleContext | undefined, invokingState: number); | ||
@@ -157,3 +162,3 @@ get ruleIndex(): number; | ||
PLURAL_PARAM_MARK(): TerminalNode; | ||
paramName(): ParamNameContext; | ||
scalarParamName(): ScalarParamNameContext; | ||
constructor(parent: ParserRuleContext | undefined, invokingState: number); | ||
@@ -165,2 +170,11 @@ get ruleIndex(): number; | ||
} | ||
export declare class ScalarParamNameContext extends ParserRuleContext { | ||
ID(): TerminalNode; | ||
REQUIRED_MARK(): TerminalNode | undefined; | ||
constructor(parent: ParserRuleContext | undefined, invokingState: number); | ||
get ruleIndex(): number; | ||
enterRule(listener: QueryParserListener): void; | ||
exitRule(listener: QueryParserListener): void; | ||
accept<Result>(visitor: QueryParserVisitor<Result>): Result; | ||
} | ||
export declare class ParamNameContext extends ParserRuleContext { | ||
@@ -176,2 +190,3 @@ ID(): TerminalNode; | ||
ID(): TerminalNode; | ||
REQUIRED_MARK(): TerminalNode | undefined; | ||
constructor(parent: ParserRuleContext | undefined, invokingState: number); | ||
@@ -178,0 +193,0 @@ get ruleIndex(): number; |
@@ -50,5 +50,5 @@ "use strict"; | ||
{ | ||
this.state = 20; | ||
this.state = 22; | ||
this.query(); | ||
this.state = 22; | ||
this.state = 24; | ||
this._errHandler.sync(this); | ||
@@ -58,7 +58,7 @@ _la = this._input.LA(1); | ||
{ | ||
this.state = 21; | ||
this.state = 23; | ||
this.match(QueryParser.EOF_STATEMENT); | ||
} | ||
} | ||
this.state = 24; | ||
this.state = 26; | ||
this.match(QueryParser.EOF); | ||
@@ -90,3 +90,3 @@ } | ||
{ | ||
this.state = 27; | ||
this.state = 29; | ||
this._errHandler.sync(this); | ||
@@ -97,11 +97,11 @@ _la = this._input.LA(1); | ||
{ | ||
this.state = 26; | ||
this.state = 28; | ||
this.ignored(); | ||
} | ||
} | ||
this.state = 29; | ||
this.state = 31; | ||
this._errHandler.sync(this); | ||
_la = this._input.LA(1); | ||
} while ((((_la) & ~0x1F) === 0 && ((1 << _la) & ((1 << QueryParser.ID) | (1 << QueryParser.COMMA) | (1 << QueryParser.OB) | (1 << QueryParser.CB) | (1 << QueryParser.WORD) | (1 << QueryParser.SPECIAL) | (1 << QueryParser.STRING))) !== 0)); | ||
this.state = 40; | ||
} while ((((_la) & ~0x1F) === 0 && ((1 << _la) & ((1 << QueryParser.ID) | (1 << QueryParser.COMMA) | (1 << QueryParser.OB) | (1 << QueryParser.CB) | (1 << QueryParser.WORD) | (1 << QueryParser.REQUIRED_MARK) | (1 << QueryParser.SPECIAL) | (1 << QueryParser.STRING))) !== 0)); | ||
this.state = 42; | ||
this._errHandler.sync(this); | ||
@@ -112,15 +112,15 @@ _la = this._input.LA(1); | ||
{ | ||
this.state = 31; | ||
this.state = 33; | ||
this.param(); | ||
this.state = 35; | ||
this.state = 37; | ||
this._errHandler.sync(this); | ||
_la = this._input.LA(1); | ||
while ((((_la) & ~0x1F) === 0 && ((1 << _la) & ((1 << QueryParser.ID) | (1 << QueryParser.COMMA) | (1 << QueryParser.OB) | (1 << QueryParser.CB) | (1 << QueryParser.WORD) | (1 << QueryParser.SPECIAL) | (1 << QueryParser.STRING))) !== 0)) { | ||
while ((((_la) & ~0x1F) === 0 && ((1 << _la) & ((1 << QueryParser.ID) | (1 << QueryParser.COMMA) | (1 << QueryParser.OB) | (1 << QueryParser.CB) | (1 << QueryParser.WORD) | (1 << QueryParser.REQUIRED_MARK) | (1 << QueryParser.SPECIAL) | (1 << QueryParser.STRING))) !== 0)) { | ||
{ | ||
{ | ||
this.state = 32; | ||
this.state = 34; | ||
this.ignored(); | ||
} | ||
} | ||
this.state = 37; | ||
this.state = 39; | ||
this._errHandler.sync(this); | ||
@@ -131,3 +131,3 @@ _la = this._input.LA(1); | ||
} | ||
this.state = 42; | ||
this.state = 44; | ||
this._errHandler.sync(this); | ||
@@ -154,5 +154,58 @@ _la = this._input.LA(1); | ||
// @RuleVersion(0) | ||
param() { | ||
let _localctx = new ParamContext(this._ctx, this.state); | ||
this.enterRule(_localctx, 4, QueryParser.RULE_param); | ||
try { | ||
this.state = 49; | ||
this._errHandler.sync(this); | ||
switch (this.interpreter.adaptivePredict(this._input, 4, this._ctx)) { | ||
case 1: | ||
this.enterOuterAlt(_localctx, 1); | ||
{ | ||
this.state = 45; | ||
this.pickParam(); | ||
} | ||
break; | ||
case 2: | ||
this.enterOuterAlt(_localctx, 2); | ||
{ | ||
this.state = 46; | ||
this.arrayPickParam(); | ||
} | ||
break; | ||
case 3: | ||
this.enterOuterAlt(_localctx, 3); | ||
{ | ||
this.state = 47; | ||
this.scalarParam(); | ||
} | ||
break; | ||
case 4: | ||
this.enterOuterAlt(_localctx, 4); | ||
{ | ||
this.state = 48; | ||
this.arrayParam(); | ||
} | ||
break; | ||
} | ||
} | ||
catch (re) { | ||
if (re instanceof RecognitionException_1.RecognitionException) { | ||
_localctx.exception = re; | ||
this._errHandler.reportError(this, re); | ||
this._errHandler.recover(this, re); | ||
} | ||
else { | ||
throw re; | ||
} | ||
} | ||
finally { | ||
this.exitRule(); | ||
} | ||
return _localctx; | ||
} | ||
// @RuleVersion(0) | ||
ignored() { | ||
let _localctx = new IgnoredContext(this._ctx, this.state); | ||
this.enterRule(_localctx, 4, QueryParser.RULE_ignored); | ||
this.enterRule(_localctx, 6, QueryParser.RULE_ignored); | ||
let _la; | ||
@@ -163,3 +216,3 @@ try { | ||
{ | ||
this.state = 44; | ||
this.state = 52; | ||
this._errHandler.sync(this); | ||
@@ -172,5 +225,5 @@ _alt = 1; | ||
{ | ||
this.state = 43; | ||
this.state = 51; | ||
_la = this._input.LA(1); | ||
if (!((((_la) & ~0x1F) === 0 && ((1 << _la) & ((1 << QueryParser.ID) | (1 << QueryParser.COMMA) | (1 << QueryParser.OB) | (1 << QueryParser.CB) | (1 << QueryParser.WORD) | (1 << QueryParser.SPECIAL) | (1 << QueryParser.STRING))) !== 0))) { | ||
if (!((((_la) & ~0x1F) === 0 && ((1 << _la) & ((1 << QueryParser.ID) | (1 << QueryParser.COMMA) | (1 << QueryParser.OB) | (1 << QueryParser.CB) | (1 << QueryParser.WORD) | (1 << QueryParser.REQUIRED_MARK) | (1 << QueryParser.SPECIAL) | (1 << QueryParser.STRING))) !== 0))) { | ||
this._errHandler.recoverInline(this); | ||
@@ -191,5 +244,5 @@ } | ||
} | ||
this.state = 46; | ||
this.state = 54; | ||
this._errHandler.sync(this); | ||
_alt = this.interpreter.adaptivePredict(this._input, 4, this._ctx); | ||
_alt = this.interpreter.adaptivePredict(this._input, 5, this._ctx); | ||
} while (_alt !== 2 && _alt !== ATN_1.ATN.INVALID_ALT_NUMBER); | ||
@@ -214,55 +267,2 @@ } | ||
// @RuleVersion(0) | ||
param() { | ||
let _localctx = new ParamContext(this._ctx, this.state); | ||
this.enterRule(_localctx, 6, QueryParser.RULE_param); | ||
try { | ||
this.state = 52; | ||
this._errHandler.sync(this); | ||
switch (this.interpreter.adaptivePredict(this._input, 5, this._ctx)) { | ||
case 1: | ||
this.enterOuterAlt(_localctx, 1); | ||
{ | ||
this.state = 48; | ||
this.pickParam(); | ||
} | ||
break; | ||
case 2: | ||
this.enterOuterAlt(_localctx, 2); | ||
{ | ||
this.state = 49; | ||
this.arrayPickParam(); | ||
} | ||
break; | ||
case 3: | ||
this.enterOuterAlt(_localctx, 3); | ||
{ | ||
this.state = 50; | ||
this.scalarParam(); | ||
} | ||
break; | ||
case 4: | ||
this.enterOuterAlt(_localctx, 4); | ||
{ | ||
this.state = 51; | ||
this.arrayParam(); | ||
} | ||
break; | ||
} | ||
} | ||
catch (re) { | ||
if (re instanceof RecognitionException_1.RecognitionException) { | ||
_localctx.exception = re; | ||
this._errHandler.reportError(this, re); | ||
this._errHandler.recover(this, re); | ||
} | ||
else { | ||
throw re; | ||
} | ||
} | ||
finally { | ||
this.exitRule(); | ||
} | ||
return _localctx; | ||
} | ||
// @RuleVersion(0) | ||
scalarParam() { | ||
@@ -274,6 +274,6 @@ let _localctx = new ScalarParamContext(this._ctx, this.state); | ||
{ | ||
this.state = 54; | ||
this.state = 56; | ||
this.match(QueryParser.SINGULAR_PARAM_MARK); | ||
this.state = 55; | ||
this.paramName(); | ||
this.state = 57; | ||
this.scalarParamName(); | ||
} | ||
@@ -305,11 +305,11 @@ } | ||
{ | ||
this.state = 57; | ||
this.state = 59; | ||
this.match(QueryParser.SINGULAR_PARAM_MARK); | ||
this.state = 58; | ||
this.state = 60; | ||
this.paramName(); | ||
this.state = 59; | ||
this.state = 61; | ||
this.match(QueryParser.OB); | ||
this.state = 60; | ||
this.state = 62; | ||
this.pickKey(); | ||
this.state = 65; | ||
this.state = 67; | ||
this._errHandler.sync(this); | ||
@@ -321,5 +321,5 @@ _alt = this.interpreter.adaptivePredict(this._input, 6, this._ctx); | ||
{ | ||
this.state = 61; | ||
this.state = 63; | ||
this.match(QueryParser.COMMA); | ||
this.state = 62; | ||
this.state = 64; | ||
this.pickKey(); | ||
@@ -329,7 +329,7 @@ } | ||
} | ||
this.state = 67; | ||
this.state = 69; | ||
this._errHandler.sync(this); | ||
_alt = this.interpreter.adaptivePredict(this._input, 6, this._ctx); | ||
} | ||
this.state = 69; | ||
this.state = 71; | ||
this._errHandler.sync(this); | ||
@@ -339,7 +339,7 @@ _la = this._input.LA(1); | ||
{ | ||
this.state = 68; | ||
this.state = 70; | ||
this.match(QueryParser.COMMA); | ||
} | ||
} | ||
this.state = 71; | ||
this.state = 73; | ||
this.match(QueryParser.CB); | ||
@@ -372,11 +372,11 @@ } | ||
{ | ||
this.state = 73; | ||
this.state = 75; | ||
this.match(QueryParser.PLURAL_PARAM_MARK); | ||
this.state = 74; | ||
this.state = 76; | ||
this.paramName(); | ||
this.state = 75; | ||
this.state = 77; | ||
this.match(QueryParser.OB); | ||
this.state = 76; | ||
this.state = 78; | ||
this.pickKey(); | ||
this.state = 81; | ||
this.state = 83; | ||
this._errHandler.sync(this); | ||
@@ -388,5 +388,5 @@ _alt = this.interpreter.adaptivePredict(this._input, 8, this._ctx); | ||
{ | ||
this.state = 77; | ||
this.state = 79; | ||
this.match(QueryParser.COMMA); | ||
this.state = 78; | ||
this.state = 80; | ||
this.pickKey(); | ||
@@ -396,7 +396,7 @@ } | ||
} | ||
this.state = 83; | ||
this.state = 85; | ||
this._errHandler.sync(this); | ||
_alt = this.interpreter.adaptivePredict(this._input, 8, this._ctx); | ||
} | ||
this.state = 85; | ||
this.state = 87; | ||
this._errHandler.sync(this); | ||
@@ -406,7 +406,7 @@ _la = this._input.LA(1); | ||
{ | ||
this.state = 84; | ||
this.state = 86; | ||
this.match(QueryParser.COMMA); | ||
} | ||
} | ||
this.state = 87; | ||
this.state = 89; | ||
this.match(QueryParser.CB); | ||
@@ -437,6 +437,6 @@ } | ||
{ | ||
this.state = 89; | ||
this.state = 91; | ||
this.match(QueryParser.PLURAL_PARAM_MARK); | ||
this.state = 90; | ||
this.paramName(); | ||
this.state = 92; | ||
this.scalarParamName(); | ||
} | ||
@@ -460,9 +460,45 @@ } | ||
// @RuleVersion(0) | ||
scalarParamName() { | ||
let _localctx = new ScalarParamNameContext(this._ctx, this.state); | ||
this.enterRule(_localctx, 16, QueryParser.RULE_scalarParamName); | ||
try { | ||
this.enterOuterAlt(_localctx, 1); | ||
{ | ||
this.state = 94; | ||
this.match(QueryParser.ID); | ||
this.state = 96; | ||
this._errHandler.sync(this); | ||
switch (this.interpreter.adaptivePredict(this._input, 10, this._ctx)) { | ||
case 1: | ||
{ | ||
this.state = 95; | ||
this.match(QueryParser.REQUIRED_MARK); | ||
} | ||
break; | ||
} | ||
} | ||
} | ||
catch (re) { | ||
if (re instanceof RecognitionException_1.RecognitionException) { | ||
_localctx.exception = re; | ||
this._errHandler.reportError(this, re); | ||
this._errHandler.recover(this, re); | ||
} | ||
else { | ||
throw re; | ||
} | ||
} | ||
finally { | ||
this.exitRule(); | ||
} | ||
return _localctx; | ||
} | ||
// @RuleVersion(0) | ||
paramName() { | ||
let _localctx = new ParamNameContext(this._ctx, this.state); | ||
this.enterRule(_localctx, 16, QueryParser.RULE_paramName); | ||
this.enterRule(_localctx, 18, QueryParser.RULE_paramName); | ||
try { | ||
this.enterOuterAlt(_localctx, 1); | ||
{ | ||
this.state = 92; | ||
this.state = 98; | ||
this.match(QueryParser.ID); | ||
@@ -489,8 +525,18 @@ } | ||
let _localctx = new PickKeyContext(this._ctx, this.state); | ||
this.enterRule(_localctx, 18, QueryParser.RULE_pickKey); | ||
this.enterRule(_localctx, 20, QueryParser.RULE_pickKey); | ||
let _la; | ||
try { | ||
this.enterOuterAlt(_localctx, 1); | ||
{ | ||
this.state = 94; | ||
this.state = 100; | ||
this.match(QueryParser.ID); | ||
this.state = 102; | ||
this._errHandler.sync(this); | ||
_la = this._input.LA(1); | ||
if (_la === QueryParser.REQUIRED_MARK) { | ||
{ | ||
this.state = 101; | ||
this.match(QueryParser.REQUIRED_MARK); | ||
} | ||
} | ||
} | ||
@@ -528,10 +574,11 @@ } | ||
QueryParser.WORD = 7; | ||
QueryParser.SPECIAL = 8; | ||
QueryParser.EOF_STATEMENT = 9; | ||
QueryParser.WSL = 10; | ||
QueryParser.STRING = 11; | ||
QueryParser.REQUIRED_MARK = 8; | ||
QueryParser.SPECIAL = 9; | ||
QueryParser.EOF_STATEMENT = 10; | ||
QueryParser.WSL = 11; | ||
QueryParser.STRING = 12; | ||
QueryParser.RULE_input = 0; | ||
QueryParser.RULE_query = 1; | ||
QueryParser.RULE_ignored = 2; | ||
QueryParser.RULE_param = 3; | ||
QueryParser.RULE_param = 2; | ||
QueryParser.RULE_ignored = 3; | ||
QueryParser.RULE_scalarParam = 4; | ||
@@ -541,57 +588,62 @@ QueryParser.RULE_pickParam = 5; | ||
QueryParser.RULE_arrayParam = 7; | ||
QueryParser.RULE_paramName = 8; | ||
QueryParser.RULE_pickKey = 9; | ||
QueryParser.RULE_scalarParamName = 8; | ||
QueryParser.RULE_paramName = 9; | ||
QueryParser.RULE_pickKey = 10; | ||
// tslint:disable:no-trailing-whitespace | ||
QueryParser.ruleNames = [ | ||
"input", "query", "ignored", "param", "scalarParam", "pickParam", "arrayPickParam", | ||
"arrayParam", "paramName", "pickKey", | ||
"input", "query", "param", "ignored", "scalarParam", "pickParam", "arrayPickParam", | ||
"arrayParam", "scalarParamName", "paramName", "pickKey", | ||
]; | ||
QueryParser._LITERAL_NAMES = [ | ||
undefined, undefined, "'$'", "'$$'", "','", "'('", "')'", undefined, undefined, | ||
"';'", | ||
undefined, undefined, "'$'", "'$$'", "','", "'('", "')'", undefined, "'!'", | ||
undefined, "';'", | ||
]; | ||
QueryParser._SYMBOLIC_NAMES = [ | ||
undefined, "ID", "SINGULAR_PARAM_MARK", "PLURAL_PARAM_MARK", "COMMA", | ||
"OB", "CB", "WORD", "SPECIAL", "EOF_STATEMENT", "WSL", "STRING", | ||
"OB", "CB", "WORD", "REQUIRED_MARK", "SPECIAL", "EOF_STATEMENT", "WSL", | ||
"STRING", | ||
]; | ||
QueryParser.VOCABULARY = new VocabularyImpl_1.VocabularyImpl(QueryParser._LITERAL_NAMES, QueryParser._SYMBOLIC_NAMES, []); | ||
QueryParser._serializedATN = "\x03\uC91D\uCABA\u058D\uAFBA\u4F53\u0607\uEA8B\uC241\x03\rc\x04\x02\t" + | ||
"\x02\x04\x03\t\x03\x04\x04\t\x04\x04\x05\t\x05\x04\x06\t\x06\x04\x07\t" + | ||
"\x07\x04\b\t\b\x04\t\t\t\x04\n\t\n\x04\v\t\v\x03\x02\x03\x02\x05\x02\x19" + | ||
"\n\x02\x03\x02\x03\x02\x03\x03\x06\x03\x1E\n\x03\r\x03\x0E\x03\x1F\x03" + | ||
"\x03\x03\x03\x07\x03$\n\x03\f\x03\x0E\x03\'\v\x03\x07\x03)\n\x03\f\x03" + | ||
"\x0E\x03,\v\x03\x03\x04\x06\x04/\n\x04\r\x04\x0E\x040\x03\x05\x03\x05" + | ||
"\x03\x05\x03\x05\x05\x057\n\x05\x03\x06\x03\x06\x03\x06\x03\x07\x03\x07" + | ||
"\x03\x07\x03\x07\x03\x07\x03\x07\x07\x07B\n\x07\f\x07\x0E\x07E\v\x07\x03" + | ||
"\x07\x05\x07H\n\x07\x03\x07\x03\x07\x03\b\x03\b\x03\b\x03\b\x03\b\x03" + | ||
"\b\x07\bR\n\b\f\b\x0E\bU\v\b\x03\b\x05\bX\n\b\x03\b\x03\b\x03\t\x03\t" + | ||
"\x03\t\x03\n\x03\n\x03\v\x03\v\x03\v\x02\x02\x02\f\x02\x02\x04\x02\x06" + | ||
"\x02\b\x02\n\x02\f\x02\x0E\x02\x10\x02\x12\x02\x14\x02\x02\x03\x05\x02" + | ||
"\x03\x03\x06\n\r\r\x02d\x02\x16\x03\x02\x02\x02\x04\x1D\x03\x02\x02\x02" + | ||
"\x06.\x03\x02\x02\x02\b6\x03\x02\x02\x02\n8\x03\x02\x02\x02\f;\x03\x02" + | ||
"\x02\x02\x0EK\x03\x02\x02\x02\x10[\x03\x02\x02\x02\x12^\x03\x02\x02\x02" + | ||
"\x14`\x03\x02\x02\x02\x16\x18\x05\x04\x03\x02\x17\x19\x07\v\x02\x02\x18" + | ||
"\x17\x03\x02\x02\x02\x18\x19\x03\x02\x02\x02\x19\x1A\x03\x02\x02\x02\x1A" + | ||
"\x1B\x07\x02\x02\x03\x1B\x03\x03\x02\x02\x02\x1C\x1E\x05\x06\x04\x02\x1D" + | ||
"\x1C\x03\x02\x02\x02\x1E\x1F\x03\x02\x02\x02\x1F\x1D\x03\x02\x02\x02\x1F" + | ||
" \x03\x02\x02\x02 *\x03\x02\x02\x02!%\x05\b\x05\x02\"$\x05\x06\x04\x02" + | ||
"#\"\x03\x02\x02\x02$\'\x03\x02\x02\x02%#\x03\x02\x02\x02%&\x03\x02\x02" + | ||
"\x02&)\x03\x02\x02\x02\'%\x03\x02\x02\x02(!\x03\x02\x02\x02),\x03\x02" + | ||
"\x02\x02*(\x03\x02\x02\x02*+\x03\x02\x02\x02+\x05\x03\x02\x02\x02,*\x03" + | ||
"\x02\x02\x02-/\t\x02\x02\x02.-\x03\x02\x02\x02/0\x03\x02\x02\x020.\x03" + | ||
"\x02\x02\x0201\x03\x02\x02\x021\x07\x03\x02\x02\x0227\x05\f\x07\x0237" + | ||
"\x05\x0E\b\x0247\x05\n\x06\x0257\x05\x10\t\x0262\x03\x02\x02\x0263\x03" + | ||
"\x02\x02\x0264\x03\x02\x02\x0265\x03\x02\x02\x027\t\x03\x02\x02\x0289" + | ||
"\x07\x04\x02\x029:\x05\x12\n\x02:\v\x03\x02\x02\x02;<\x07\x04\x02\x02" + | ||
"<=\x05\x12\n\x02=>\x07\x07\x02\x02>C\x05\x14\v\x02?@\x07\x06\x02\x02@" + | ||
"B\x05\x14\v\x02A?\x03\x02\x02\x02BE\x03\x02\x02\x02CA\x03\x02\x02\x02" + | ||
"CD\x03\x02\x02\x02DG\x03\x02\x02\x02EC\x03\x02\x02\x02FH\x07\x06\x02\x02" + | ||
"GF\x03\x02\x02\x02GH\x03\x02\x02\x02HI\x03\x02\x02\x02IJ\x07\b\x02\x02" + | ||
"J\r\x03\x02\x02\x02KL\x07\x05\x02\x02LM\x05\x12\n\x02MN\x07\x07\x02\x02" + | ||
"NS\x05\x14\v\x02OP\x07\x06\x02\x02PR\x05\x14\v\x02QO\x03\x02\x02\x02R" + | ||
"U\x03\x02\x02\x02SQ\x03\x02\x02\x02ST\x03\x02\x02\x02TW\x03\x02\x02\x02" + | ||
"US\x03\x02\x02\x02VX\x07\x06\x02\x02WV\x03\x02\x02\x02WX\x03\x02\x02\x02" + | ||
"XY\x03\x02\x02\x02YZ\x07\b\x02\x02Z\x0F\x03\x02\x02\x02[\\\x07\x05\x02" + | ||
"\x02\\]\x05\x12\n\x02]\x11\x03\x02\x02\x02^_\x07\x03\x02\x02_\x13\x03" + | ||
"\x02\x02\x02`a\x07\x03\x02\x02a\x15\x03\x02\x02\x02\f\x18\x1F%*06CGSW"; | ||
QueryParser._serializedATN = "\x03\uC91D\uCABA\u058D\uAFBA\u4F53\u0607\uEA8B\uC241\x03\x0Ek\x04\x02" + | ||
"\t\x02\x04\x03\t\x03\x04\x04\t\x04\x04\x05\t\x05\x04\x06\t\x06\x04\x07" + | ||
"\t\x07\x04\b\t\b\x04\t\t\t\x04\n\t\n\x04\v\t\v\x04\f\t\f\x03\x02\x03\x02" + | ||
"\x05\x02\x1B\n\x02\x03\x02\x03\x02\x03\x03\x06\x03 \n\x03\r\x03\x0E\x03" + | ||
"!\x03\x03\x03\x03\x07\x03&\n\x03\f\x03\x0E\x03)\v\x03\x07\x03+\n\x03\f" + | ||
"\x03\x0E\x03.\v\x03\x03\x04\x03\x04\x03\x04\x03\x04\x05\x044\n\x04\x03" + | ||
"\x05\x06\x057\n\x05\r\x05\x0E\x058\x03\x06\x03\x06\x03\x06\x03\x07\x03" + | ||
"\x07\x03\x07\x03\x07\x03\x07\x03\x07\x07\x07D\n\x07\f\x07\x0E\x07G\v\x07" + | ||
"\x03\x07\x05\x07J\n\x07\x03\x07\x03\x07\x03\b\x03\b\x03\b\x03\b\x03\b" + | ||
"\x03\b\x07\bT\n\b\f\b\x0E\bW\v\b\x03\b\x05\bZ\n\b\x03\b\x03\b\x03\t\x03" + | ||
"\t\x03\t\x03\n\x03\n\x05\nc\n\n\x03\v\x03\v\x03\f\x03\f\x05\fi\n\f\x03" + | ||
"\f\x02\x02\x02\r\x02\x02\x04\x02\x06\x02\b\x02\n\x02\f\x02\x0E\x02\x10" + | ||
"\x02\x12\x02\x14\x02\x16\x02\x02\x03\x05\x02\x03\x03\x06\v\x0E\x0E\x02" + | ||
"m\x02\x18\x03\x02\x02\x02\x04\x1F\x03\x02\x02\x02\x063\x03\x02\x02\x02" + | ||
"\b6\x03\x02\x02\x02\n:\x03\x02\x02\x02\f=\x03\x02\x02\x02\x0EM\x03\x02" + | ||
"\x02\x02\x10]\x03\x02\x02\x02\x12`\x03\x02\x02\x02\x14d\x03\x02\x02\x02" + | ||
"\x16f\x03\x02\x02\x02\x18\x1A\x05\x04\x03\x02\x19\x1B\x07\f\x02\x02\x1A" + | ||
"\x19\x03\x02\x02\x02\x1A\x1B\x03\x02\x02\x02\x1B\x1C\x03\x02\x02\x02\x1C" + | ||
"\x1D\x07\x02\x02\x03\x1D\x03\x03\x02\x02\x02\x1E \x05\b\x05\x02\x1F\x1E" + | ||
"\x03\x02\x02\x02 !\x03\x02\x02\x02!\x1F\x03\x02\x02\x02!\"\x03\x02\x02" + | ||
"\x02\",\x03\x02\x02\x02#\'\x05\x06\x04\x02$&\x05\b\x05\x02%$\x03\x02\x02" + | ||
"\x02&)\x03\x02\x02\x02\'%\x03\x02\x02\x02\'(\x03\x02\x02\x02(+\x03\x02" + | ||
"\x02\x02)\'\x03\x02\x02\x02*#\x03\x02\x02\x02+.\x03\x02\x02\x02,*\x03" + | ||
"\x02\x02\x02,-\x03\x02\x02\x02-\x05\x03\x02\x02\x02.,\x03\x02\x02\x02" + | ||
"/4\x05\f\x07\x0204\x05\x0E\b\x0214\x05\n\x06\x0224\x05\x10\t\x023/\x03" + | ||
"\x02\x02\x0230\x03\x02\x02\x0231\x03\x02\x02\x0232\x03\x02\x02\x024\x07" + | ||
"\x03\x02\x02\x0257\t\x02\x02\x0265\x03\x02\x02\x0278\x03\x02\x02\x028" + | ||
"6\x03\x02\x02\x0289\x03\x02\x02\x029\t\x03\x02\x02\x02:;\x07\x04\x02\x02" + | ||
";<\x05\x12\n\x02<\v\x03\x02\x02\x02=>\x07\x04\x02\x02>?\x05\x14\v\x02" + | ||
"?@\x07\x07\x02\x02@E\x05\x16\f\x02AB\x07\x06\x02\x02BD\x05\x16\f\x02C" + | ||
"A\x03\x02\x02\x02DG\x03\x02\x02\x02EC\x03\x02\x02\x02EF\x03\x02\x02\x02" + | ||
"FI\x03\x02\x02\x02GE\x03\x02\x02\x02HJ\x07\x06\x02\x02IH\x03\x02\x02\x02" + | ||
"IJ\x03\x02\x02\x02JK\x03\x02\x02\x02KL\x07\b\x02\x02L\r\x03\x02\x02\x02" + | ||
"MN\x07\x05\x02\x02NO\x05\x14\v\x02OP\x07\x07\x02\x02PU\x05\x16\f\x02Q" + | ||
"R\x07\x06\x02\x02RT\x05\x16\f\x02SQ\x03\x02\x02\x02TW\x03\x02\x02\x02" + | ||
"US\x03\x02\x02\x02UV\x03\x02\x02\x02VY\x03\x02\x02\x02WU\x03\x02\x02\x02" + | ||
"XZ\x07\x06\x02\x02YX\x03\x02\x02\x02YZ\x03\x02\x02\x02Z[\x03\x02\x02\x02" + | ||
"[\\\x07\b\x02\x02\\\x0F\x03\x02\x02\x02]^\x07\x05\x02\x02^_\x05\x12\n" + | ||
"\x02_\x11\x03\x02\x02\x02`b\x07\x03\x02\x02ac\x07\n\x02\x02ba\x03\x02" + | ||
"\x02\x02bc\x03\x02\x02\x02c\x13\x03\x02\x02\x02de\x07\x03\x02\x02e\x15" + | ||
"\x03\x02\x02\x02fh\x07\x03\x02\x02gi\x07\n\x02\x02hg\x03\x02\x02\x02h" + | ||
"i\x03\x02\x02\x02i\x17\x03\x02\x02\x02\x0E\x1A!\',38EIUYbh"; | ||
class InputContext extends ParserRuleContext_1.ParserRuleContext { | ||
@@ -676,2 +728,43 @@ query() { | ||
exports.QueryContext = QueryContext; | ||
class ParamContext extends ParserRuleContext_1.ParserRuleContext { | ||
pickParam() { | ||
return this.tryGetRuleContext(0, PickParamContext); | ||
} | ||
arrayPickParam() { | ||
return this.tryGetRuleContext(0, ArrayPickParamContext); | ||
} | ||
scalarParam() { | ||
return this.tryGetRuleContext(0, ScalarParamContext); | ||
} | ||
arrayParam() { | ||
return this.tryGetRuleContext(0, ArrayParamContext); | ||
} | ||
constructor(parent, invokingState) { | ||
super(parent, invokingState); | ||
} | ||
// @Override | ||
get ruleIndex() { return QueryParser.RULE_param; } | ||
// @Override | ||
enterRule(listener) { | ||
if (listener.enterParam) { | ||
listener.enterParam(this); | ||
} | ||
} | ||
// @Override | ||
exitRule(listener) { | ||
if (listener.exitParam) { | ||
listener.exitParam(this); | ||
} | ||
} | ||
// @Override | ||
accept(visitor) { | ||
if (visitor.visitParam) { | ||
return visitor.visitParam(this); | ||
} | ||
else { | ||
return visitor.visitChildren(this); | ||
} | ||
} | ||
} | ||
exports.ParamContext = ParamContext; | ||
class IgnoredContext extends ParserRuleContext_1.ParserRuleContext { | ||
@@ -734,2 +827,10 @@ ID(i) { | ||
} | ||
REQUIRED_MARK(i) { | ||
if (i === undefined) { | ||
return this.getTokens(QueryParser.REQUIRED_MARK); | ||
} | ||
else { | ||
return this.getToken(QueryParser.REQUIRED_MARK, i); | ||
} | ||
} | ||
constructor(parent, invokingState) { | ||
@@ -763,47 +864,6 @@ super(parent, invokingState); | ||
exports.IgnoredContext = IgnoredContext; | ||
class ParamContext extends ParserRuleContext_1.ParserRuleContext { | ||
pickParam() { | ||
return this.tryGetRuleContext(0, PickParamContext); | ||
} | ||
arrayPickParam() { | ||
return this.tryGetRuleContext(0, ArrayPickParamContext); | ||
} | ||
scalarParam() { | ||
return this.tryGetRuleContext(0, ScalarParamContext); | ||
} | ||
arrayParam() { | ||
return this.tryGetRuleContext(0, ArrayParamContext); | ||
} | ||
constructor(parent, invokingState) { | ||
super(parent, invokingState); | ||
} | ||
// @Override | ||
get ruleIndex() { return QueryParser.RULE_param; } | ||
// @Override | ||
enterRule(listener) { | ||
if (listener.enterParam) { | ||
listener.enterParam(this); | ||
} | ||
} | ||
// @Override | ||
exitRule(listener) { | ||
if (listener.exitParam) { | ||
listener.exitParam(this); | ||
} | ||
} | ||
// @Override | ||
accept(visitor) { | ||
if (visitor.visitParam) { | ||
return visitor.visitParam(this); | ||
} | ||
else { | ||
return visitor.visitChildren(this); | ||
} | ||
} | ||
} | ||
exports.ParamContext = ParamContext; | ||
class ScalarParamContext extends ParserRuleContext_1.ParserRuleContext { | ||
SINGULAR_PARAM_MARK() { return this.getToken(QueryParser.SINGULAR_PARAM_MARK, 0); } | ||
paramName() { | ||
return this.getRuleContext(0, ParamNameContext); | ||
scalarParamName() { | ||
return this.getRuleContext(0, ScalarParamNameContext); | ||
} | ||
@@ -942,4 +1002,4 @@ constructor(parent, invokingState) { | ||
PLURAL_PARAM_MARK() { return this.getToken(QueryParser.PLURAL_PARAM_MARK, 0); } | ||
paramName() { | ||
return this.getRuleContext(0, ParamNameContext); | ||
scalarParamName() { | ||
return this.getRuleContext(0, ScalarParamNameContext); | ||
} | ||
@@ -974,2 +1034,33 @@ constructor(parent, invokingState) { | ||
exports.ArrayParamContext = ArrayParamContext; | ||
class ScalarParamNameContext extends ParserRuleContext_1.ParserRuleContext { | ||
ID() { return this.getToken(QueryParser.ID, 0); } | ||
REQUIRED_MARK() { return this.tryGetToken(QueryParser.REQUIRED_MARK, 0); } | ||
constructor(parent, invokingState) { | ||
super(parent, invokingState); | ||
} | ||
// @Override | ||
get ruleIndex() { return QueryParser.RULE_scalarParamName; } | ||
// @Override | ||
enterRule(listener) { | ||
if (listener.enterScalarParamName) { | ||
listener.enterScalarParamName(this); | ||
} | ||
} | ||
// @Override | ||
exitRule(listener) { | ||
if (listener.exitScalarParamName) { | ||
listener.exitScalarParamName(this); | ||
} | ||
} | ||
// @Override | ||
accept(visitor) { | ||
if (visitor.visitScalarParamName) { | ||
return visitor.visitScalarParamName(this); | ||
} | ||
else { | ||
return visitor.visitChildren(this); | ||
} | ||
} | ||
} | ||
exports.ScalarParamNameContext = ScalarParamNameContext; | ||
class ParamNameContext extends ParserRuleContext_1.ParserRuleContext { | ||
@@ -1007,2 +1098,3 @@ ID() { return this.getToken(QueryParser.ID, 0); } | ||
ID() { return this.getToken(QueryParser.ID, 0); } | ||
REQUIRED_MARK() { return this.tryGetToken(QueryParser.REQUIRED_MARK, 0); } | ||
constructor(parent, invokingState) { | ||
@@ -1009,0 +1101,0 @@ super(parent, invokingState); |
import { ParseTreeListener } from "antlr4ts/tree/ParseTreeListener"; | ||
import { InputContext } from "./QueryParser"; | ||
import { QueryContext } from "./QueryParser"; | ||
import { ParamContext } from "./QueryParser"; | ||
import { IgnoredContext } from "./QueryParser"; | ||
import { ParamContext } from "./QueryParser"; | ||
import { ScalarParamContext } from "./QueryParser"; | ||
@@ -10,2 +10,3 @@ import { PickParamContext } from "./QueryParser"; | ||
import { ArrayParamContext } from "./QueryParser"; | ||
import { ScalarParamNameContext } from "./QueryParser"; | ||
import { ParamNameContext } from "./QueryParser"; | ||
@@ -39,21 +40,21 @@ import { PickKeyContext } from "./QueryParser"; | ||
/** | ||
* Enter a parse tree produced by `QueryParser.ignored`. | ||
* Enter a parse tree produced by `QueryParser.param`. | ||
* @param ctx the parse tree | ||
*/ | ||
enterIgnored?: (ctx: IgnoredContext) => void; | ||
enterParam?: (ctx: ParamContext) => void; | ||
/** | ||
* Exit a parse tree produced by `QueryParser.ignored`. | ||
* Exit a parse tree produced by `QueryParser.param`. | ||
* @param ctx the parse tree | ||
*/ | ||
exitIgnored?: (ctx: IgnoredContext) => void; | ||
exitParam?: (ctx: ParamContext) => void; | ||
/** | ||
* Enter a parse tree produced by `QueryParser.param`. | ||
* Enter a parse tree produced by `QueryParser.ignored`. | ||
* @param ctx the parse tree | ||
*/ | ||
enterParam?: (ctx: ParamContext) => void; | ||
enterIgnored?: (ctx: IgnoredContext) => void; | ||
/** | ||
* Exit a parse tree produced by `QueryParser.param`. | ||
* Exit a parse tree produced by `QueryParser.ignored`. | ||
* @param ctx the parse tree | ||
*/ | ||
exitParam?: (ctx: ParamContext) => void; | ||
exitIgnored?: (ctx: IgnoredContext) => void; | ||
/** | ||
@@ -100,2 +101,12 @@ * Enter a parse tree produced by `QueryParser.scalarParam`. | ||
/** | ||
* Enter a parse tree produced by `QueryParser.scalarParamName`. | ||
* @param ctx the parse tree | ||
*/ | ||
enterScalarParamName?: (ctx: ScalarParamNameContext) => void; | ||
/** | ||
* Exit a parse tree produced by `QueryParser.scalarParamName`. | ||
* @param ctx the parse tree | ||
*/ | ||
exitScalarParamName?: (ctx: ScalarParamNameContext) => void; | ||
/** | ||
* Enter a parse tree produced by `QueryParser.paramName`. | ||
@@ -102,0 +113,0 @@ * @param ctx the parse tree |
import { ParseTreeVisitor } from "antlr4ts/tree/ParseTreeVisitor"; | ||
import { InputContext } from "./QueryParser"; | ||
import { QueryContext } from "./QueryParser"; | ||
import { ParamContext } from "./QueryParser"; | ||
import { IgnoredContext } from "./QueryParser"; | ||
import { ParamContext } from "./QueryParser"; | ||
import { ScalarParamContext } from "./QueryParser"; | ||
@@ -10,2 +10,3 @@ import { PickParamContext } from "./QueryParser"; | ||
import { ArrayParamContext } from "./QueryParser"; | ||
import { ScalarParamNameContext } from "./QueryParser"; | ||
import { ParamNameContext } from "./QueryParser"; | ||
@@ -34,13 +35,13 @@ import { PickKeyContext } from "./QueryParser"; | ||
/** | ||
* Visit a parse tree produced by `QueryParser.ignored`. | ||
* Visit a parse tree produced by `QueryParser.param`. | ||
* @param ctx the parse tree | ||
* @return the visitor result | ||
*/ | ||
visitIgnored?: (ctx: IgnoredContext) => Result; | ||
visitParam?: (ctx: ParamContext) => Result; | ||
/** | ||
* Visit a parse tree produced by `QueryParser.param`. | ||
* Visit a parse tree produced by `QueryParser.ignored`. | ||
* @param ctx the parse tree | ||
* @return the visitor result | ||
*/ | ||
visitParam?: (ctx: ParamContext) => Result; | ||
visitIgnored?: (ctx: IgnoredContext) => Result; | ||
/** | ||
@@ -71,2 +72,8 @@ * Visit a parse tree produced by `QueryParser.scalarParam`. | ||
/** | ||
* Visit a parse tree produced by `QueryParser.scalarParamName`. | ||
* @param ctx the parse tree | ||
* @return the visitor result | ||
*/ | ||
visitScalarParamName?: (ctx: ScalarParamNameContext) => Result; | ||
/** | ||
* Visit a parse tree produced by `QueryParser.paramName`. | ||
@@ -73,0 +80,0 @@ * @param ctx the parse tree |
@@ -8,2 +8,6 @@ import { ParseEvent } from '../sql/logger'; | ||
} | ||
export interface ParamKey { | ||
name: string; | ||
required: boolean; | ||
} | ||
export declare type ParamSelection = { | ||
@@ -15,3 +19,3 @@ type: ParamType.Scalar; | ||
type: ParamType.Object | ParamType.ObjectArray; | ||
keys: string[]; | ||
keys: ParamKey[]; | ||
}; | ||
@@ -21,2 +25,3 @@ export interface Param { | ||
selection: ParamSelection; | ||
required: boolean; | ||
location: CodeInterval; | ||
@@ -23,0 +28,0 @@ } |
@@ -47,2 +47,10 @@ "use strict"; | ||
} | ||
enterScalarParamName(ctx) { | ||
const required = !!ctx.REQUIRED_MARK(); | ||
const name = ctx.ID().text; | ||
this.currentParam = { | ||
name, | ||
required, | ||
}; | ||
} | ||
exitParam(ctx) { | ||
@@ -85,7 +93,9 @@ const defLoc = { | ||
assert('keys' in this.currentSelection); | ||
this.currentSelection.keys.push(ctx.text); | ||
const required = !!ctx.REQUIRED_MARK(); | ||
const name = ctx.ID().text; | ||
this.currentSelection.keys.push({ name, required }); | ||
} | ||
} | ||
function parseText(text, queryName = 'query') { | ||
const logger = new logger_1.Logger(text); | ||
const logger = new logger_1.Logger(); | ||
const inputStream = antlr4ts_1.CharStreams.fromString(text); | ||
@@ -92,0 +102,0 @@ const lexer = new QueryLexer_1.QueryLexer(inputStream); |
@@ -36,2 +36,3 @@ "use strict"; | ||
assignedIndex: idx, | ||
required: usedParam.required, | ||
}); | ||
@@ -47,6 +48,7 @@ sub = `$${idx}`; | ||
const sub = usedParam.transform.keys | ||
.map((pickKey) => { | ||
.map(({ name, required }) => { | ||
const idx = i++; | ||
dict[pickKey] = { | ||
name: pickKey, | ||
dict[name] = { | ||
name, | ||
required, | ||
type: preprocessor_1.ParamTransform.Scalar, | ||
@@ -57,3 +59,3 @@ assignedIndex: idx, | ||
const paramValue = passedParams[usedParam.name]; | ||
const val = paramValue[pickKey]; | ||
const val = paramValue[name]; | ||
bindings.push(val); | ||
@@ -83,4 +85,4 @@ } | ||
const ssub = usedParam.transform.keys | ||
.map((pickKey) => { | ||
const val = entity[pickKey]; | ||
.map(({ name }) => { | ||
const val = entity[name]; | ||
bindings.push(val); | ||
@@ -97,6 +99,7 @@ return `$${i++}`; | ||
sub = usedParam.transform.keys | ||
.map((pickKey) => { | ||
.map(({ name, required }) => { | ||
const idx = i++; | ||
dict[pickKey] = { | ||
name: pickKey, | ||
dict[name] = { | ||
name, | ||
required, | ||
type: preprocessor_1.ParamTransform.Scalar, | ||
@@ -128,2 +131,3 @@ assignedIndex: idx, | ||
assignedIndex, | ||
required: usedParam.required, | ||
}); | ||
@@ -130,0 +134,0 @@ } |
@@ -45,2 +45,3 @@ "use strict"; | ||
name: 'id', | ||
required: false, | ||
type: preprocessor_1.ParamTransform.Scalar, | ||
@@ -51,2 +52,3 @@ }, | ||
name: 'age', | ||
required: false, | ||
type: preprocessor_1.ParamTransform.Scalar, | ||
@@ -81,2 +83,3 @@ }, | ||
name: 'id', | ||
required: false, | ||
type: preprocessor_1.ParamTransform.Scalar, | ||
@@ -115,2 +118,3 @@ }, | ||
type: preprocessor_1.ParamTransform.Spread, | ||
required: false, | ||
assignedIndex: 1, | ||
@@ -147,2 +151,3 @@ }, | ||
name: 'ages', | ||
required: false, | ||
type: preprocessor_1.ParamTransform.Spread, | ||
@@ -182,2 +187,3 @@ assignedIndex: 1, | ||
type: preprocessor_1.ParamTransform.Spread, | ||
required: false, | ||
assignedIndex: 1, | ||
@@ -188,2 +194,3 @@ }, | ||
type: preprocessor_1.ParamTransform.Scalar, | ||
required: false, | ||
assignedIndex: 2, | ||
@@ -226,2 +233,3 @@ }, | ||
type: preprocessor_1.ParamTransform.Scalar, | ||
required: false, | ||
}, | ||
@@ -232,2 +240,3 @@ age: { | ||
type: preprocessor_1.ParamTransform.Scalar, | ||
required: false, | ||
}, | ||
@@ -271,2 +280,3 @@ }, | ||
type: preprocessor_1.ParamTransform.Scalar, | ||
required: false, | ||
}, | ||
@@ -277,2 +287,3 @@ age: { | ||
type: preprocessor_1.ParamTransform.Scalar, | ||
required: false, | ||
}, | ||
@@ -315,2 +326,3 @@ }, | ||
type: preprocessor_1.ParamTransform.Scalar, | ||
required: false, | ||
assignedIndex: 1, | ||
@@ -321,2 +333,3 @@ }, | ||
type: preprocessor_1.ParamTransform.Scalar, | ||
required: false, | ||
assignedIndex: 2, | ||
@@ -364,2 +377,3 @@ }, | ||
type: preprocessor_1.ParamTransform.Scalar, | ||
required: false, | ||
assignedIndex: 1, | ||
@@ -370,2 +384,3 @@ }, | ||
type: preprocessor_1.ParamTransform.Scalar, | ||
required: false, | ||
assignedIndex: 2, | ||
@@ -386,2 +401,110 @@ }, | ||
}); | ||
test('(SQL) scalar param required and optional', () => { | ||
const query = ` | ||
/* @name selectSomeUsers */ | ||
SELECT id, name from users where id = :id! and user_id = :id;`; | ||
const fileAST = sql_1.default(query); | ||
const parameters = { | ||
id: '123', | ||
}; | ||
const expectedInterpolationResult = { | ||
query: 'SELECT id, name from users where id = $1 and user_id = $1', | ||
mapping: [], | ||
bindings: ['123'], | ||
}; | ||
const expectedMappingResult = { | ||
query: 'SELECT id, name from users where id = $1 and user_id = $1', | ||
mapping: [ | ||
{ | ||
assignedIndex: 1, | ||
name: 'id', | ||
required: true, | ||
type: preprocessor_1.ParamTransform.Scalar, | ||
}, | ||
], | ||
bindings: [], | ||
}; | ||
const interpolationResult = preprocessor_sql_1.processSQLQueryAST(fileAST.queries[0], parameters); | ||
const mappingResult = preprocessor_sql_1.processSQLQueryAST(fileAST.queries[0]); | ||
expect(interpolationResult).toEqual(expectedInterpolationResult); | ||
expect(mappingResult).toEqual(expectedMappingResult); | ||
}); | ||
test('(SQL) pick param required', () => { | ||
const query = ` | ||
/* | ||
@name insertUsers | ||
@param user -> (name!, age) | ||
*/ | ||
INSERT INTO users (name, age) VALUES :user RETURNING id;`; | ||
const fileAST = sql_1.default(query); | ||
const parameters = { | ||
user: { name: 'Bob', age: 12 }, | ||
}; | ||
const expectedInterpolationResult = { | ||
query: 'INSERT INTO users (name, age) VALUES ($1,$2) RETURNING id', | ||
bindings: ['Bob', 12], | ||
mapping: [], | ||
}; | ||
const expectedMappingResult = { | ||
query: 'INSERT INTO users (name, age) VALUES ($1,$2) RETURNING id', | ||
bindings: [], | ||
mapping: [ | ||
{ | ||
name: 'user', | ||
type: preprocessor_1.ParamTransform.Pick, | ||
dict: { | ||
name: { | ||
assignedIndex: 1, | ||
name: 'name', | ||
type: preprocessor_1.ParamTransform.Scalar, | ||
required: true, | ||
}, | ||
age: { | ||
assignedIndex: 2, | ||
name: 'age', | ||
type: preprocessor_1.ParamTransform.Scalar, | ||
required: false, | ||
}, | ||
}, | ||
}, | ||
], | ||
}; | ||
const interpolationResult = preprocessor_sql_1.processSQLQueryAST(fileAST.queries[0], parameters); | ||
expect(interpolationResult).toEqual(expectedInterpolationResult); | ||
const mappingResult = preprocessor_sql_1.processSQLQueryAST(fileAST.queries[0]); | ||
expect(mappingResult).toEqual(expectedMappingResult); | ||
}); | ||
test('(SQL) array param required', () => { | ||
const query = ` | ||
/* | ||
@name selectSomeUsers | ||
@param ages -> (...) | ||
*/ | ||
SELECT FROM users WHERE age in :ages!;`; | ||
const fileAST = sql_1.default(query); | ||
const parameters = { | ||
ages: [23, 27, 50], | ||
}; | ||
const expectedInterpolationResult = { | ||
query: 'SELECT FROM users WHERE age in ($1,$2,$3)', | ||
bindings: [23, 27, 50], | ||
mapping: [], | ||
}; | ||
const expectedMappingResult = { | ||
query: 'SELECT FROM users WHERE age in ($1)', | ||
bindings: [], | ||
mapping: [ | ||
{ | ||
name: 'ages', | ||
type: preprocessor_1.ParamTransform.Spread, | ||
required: true, | ||
assignedIndex: 1, | ||
}, | ||
], | ||
}; | ||
const interpolationResult = preprocessor_sql_1.processSQLQueryAST(fileAST.queries[0], parameters); | ||
const mappingResult = preprocessor_sql_1.processSQLQueryAST(fileAST.queries[0]); | ||
expect(interpolationResult).toEqual(expectedInterpolationResult); | ||
expect(mappingResult).toEqual(expectedMappingResult); | ||
}); | ||
//# sourceMappingURL=preprocessor-sql.test.js.map |
@@ -6,3 +6,3 @@ "use strict"; | ||
const preprocessor_1 = require("./preprocessor"); | ||
function processScalar(paramName, nextIndex, existingConfig, parameters) { | ||
function processScalar({ name, required }, nextIndex, existingConfig, parameters) { | ||
let index = nextIndex; | ||
@@ -18,5 +18,10 @@ const bindings = []; | ||
replacement = `$${assignedIndex}`; | ||
config = { assignedIndex, type: preprocessor_1.ParamTransform.Scalar, name: paramName }; | ||
config = { | ||
assignedIndex, | ||
type: preprocessor_1.ParamTransform.Scalar, | ||
name, | ||
required, | ||
}; | ||
if (parameters) { | ||
const value = parameters[paramName]; | ||
const value = parameters[name]; | ||
bindings.push(value); | ||
@@ -27,3 +32,3 @@ } | ||
} | ||
function processScalarArray(paramName, nextIndex, existingConfig, parameters) { | ||
function processScalarArray({ name, required }, nextIndex, existingConfig, parameters) { | ||
let index = nextIndex; | ||
@@ -38,3 +43,3 @@ const bindings = []; | ||
if (parameters) { | ||
const values = parameters[paramName]; | ||
const values = parameters[name]; | ||
assignedIndex = values.map((val) => { | ||
@@ -48,3 +53,8 @@ bindings.push(val); | ||
} | ||
config = { assignedIndex, type: preprocessor_1.ParamTransform.Spread, name: paramName }; | ||
config = { | ||
assignedIndex, | ||
type: preprocessor_1.ParamTransform.Spread, | ||
name, | ||
required, | ||
}; | ||
} | ||
@@ -59,15 +69,17 @@ const replacement = '(' + assignedIndex.map((v) => `$${v}`).join(', ') + ')'; | ||
{ name: paramName, type: preprocessor_1.ParamTransform.Pick, dict: {} }; | ||
const keyIndices = keys.map((key) => { | ||
if (key in config.dict) { | ||
const keyIndices = keys.map(({ name, required }) => { | ||
if (name in config.dict) { | ||
config.dict[name].required = config.dict[name].required || required; | ||
// reuse index if parameter was seen before | ||
return `$${config.dict[key].assignedIndex}`; | ||
return `$${config.dict[name].assignedIndex}`; | ||
} | ||
const assignedIndex = ++index; | ||
config.dict[key] = { | ||
config.dict[name] = { | ||
assignedIndex, | ||
name, | ||
required, | ||
type: preprocessor_1.ParamTransform.Scalar, | ||
name: key, | ||
}; | ||
if (parameters) { | ||
const value = parameters[paramName][key]; | ||
const value = parameters[paramName][name]; | ||
bindings.push(value); | ||
@@ -95,4 +107,4 @@ } | ||
.map((val) => keys | ||
.map((key) => { | ||
bindings.push(val[key]); | ||
.map(({ name }) => { | ||
bindings.push(val[name]); | ||
return `$${++index}`; | ||
@@ -110,12 +122,13 @@ }) | ||
else { | ||
const keyIndices = keys.map((key) => { | ||
if (key in config.dict) { | ||
const keyIndices = keys.map(({ name, required }) => { | ||
if (name in config.dict) { | ||
// reuse index if parameter was seen before | ||
return `$${config.dict[key].assignedIndex}`; | ||
return `$${config.dict[name].assignedIndex}`; | ||
} | ||
const assignedIndex = ++index; | ||
config.dict[key] = { | ||
config.dict[name] = { | ||
assignedIndex, | ||
name, | ||
required, | ||
type: preprocessor_1.ParamTransform.Scalar, | ||
name: key, | ||
}; | ||
@@ -141,7 +154,7 @@ return `$${assignedIndex}`; | ||
const prevConfig = baseMap[param.name]; | ||
result = processScalar(param.name, i, prevConfig, parameters); | ||
result = processScalar(param, i, prevConfig, parameters); | ||
} | ||
if (param.selection.type === query_1.ParamType.ScalarArray) { | ||
const prevConfig = baseMap[param.name]; | ||
result = processScalarArray(param.name, i, prevConfig, parameters); | ||
result = processScalarArray(param, i, prevConfig, parameters); | ||
} | ||
@@ -148,0 +161,0 @@ if (param.selection.type === query_1.ParamType.Object) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const typescript_1 = require("./loader/typescript"); | ||
const preprocessor_1 = require("./preprocessor"); | ||
const preprocessor_ts_1 = require("./preprocessor-ts"); | ||
const preprocessor_1 = require("./preprocessor"); | ||
test('(TS) name parameter interpolation', () => { | ||
@@ -100,8 +100,2 @@ const query = 'SELECT id, name from users where id = $id and age > $age'; | ||
const parsedQuery = typescript_1.parseTSQuery(query); | ||
const parameters = { | ||
user: { | ||
name: 'Bob', | ||
age: 12, | ||
}, | ||
}; | ||
const expectedResult = { | ||
@@ -118,2 +112,3 @@ query: 'INSERT INTO users (name, age) VALUES ($1, $2) RETURNING id', | ||
type: preprocessor_1.ParamTransform.Scalar, | ||
required: false, | ||
}, | ||
@@ -124,2 +119,3 @@ age: { | ||
type: preprocessor_1.ParamTransform.Scalar, | ||
required: false, | ||
}, | ||
@@ -161,2 +157,3 @@ }, | ||
type: preprocessor_1.ParamTransform.Spread, | ||
required: false, | ||
assignedIndex: [1], | ||
@@ -167,2 +164,3 @@ }, | ||
type: preprocessor_1.ParamTransform.Spread, | ||
required: false, | ||
assignedIndex: [2], | ||
@@ -204,2 +202,3 @@ }, | ||
type: preprocessor_1.ParamTransform.Scalar, | ||
required: false, | ||
assignedIndex: 1, | ||
@@ -210,2 +209,3 @@ }, | ||
type: preprocessor_1.ParamTransform.Scalar, | ||
required: false, | ||
assignedIndex: 2, | ||
@@ -234,2 +234,3 @@ }, | ||
type: preprocessor_1.ParamTransform.Scalar, | ||
required: false, | ||
assignedIndex: 1, | ||
@@ -240,2 +241,3 @@ }, | ||
type: preprocessor_1.ParamTransform.Scalar, | ||
required: false, | ||
assignedIndex: 2, | ||
@@ -331,6 +333,6 @@ }, | ||
test('(TS) all kinds mapping ', () => { | ||
const query = 'SELECT $userId $age $userId $$users $age $user(id) $$users $user(id, parentId) $$comments(id, text) $user(age)'; | ||
const query = 'SELECT $userId $age! $userId $$users $age $user(id) $$users $user(id, parentId, age) $$comments(id!, text) $user(age!)'; | ||
const parsedQuery = typescript_1.parseTSQuery(query); | ||
const expectedResult = { | ||
query: 'SELECT $1 $2 $1 ($3) $2 ($4) ($3) ($4, $5) ($6, $7) ($8)', | ||
query: 'SELECT $1 $2 $1 ($3) $2 ($4) ($3) ($4, $5, $6) ($7, $8) ($6)', | ||
bindings: [], | ||
@@ -341,2 +343,3 @@ mapping: [ | ||
type: preprocessor_1.ParamTransform.Scalar, | ||
required: false, | ||
assignedIndex: 1, | ||
@@ -347,2 +350,3 @@ }, | ||
type: preprocessor_1.ParamTransform.Scalar, | ||
required: true, | ||
assignedIndex: 2, | ||
@@ -353,2 +357,3 @@ }, | ||
type: preprocessor_1.ParamTransform.Spread, | ||
required: false, | ||
assignedIndex: [3], | ||
@@ -363,2 +368,3 @@ }, | ||
type: preprocessor_1.ParamTransform.Scalar, | ||
required: false, | ||
assignedIndex: 4, | ||
@@ -369,3 +375,4 @@ }, | ||
type: preprocessor_1.ParamTransform.Scalar, | ||
assignedIndex: 8, | ||
required: true, | ||
assignedIndex: 6, | ||
}, | ||
@@ -375,2 +382,3 @@ parentId: { | ||
type: preprocessor_1.ParamTransform.Scalar, | ||
required: false, | ||
assignedIndex: 5, | ||
@@ -387,3 +395,4 @@ }, | ||
type: preprocessor_1.ParamTransform.Scalar, | ||
assignedIndex: 6, | ||
required: true, | ||
assignedIndex: 7, | ||
}, | ||
@@ -393,3 +402,4 @@ text: { | ||
type: preprocessor_1.ParamTransform.Scalar, | ||
assignedIndex: 7, | ||
required: false, | ||
assignedIndex: 8, | ||
}, | ||
@@ -403,2 +413,20 @@ }, | ||
}); | ||
test('(TS) required spread', () => { | ||
const query = 'SELECT $$users!'; | ||
const parsedQuery = typescript_1.parseTSQuery(query); | ||
const expectedResult = { | ||
query: 'SELECT ($1)', | ||
bindings: [], | ||
mapping: [ | ||
{ | ||
name: 'users', | ||
type: preprocessor_1.ParamTransform.Spread, | ||
required: true, | ||
assignedIndex: [1], | ||
}, | ||
], | ||
}; | ||
const result = preprocessor_ts_1.processTSQueryAST(parsedQuery.query); | ||
expect(result).toEqual(expectedResult); | ||
}); | ||
//# sourceMappingURL=preprocessor-ts.test.js.map |
@@ -11,2 +11,3 @@ export declare type Scalar = string | number | null; | ||
type: ParamTransform.Scalar; | ||
required: boolean; | ||
assignedIndex: number; | ||
@@ -24,2 +25,3 @@ } | ||
type: ParamTransform.Spread; | ||
required: boolean; | ||
assignedIndex: number | number[]; | ||
@@ -26,0 +28,0 @@ } |
@@ -19,3 +19,2 @@ "use strict"; | ||
const a = str.slice(0, interval.a + offset); | ||
const b = str.slice(interval.a + offset, interval.b + offset + 1); | ||
const c = str.slice(interval.b + offset + 1, str.length); | ||
@@ -22,0 +21,0 @@ result = a + interval.sub + c; |
{ | ||
"name": "@pgtyped/query", | ||
"version": "0.11.0", | ||
"version": "0.12.0", | ||
"main": "lib/index.js", | ||
@@ -28,3 +28,3 @@ "types": "lib/index.d.ts", | ||
"dependencies": { | ||
"@pgtyped/wire": "^0.11.0", | ||
"@pgtyped/wire": "^0.12.0", | ||
"@types/chalk": "^2.2.0", | ||
@@ -42,3 +42,3 @@ "@types/debug": "^4.1.4", | ||
}, | ||
"gitHead": "edccd3ed6dc2f0910b9ac07af4725ba9de351727" | ||
"gitHead": "e8bd84256ec0ec6d37ba89c7fca21f9a3360d763" | ||
} |
import { AsyncQueue, messages, PreparedObjectType } from '@pgtyped/wire'; | ||
import crypto from 'crypto'; | ||
import tls from 'tls'; | ||
import * as tls from 'tls'; | ||
import debugBase from 'debug'; | ||
@@ -142,3 +142,2 @@ | ||
query: string, | ||
name: string, | ||
queue: AsyncQueue, | ||
@@ -255,6 +254,5 @@ ): Promise<TypeData> { | ||
queryData: IInterpolatedQuery, | ||
name: string, | ||
queue: AsyncQueue, | ||
): Promise<IQueryTypes | IParseError> { | ||
const typeData = await getTypeData(queryData.query, name, queue); | ||
const typeData = await getTypeData(queryData.query, queue); | ||
if ('errorCode' in typeData) { | ||
@@ -261,0 +259,0 @@ return typeData; |
@@ -11,2 +11,3 @@ import { SQLParserListener } from './parser/SQLParserListener'; | ||
QueryNameContext, | ||
SpreadTransformContext, | ||
SQLParser, | ||
@@ -25,2 +26,7 @@ StatementBodyContext, | ||
export interface ParamKey { | ||
name: string; | ||
required: boolean; | ||
} | ||
export type ParamTransform = | ||
@@ -31,7 +37,7 @@ | { | ||
| { | ||
type: | ||
| TransformType.PickTuple | ||
| TransformType.ArraySpread | ||
| TransformType.PickArraySpread; | ||
keys: string[]; | ||
type: TransformType.ArraySpread; | ||
} | ||
| { | ||
type: TransformType.PickTuple | TransformType.PickArraySpread; | ||
keys: ParamKey[]; | ||
}; | ||
@@ -42,2 +48,3 @@ | ||
transform: ParamTransform; | ||
required: boolean; | ||
codeRefs: { | ||
@@ -169,3 +176,7 @@ defined?: CodeInterval; | ||
assert('keys' in this.currentTransform && this.currentTransform.keys); | ||
this.currentTransform.keys.push(ctx.text); | ||
const required = !!ctx.C_REQUIRED_MARK(); | ||
const name = ctx.ID().text; | ||
this.currentTransform.keys.push({ name, required }); | ||
} | ||
@@ -204,3 +215,3 @@ | ||
assert(b); | ||
const [partA, ignored, partB] = [ | ||
const [partA, , partB] = [ | ||
body.slice(0, a), | ||
@@ -215,5 +226,8 @@ body.slice(a, b), | ||
enterParamId(ctx: ParamIdContext) { | ||
const paramName = ctx.text; | ||
assert(this.currentQuery.params); | ||
assert(this.currentQuery.usedParamSet); | ||
const paramName = ctx.ID().text; | ||
const required = !!ctx.S_REQUIRED_MARK(); | ||
this.currentQuery.usedParamSet[paramName] = true; | ||
@@ -225,9 +239,11 @@ const reference = this.currentQuery.params.find( | ||
a: ctx.start.startIndex, | ||
b: ctx.start.stopIndex, | ||
b: ctx.stop?.stopIndex ?? ctx.start.stopIndex, | ||
line: ctx.start.line, | ||
col: ctx.start.charPositionInLine, | ||
}; | ||
if (!reference) { | ||
this.currentQuery.params.push({ | ||
name: paramName, | ||
required, | ||
transform: { type: TransformType.Scalar }, | ||
@@ -239,2 +255,3 @@ codeRefs: { | ||
} else { | ||
reference.required = reference.required || required; | ||
reference.codeRefs.used.push(useLoc); | ||
@@ -247,7 +264,4 @@ } | ||
function parseText( | ||
text: string, | ||
fileName: string = 'undefined.sql', | ||
): SQLParseResult { | ||
const logger = new Logger(text); | ||
function parseText(text: string): SQLParseResult { | ||
const logger = new Logger(); | ||
const inputStream = CharStreams.fromString(text); | ||
@@ -254,0 +268,0 @@ const lexer = new SQLLexer(inputStream); |
@@ -55,3 +55,2 @@ import chalk, { ChalkFunction } from 'chalk'; | ||
let colored = ''; | ||
let i = 0; | ||
for (const interval of intervals) { | ||
@@ -64,3 +63,2 @@ const a = str.slice(0, interval.a + offset); | ||
str = colored; | ||
i++; | ||
} | ||
@@ -119,8 +117,3 @@ return colored; | ||
public parseEvents: ParseEvent[] = []; | ||
private text: string; | ||
constructor(text: string) { | ||
this.text = text; | ||
} | ||
logEvent(event: ParseEvent) { | ||
@@ -131,3 +124,3 @@ this.parseEvents.push(event); | ||
syntaxError( | ||
recognizer: any, | ||
_recognizer: any, | ||
symbol: any, | ||
@@ -137,3 +130,3 @@ line: number, | ||
msg: string, | ||
e: RecognitionException | undefined, | ||
_e: RecognitionException | undefined, | ||
) { | ||
@@ -140,0 +133,0 @@ this.logEvent({ |
@@ -21,18 +21,20 @@ // Generated from src/loader/sql/grammar/SQLLexer.g4 by ANTLR 4.9.0-SNAPSHOT | ||
public static readonly OPEN_COMMENT = 2; | ||
public static readonly WORD = 3; | ||
public static readonly EOF_STATEMENT = 4; | ||
public static readonly WSL = 5; | ||
public static readonly STRING = 6; | ||
public static readonly PARAM_MARK = 7; | ||
public static readonly WS = 8; | ||
public static readonly TRANSFORM_ARROW = 9; | ||
public static readonly SPREAD = 10; | ||
public static readonly NAME_TAG = 11; | ||
public static readonly TYPE_TAG = 12; | ||
public static readonly OB = 13; | ||
public static readonly CB = 14; | ||
public static readonly COMMA = 15; | ||
public static readonly ANY = 16; | ||
public static readonly CLOSE_COMMENT = 17; | ||
public static readonly CAST = 18; | ||
public static readonly S_REQUIRED_MARK = 3; | ||
public static readonly WORD = 4; | ||
public static readonly EOF_STATEMENT = 5; | ||
public static readonly WSL = 6; | ||
public static readonly STRING = 7; | ||
public static readonly PARAM_MARK = 8; | ||
public static readonly WS = 9; | ||
public static readonly TRANSFORM_ARROW = 10; | ||
public static readonly SPREAD = 11; | ||
public static readonly NAME_TAG = 12; | ||
public static readonly TYPE_TAG = 13; | ||
public static readonly OB = 14; | ||
public static readonly CB = 15; | ||
public static readonly COMMA = 16; | ||
public static readonly C_REQUIRED_MARK = 17; | ||
public static readonly ANY = 18; | ||
public static readonly CLOSE_COMMENT = 19; | ||
public static readonly CAST = 20; | ||
public static readonly COMMENT = 1; | ||
@@ -51,16 +53,18 @@ | ||
public static readonly ruleNames: string[] = [ | ||
"QUOT", "ID", "OPEN_COMMENT", "SID", "WORD", "SPECIAL", "EOF_STATEMENT", | ||
"WSL", "STRING", "PARAM_MARK", "CAST", "CID", "WS", "TRANSFORM_ARROW", | ||
"SPREAD", "NAME_TAG", "TYPE_TAG", "OB", "CB", "COMMA", "ANY", "CLOSE_COMMENT", | ||
"QUOT", "ID", "OPEN_COMMENT", "SID", "S_REQUIRED_MARK", "WORD", "SPECIAL", | ||
"EOF_STATEMENT", "WSL", "STRING", "PARAM_MARK", "CAST", "CID", "WS", "TRANSFORM_ARROW", | ||
"SPREAD", "NAME_TAG", "TYPE_TAG", "OB", "CB", "COMMA", "C_REQUIRED_MARK", | ||
"ANY", "CLOSE_COMMENT", | ||
]; | ||
private static readonly _LITERAL_NAMES: Array<string | undefined> = [ | ||
undefined, undefined, "'/*'", undefined, "';'", undefined, undefined, | ||
"':'", undefined, "'->'", "'...'", "'@name'", "'@param'", "'('", "')'", | ||
"','", undefined, "'*/'", "'::'", | ||
undefined, undefined, "'/*'", undefined, undefined, "';'", undefined, | ||
undefined, "':'", undefined, "'->'", "'...'", "'@name'", "'@param'", "'('", | ||
"')'", "','", undefined, undefined, "'*/'", "'::'", | ||
]; | ||
private static readonly _SYMBOLIC_NAMES: Array<string | undefined> = [ | ||
undefined, "ID", "OPEN_COMMENT", "WORD", "EOF_STATEMENT", "WSL", "STRING", | ||
"PARAM_MARK", "WS", "TRANSFORM_ARROW", "SPREAD", "NAME_TAG", "TYPE_TAG", | ||
"OB", "CB", "COMMA", "ANY", "CLOSE_COMMENT", "CAST", | ||
undefined, "ID", "OPEN_COMMENT", "S_REQUIRED_MARK", "WORD", "EOF_STATEMENT", | ||
"WSL", "STRING", "PARAM_MARK", "WS", "TRANSFORM_ARROW", "SPREAD", "NAME_TAG", | ||
"TYPE_TAG", "OB", "CB", "COMMA", "C_REQUIRED_MARK", "ANY", "CLOSE_COMMENT", | ||
"CAST", | ||
]; | ||
@@ -98,3 +102,3 @@ public static readonly VOCABULARY: Vocabulary = new VocabularyImpl(SQLLexer._LITERAL_NAMES, SQLLexer._SYMBOLIC_NAMES, []); | ||
public static readonly _serializedATN: string = | ||
"\x03\uC91D\uCABA\u058D\uAFBA\u4F53\u0607\uEA8B\uC241\x02\x14\x99\b\x01" + | ||
"\x03\uC91D\uCABA\u058D\uAFBA\u4F53\u0607\uEA8B\uC241\x02\x16\xA1\b\x01" + | ||
"\b\x01\x04\x02\t\x02\x04\x03\t\x03\x04\x04\t\x04\x04\x05\t\x05\x04\x06" + | ||
@@ -104,62 +108,66 @@ "\t\x06\x04\x07\t\x07\x04\b\t\b\x04\t\t\t\x04\n\t\n\x04\v\t\v\x04\f\t\f" + | ||
"\x12\t\x12\x04\x13\t\x13\x04\x14\t\x14\x04\x15\t\x15\x04\x16\t\x16\x04" + | ||
"\x17\t\x17\x03\x02\x03\x02\x03\x03\x03\x03\x07\x035\n\x03\f\x03\x0E\x03" + | ||
"8\v\x03\x03\x04\x03\x04\x03\x04\x03\x04\x03\x04\x03\x05\x03\x05\x03\x05" + | ||
"\x03\x05\x03\x06\x06\x06D\n\x06\r\x06\x0E\x06E\x03\x07\x06\x07I\n\x07" + | ||
"\r\x07\x0E\x07J\x03\x07\x03\x07\x03\b\x03\b\x03\t\x06\tR\n\t\r\t\x0E\t" + | ||
"S\x03\t\x03\t\x03\n\x03\n\x03\n\x07\n[\n\n\f\n\x0E\n^\v\n\x03\n\x03\n" + | ||
"\x05\nb\n\n\x03\v\x03\v\x03\f\x03\f\x03\f\x03\f\x03\f\x03\r\x03\r\x03" + | ||
"\r\x03\r\x03\x0E\x06\x0Ep\n\x0E\r\x0E\x0E\x0Eq\x03\x0E\x03\x0E\x03\x0F" + | ||
"\x03\x0F\x03\x0F\x03\x10\x03\x10\x03\x10\x03\x10\x03\x11\x03\x11\x03\x11" + | ||
"\x03\x11\x03\x11\x03\x11\x03\x12\x03\x12\x03\x12\x03\x12\x03\x12\x03\x12" + | ||
"\x03\x12\x03\x13\x03\x13\x03\x14\x03\x14\x03\x15\x03\x15\x03\x16\x06\x16" + | ||
"\x91\n\x16\r\x16\x0E\x16\x92\x03\x17\x03\x17\x03\x17\x03\x17\x03\x17\x04" + | ||
"\\\x92\x02\x02\x18\x04\x02\x02\x06\x02\x03\b\x02\x04\n\x02\x02\f\x02\x05" + | ||
"\x0E\x02\x02\x10\x02\x06\x12\x02\x07\x14\x02\b\x16\x02\t\x18\x02\x14\x1A" + | ||
"\x02\x02\x1C\x02\n\x1E\x02\v \x02\f\"\x02\r$\x02\x0E&\x02\x0F(\x02\x10" + | ||
"*\x02\x11,\x02\x12.\x02\x13\x04\x02\x03\x07\x05\x02C\\aac|\x06\x022;C" + | ||
"\\aac|\t\x02#(*1>B]]_`bb}\x80\x05\x02\v\f\x0F\x0F\"\"\x03\x02^^\x02\x9D" + | ||
"\x02\b\x03\x02\x02\x02\x02\n\x03\x02\x02\x02\x02\f\x03\x02\x02\x02\x02" + | ||
"\x0E\x03\x02\x02\x02\x02\x10\x03\x02\x02\x02\x02\x12\x03\x02\x02\x02\x02" + | ||
"\x14\x03\x02\x02\x02\x02\x16\x03\x02\x02\x02\x02\x18\x03\x02\x02\x02\x03" + | ||
"\x1A\x03\x02\x02\x02\x03\x1C\x03\x02\x02\x02\x03\x1E\x03\x02\x02\x02\x03" + | ||
" \x03\x02\x02\x02\x03\"\x03\x02\x02\x02\x03$\x03\x02\x02\x02\x03&\x03" + | ||
"\x02\x02\x02\x03(\x03\x02\x02\x02\x03*\x03\x02\x02\x02\x03,\x03\x02\x02" + | ||
"\x02\x03.\x03\x02\x02\x02\x040\x03\x02\x02\x02\x062\x03\x02\x02\x02\b" + | ||
"9\x03\x02\x02\x02\n>\x03\x02\x02\x02\fC\x03\x02\x02\x02\x0EH\x03\x02\x02" + | ||
"\x02\x10N\x03\x02\x02\x02\x12Q\x03\x02\x02\x02\x14W\x03\x02\x02\x02\x16" + | ||
"c\x03\x02\x02\x02\x18e\x03\x02\x02\x02\x1Aj\x03\x02\x02\x02\x1Co\x03\x02" + | ||
"\x02\x02\x1Eu\x03\x02\x02\x02 x\x03\x02\x02\x02\"|\x03\x02\x02\x02$\x82" + | ||
"\x03\x02\x02\x02&\x89\x03\x02\x02\x02(\x8B\x03\x02\x02\x02*\x8D\x03\x02" + | ||
"\x02\x02,\x90\x03\x02\x02\x02.\x94\x03\x02\x02\x0201\x07)\x02\x021\x05" + | ||
"\x03\x02\x02\x0226\t\x02\x02\x0235\t\x03\x02\x0243\x03\x02\x02\x0258\x03" + | ||
"\x02\x02\x0264\x03\x02\x02\x0267\x03\x02\x02\x027\x07\x03\x02\x02\x02" + | ||
"86\x03\x02\x02\x029:\x071\x02\x02:;\x07,\x02\x02;<\x03\x02\x02\x02<=\b" + | ||
"\x04\x02\x02=\t\x03\x02\x02\x02>?\x05\x06\x03\x02?@\x03\x02\x02\x02@A" + | ||
"\b\x05\x03\x02A\v\x03\x02\x02\x02BD\t\x03\x02\x02CB\x03\x02\x02\x02DE" + | ||
"\x03\x02\x02\x02EC\x03\x02\x02\x02EF\x03\x02\x02\x02F\r\x03\x02\x02\x02" + | ||
"GI\t\x04\x02\x02HG\x03\x02\x02\x02IJ\x03\x02\x02\x02JH\x03\x02\x02\x02" + | ||
"JK\x03\x02\x02\x02KL\x03\x02\x02\x02LM\b\x07\x04\x02M\x0F\x03\x02\x02" + | ||
"\x02NO\x07=\x02\x02O\x11\x03\x02\x02\x02PR\t\x05\x02\x02QP\x03\x02\x02" + | ||
"\x02RS\x03\x02\x02\x02SQ\x03\x02\x02\x02ST\x03\x02\x02\x02TU\x03\x02\x02" + | ||
"\x02UV\b\t\x05\x02V\x13\x03\x02\x02\x02Wa\x05\x04\x02\x02Xb\x05\x04\x02" + | ||
"\x02Y[\v\x02\x02\x02ZY\x03\x02\x02\x02[^\x03\x02\x02\x02\\]\x03\x02\x02" + | ||
"\x02\\Z\x03\x02\x02\x02]_\x03\x02\x02\x02^\\\x03\x02\x02\x02_`\n\x06\x02" + | ||
"\x02`b\x05\x04\x02\x02aX\x03\x02\x02\x02a\\\x03\x02\x02\x02b\x15\x03\x02" + | ||
"\x02\x02cd\x07<\x02\x02d\x17\x03\x02\x02\x02ef\x07<\x02\x02fg\x07<\x02" + | ||
"\x02gh\x03\x02\x02\x02hi\b\f\x04\x02i\x19\x03\x02\x02\x02jk\x05\x06\x03" + | ||
"\x02kl\x03\x02\x02\x02lm\b\r\x03\x02m\x1B\x03\x02\x02\x02np\t\x05\x02" + | ||
"\x02on\x03\x02\x02\x02pq\x03\x02\x02\x02qo\x03\x02\x02\x02qr\x03\x02\x02" + | ||
"\x02rs\x03\x02\x02\x02st\b\x0E\x05\x02t\x1D\x03\x02\x02\x02uv\x07/\x02" + | ||
"\x02vw\x07@\x02\x02w\x1F\x03\x02\x02\x02xy\x070\x02\x02yz\x070\x02\x02" + | ||
"z{\x070\x02\x02{!\x03\x02\x02\x02|}\x07B\x02\x02}~\x07p\x02\x02~\x7F\x07" + | ||
"c\x02\x02\x7F\x80\x07o\x02\x02\x80\x81\x07g\x02\x02\x81#\x03\x02\x02\x02" + | ||
"\x82\x83\x07B\x02\x02\x83\x84\x07r\x02\x02\x84\x85\x07c\x02\x02\x85\x86" + | ||
"\x07t\x02\x02\x86\x87\x07c\x02\x02\x87\x88\x07o\x02\x02\x88%\x03\x02\x02" + | ||
"\x02\x89\x8A\x07*\x02\x02\x8A\'\x03\x02\x02\x02\x8B\x8C\x07+\x02\x02\x8C" + | ||
")\x03\x02\x02\x02\x8D\x8E\x07.\x02\x02\x8E+\x03\x02\x02\x02\x8F\x91\v" + | ||
"\x02\x02\x02\x90\x8F\x03\x02\x02\x02\x91\x92\x03\x02\x02\x02\x92\x93\x03" + | ||
"\x02\x02\x02\x92\x90\x03\x02\x02\x02\x93-\x03\x02\x02\x02\x94\x95\x07" + | ||
",\x02\x02\x95\x96\x071\x02\x02\x96\x97\x03\x02\x02\x02\x97\x98\b\x17\x06" + | ||
"\x02\x98/\x03\x02\x02\x02\f\x02\x036EJS\\aq\x92\x07\x04\x03\x02\t\x03" + | ||
"\x02\t\x05\x02\b\x02\x02\x04\x02\x02"; | ||
"\x17\t\x17\x04\x18\t\x18\x04\x19\t\x19\x03\x02\x03\x02\x03\x03\x03\x03" + | ||
"\x07\x039\n\x03\f\x03\x0E\x03<\v\x03\x03\x04\x03\x04\x03\x04\x03\x04\x03" + | ||
"\x04\x03\x05\x03\x05\x03\x05\x03\x05\x03\x06\x03\x06\x03\x07\x06\x07J" + | ||
"\n\x07\r\x07\x0E\x07K\x03\b\x06\bO\n\b\r\b\x0E\bP\x03\b\x03\b\x03\t\x03" + | ||
"\t\x03\n\x06\nX\n\n\r\n\x0E\nY\x03\n\x03\n\x03\v\x03\v\x03\v\x07\va\n" + | ||
"\v\f\v\x0E\vd\v\v\x03\v\x03\v\x05\vh\n\v\x03\f\x03\f\x03\r\x03\r\x03\r" + | ||
"\x03\r\x03\r\x03\x0E\x03\x0E\x03\x0E\x03\x0E\x03\x0F\x06\x0Fv\n\x0F\r" + | ||
"\x0F\x0E\x0Fw\x03\x0F\x03\x0F\x03\x10\x03\x10\x03\x10\x03\x11\x03\x11" + | ||
"\x03\x11\x03\x11\x03\x12\x03\x12\x03\x12\x03\x12\x03\x12\x03\x12\x03\x13" + | ||
"\x03\x13\x03\x13\x03\x13\x03\x13\x03\x13\x03\x13\x03\x14\x03\x14\x03\x15" + | ||
"\x03\x15\x03\x16\x03\x16\x03\x17\x03\x17\x03\x18\x06\x18\x99\n\x18\r\x18" + | ||
"\x0E\x18\x9A\x03\x19\x03\x19\x03\x19\x03\x19\x03\x19\x04b\x9A\x02\x02" + | ||
"\x1A\x04\x02\x02\x06\x02\x03\b\x02\x04\n\x02\x02\f\x02\x05\x0E\x02\x06" + | ||
"\x10\x02\x02\x12\x02\x07\x14\x02\b\x16\x02\t\x18\x02\n\x1A\x02\x16\x1C" + | ||
"\x02\x02\x1E\x02\v \x02\f\"\x02\r$\x02\x0E&\x02\x0F(\x02\x10*\x02\x11" + | ||
",\x02\x12.\x02\x130\x02\x142\x02\x15\x04\x02\x03\x07\x05\x02C\\aac|\x06" + | ||
"\x022;C\\aac|\t\x02#(*1>B]]_`bb}\x80\x05\x02\v\f\x0F\x0F\"\"\x03\x02^" + | ||
"^\x02\xA5\x02\b\x03\x02\x02\x02\x02\n\x03\x02\x02\x02\x02\f\x03\x02\x02" + | ||
"\x02\x02\x0E\x03\x02\x02\x02\x02\x10\x03\x02\x02\x02\x02\x12\x03\x02\x02" + | ||
"\x02\x02\x14\x03\x02\x02\x02\x02\x16\x03\x02\x02\x02\x02\x18\x03\x02\x02" + | ||
"\x02\x02\x1A\x03\x02\x02\x02\x03\x1C\x03\x02\x02\x02\x03\x1E\x03\x02\x02" + | ||
"\x02\x03 \x03\x02\x02\x02\x03\"\x03\x02\x02\x02\x03$\x03\x02\x02\x02\x03" + | ||
"&\x03\x02\x02\x02\x03(\x03\x02\x02\x02\x03*\x03\x02\x02\x02\x03,\x03\x02" + | ||
"\x02\x02\x03.\x03\x02\x02\x02\x030\x03\x02\x02\x02\x032\x03\x02\x02\x02" + | ||
"\x044\x03\x02\x02\x02\x066\x03\x02\x02\x02\b=\x03\x02\x02\x02\nB\x03\x02" + | ||
"\x02\x02\fF\x03\x02\x02\x02\x0EI\x03\x02\x02\x02\x10N\x03\x02\x02\x02" + | ||
"\x12T\x03\x02\x02\x02\x14W\x03\x02\x02\x02\x16]\x03\x02\x02\x02\x18i\x03" + | ||
"\x02\x02\x02\x1Ak\x03\x02\x02\x02\x1Cp\x03\x02\x02\x02\x1Eu\x03\x02\x02" + | ||
"\x02 {\x03\x02\x02\x02\"~\x03\x02\x02\x02$\x82\x03\x02\x02\x02&\x88\x03" + | ||
"\x02\x02\x02(\x8F\x03\x02\x02\x02*\x91\x03\x02\x02\x02,\x93\x03\x02\x02" + | ||
"\x02.\x95\x03\x02\x02\x020\x98\x03\x02\x02\x022\x9C\x03\x02\x02\x0245" + | ||
"\x07)\x02\x025\x05\x03\x02\x02\x026:\t\x02\x02\x0279\t\x03\x02\x0287\x03" + | ||
"\x02\x02\x029<\x03\x02\x02\x02:8\x03\x02\x02\x02:;\x03\x02\x02\x02;\x07" + | ||
"\x03\x02\x02\x02<:\x03\x02\x02\x02=>\x071\x02\x02>?\x07,\x02\x02?@\x03" + | ||
"\x02\x02\x02@A\b\x04\x02\x02A\t\x03\x02\x02\x02BC\x05\x06\x03\x02CD\x03" + | ||
"\x02\x02\x02DE\b\x05\x03\x02E\v\x03\x02\x02\x02FG\x07#\x02\x02G\r\x03" + | ||
"\x02\x02\x02HJ\t\x03\x02\x02IH\x03\x02\x02\x02JK\x03\x02\x02\x02KI\x03" + | ||
"\x02\x02\x02KL\x03\x02\x02\x02L\x0F\x03\x02\x02\x02MO\t\x04\x02\x02NM" + | ||
"\x03\x02\x02\x02OP\x03\x02\x02\x02PN\x03\x02\x02\x02PQ\x03\x02\x02\x02" + | ||
"QR\x03\x02\x02\x02RS\b\b\x04\x02S\x11\x03\x02\x02\x02TU\x07=\x02\x02U" + | ||
"\x13\x03\x02\x02\x02VX\t\x05\x02\x02WV\x03\x02\x02\x02XY\x03\x02\x02\x02" + | ||
"YW\x03\x02\x02\x02YZ\x03\x02\x02\x02Z[\x03\x02\x02\x02[\\\b\n\x05\x02" + | ||
"\\\x15\x03\x02\x02\x02]g\x05\x04\x02\x02^h\x05\x04\x02\x02_a\v\x02\x02" + | ||
"\x02`_\x03\x02\x02\x02ad\x03\x02\x02\x02bc\x03\x02\x02\x02b`\x03\x02\x02" + | ||
"\x02ce\x03\x02\x02\x02db\x03\x02\x02\x02ef\n\x06\x02\x02fh\x05\x04\x02" + | ||
"\x02g^\x03\x02\x02\x02gb\x03\x02\x02\x02h\x17\x03\x02\x02\x02ij\x07<\x02" + | ||
"\x02j\x19\x03\x02\x02\x02kl\x07<\x02\x02lm\x07<\x02\x02mn\x03\x02\x02" + | ||
"\x02no\b\r\x04\x02o\x1B\x03\x02\x02\x02pq\x05\x06\x03\x02qr\x03\x02\x02" + | ||
"\x02rs\b\x0E\x03\x02s\x1D\x03\x02\x02\x02tv\t\x05\x02\x02ut\x03\x02\x02" + | ||
"\x02vw\x03\x02\x02\x02wu\x03\x02\x02\x02wx\x03\x02\x02\x02xy\x03\x02\x02" + | ||
"\x02yz\b\x0F\x05\x02z\x1F\x03\x02\x02\x02{|\x07/\x02\x02|}\x07@\x02\x02" + | ||
"}!\x03\x02\x02\x02~\x7F\x070\x02\x02\x7F\x80\x070\x02\x02\x80\x81\x07" + | ||
"0\x02\x02\x81#\x03\x02\x02\x02\x82\x83\x07B\x02\x02\x83\x84\x07p\x02\x02" + | ||
"\x84\x85\x07c\x02\x02\x85\x86\x07o\x02\x02\x86\x87\x07g\x02\x02\x87%\x03" + | ||
"\x02\x02\x02\x88\x89\x07B\x02\x02\x89\x8A\x07r\x02\x02\x8A\x8B\x07c\x02" + | ||
"\x02\x8B\x8C\x07t\x02\x02\x8C\x8D\x07c\x02\x02\x8D\x8E\x07o\x02\x02\x8E" + | ||
"\'\x03\x02\x02\x02\x8F\x90\x07*\x02\x02\x90)\x03\x02\x02\x02\x91\x92\x07" + | ||
"+\x02\x02\x92+\x03\x02\x02\x02\x93\x94\x07.\x02\x02\x94-\x03\x02\x02\x02" + | ||
"\x95\x96\x07#\x02\x02\x96/\x03\x02\x02\x02\x97\x99\v\x02\x02\x02\x98\x97" + | ||
"\x03\x02\x02\x02\x99\x9A\x03\x02\x02\x02\x9A\x9B\x03\x02\x02\x02\x9A\x98" + | ||
"\x03\x02\x02\x02\x9B1\x03\x02\x02\x02\x9C\x9D\x07,\x02\x02\x9D\x9E\x07" + | ||
"1\x02\x02\x9E\x9F\x03\x02\x02\x02\x9F\xA0\b\x19\x06\x02\xA03\x03\x02\x02" + | ||
"\x02\f\x02\x03:KPYbgw\x9A\x07\x04\x03\x02\t\x03\x02\t\x06\x02\b\x02\x02" + | ||
"\x04\x02\x02"; | ||
public static __ATN: ATN; | ||
@@ -166,0 +174,0 @@ public static get _ATN(): ATN { |
@@ -33,18 +33,20 @@ // Generated from src/loader/sql/grammar/SQLParser.g4 by ANTLR 4.9.0-SNAPSHOT | ||
public static readonly OPEN_COMMENT = 2; | ||
public static readonly WORD = 3; | ||
public static readonly EOF_STATEMENT = 4; | ||
public static readonly WSL = 5; | ||
public static readonly STRING = 6; | ||
public static readonly PARAM_MARK = 7; | ||
public static readonly WS = 8; | ||
public static readonly TRANSFORM_ARROW = 9; | ||
public static readonly SPREAD = 10; | ||
public static readonly NAME_TAG = 11; | ||
public static readonly TYPE_TAG = 12; | ||
public static readonly OB = 13; | ||
public static readonly CB = 14; | ||
public static readonly COMMA = 15; | ||
public static readonly ANY = 16; | ||
public static readonly CLOSE_COMMENT = 17; | ||
public static readonly CAST = 18; | ||
public static readonly S_REQUIRED_MARK = 3; | ||
public static readonly WORD = 4; | ||
public static readonly EOF_STATEMENT = 5; | ||
public static readonly WSL = 6; | ||
public static readonly STRING = 7; | ||
public static readonly PARAM_MARK = 8; | ||
public static readonly WS = 9; | ||
public static readonly TRANSFORM_ARROW = 10; | ||
public static readonly SPREAD = 11; | ||
public static readonly NAME_TAG = 12; | ||
public static readonly TYPE_TAG = 13; | ||
public static readonly OB = 14; | ||
public static readonly CB = 15; | ||
public static readonly COMMA = 16; | ||
public static readonly C_REQUIRED_MARK = 17; | ||
public static readonly ANY = 18; | ||
public static readonly CLOSE_COMMENT = 19; | ||
public static readonly CAST = 20; | ||
public static readonly RULE_input = 0; | ||
@@ -78,10 +80,11 @@ public static readonly RULE_query = 1; | ||
private static readonly _LITERAL_NAMES: Array<string | undefined> = [ | ||
undefined, undefined, "'/*'", undefined, "';'", undefined, undefined, | ||
"':'", undefined, "'->'", "'...'", "'@name'", "'@param'", "'('", "')'", | ||
"','", undefined, "'*/'", "'::'", | ||
undefined, undefined, "'/*'", undefined, undefined, "';'", undefined, | ||
undefined, "':'", undefined, "'->'", "'...'", "'@name'", "'@param'", "'('", | ||
"')'", "','", undefined, undefined, "'*/'", "'::'", | ||
]; | ||
private static readonly _SYMBOLIC_NAMES: Array<string | undefined> = [ | ||
undefined, "ID", "OPEN_COMMENT", "WORD", "EOF_STATEMENT", "WSL", "STRING", | ||
"PARAM_MARK", "WS", "TRANSFORM_ARROW", "SPREAD", "NAME_TAG", "TYPE_TAG", | ||
"OB", "CB", "COMMA", "ANY", "CLOSE_COMMENT", "CAST", | ||
undefined, "ID", "OPEN_COMMENT", "S_REQUIRED_MARK", "WORD", "EOF_STATEMENT", | ||
"WSL", "STRING", "PARAM_MARK", "WS", "TRANSFORM_ARROW", "SPREAD", "NAME_TAG", | ||
"TYPE_TAG", "OB", "CB", "COMMA", "C_REQUIRED_MARK", "ANY", "CLOSE_COMMENT", | ||
"CAST", | ||
]; | ||
@@ -453,2 +456,3 @@ public static readonly VOCABULARY: Vocabulary = new VocabularyImpl(SQLParser._LITERAL_NAMES, SQLParser._SYMBOLIC_NAMES, []); | ||
this.enterRule(_localctx, 16, SQLParser.RULE_paramId); | ||
let _la: number; | ||
try { | ||
@@ -459,3 +463,13 @@ this.enterOuterAlt(_localctx, 1); | ||
this.match(SQLParser.ID); | ||
this.state = 92; | ||
this._errHandler.sync(this); | ||
_la = this._input.LA(1); | ||
if (_la === SQLParser.S_REQUIRED_MARK) { | ||
{ | ||
this.state = 91; | ||
this.match(SQLParser.S_REQUIRED_MARK); | ||
} | ||
} | ||
} | ||
} | ||
@@ -483,5 +497,5 @@ catch (re) { | ||
{ | ||
this.state = 92; | ||
this.state = 94; | ||
this.match(SQLParser.NAME_TAG); | ||
this.state = 93; | ||
this.state = 95; | ||
this.queryName(); | ||
@@ -511,7 +525,7 @@ } | ||
{ | ||
this.state = 95; | ||
this.state = 97; | ||
this.match(SQLParser.TYPE_TAG); | ||
this.state = 96; | ||
this.state = 98; | ||
this.paramName(); | ||
this.state = 97; | ||
this.state = 99; | ||
this.paramTransform(); | ||
@@ -541,5 +555,5 @@ } | ||
{ | ||
this.state = 99; | ||
this.state = 101; | ||
this.match(SQLParser.TRANSFORM_ARROW); | ||
this.state = 100; | ||
this.state = 102; | ||
this.transformRule(); | ||
@@ -567,9 +581,9 @@ } | ||
try { | ||
this.state = 105; | ||
this.state = 107; | ||
this._errHandler.sync(this); | ||
switch ( this.interpreter.adaptivePredict(this._input, 6, this._ctx) ) { | ||
switch ( this.interpreter.adaptivePredict(this._input, 7, this._ctx) ) { | ||
case 1: | ||
this.enterOuterAlt(_localctx, 1); | ||
{ | ||
this.state = 102; | ||
this.state = 104; | ||
this.spreadTransform(); | ||
@@ -582,3 +596,3 @@ } | ||
{ | ||
this.state = 103; | ||
this.state = 105; | ||
this.pickTransform(); | ||
@@ -591,3 +605,3 @@ } | ||
{ | ||
this.state = 104; | ||
this.state = 106; | ||
this.spreadPickTransform(); | ||
@@ -619,7 +633,7 @@ } | ||
{ | ||
this.state = 107; | ||
this.state = 109; | ||
this.match(SQLParser.OB); | ||
this.state = 108; | ||
this.state = 110; | ||
this.match(SQLParser.SPREAD); | ||
this.state = 109; | ||
this.state = 111; | ||
this.match(SQLParser.CB); | ||
@@ -651,9 +665,9 @@ } | ||
{ | ||
this.state = 111; | ||
this.state = 113; | ||
this.match(SQLParser.OB); | ||
this.state = 112; | ||
this.state = 114; | ||
this.key(); | ||
this.state = 117; | ||
this.state = 119; | ||
this._errHandler.sync(this); | ||
_alt = this.interpreter.adaptivePredict(this._input, 7, this._ctx); | ||
_alt = this.interpreter.adaptivePredict(this._input, 8, this._ctx); | ||
while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { | ||
@@ -663,5 +677,5 @@ if (_alt === 1) { | ||
{ | ||
this.state = 113; | ||
this.state = 115; | ||
this.match(SQLParser.COMMA); | ||
this.state = 114; | ||
this.state = 116; | ||
this.key(); | ||
@@ -671,7 +685,7 @@ } | ||
} | ||
this.state = 119; | ||
this.state = 121; | ||
this._errHandler.sync(this); | ||
_alt = this.interpreter.adaptivePredict(this._input, 7, this._ctx); | ||
_alt = this.interpreter.adaptivePredict(this._input, 8, this._ctx); | ||
} | ||
this.state = 121; | ||
this.state = 123; | ||
this._errHandler.sync(this); | ||
@@ -681,3 +695,3 @@ _la = this._input.LA(1); | ||
{ | ||
this.state = 120; | ||
this.state = 122; | ||
this.match(SQLParser.COMMA); | ||
@@ -687,3 +701,3 @@ } | ||
this.state = 123; | ||
this.state = 125; | ||
this.match(SQLParser.CB); | ||
@@ -713,9 +727,9 @@ } | ||
{ | ||
this.state = 125; | ||
this.state = 127; | ||
this.match(SQLParser.OB); | ||
this.state = 126; | ||
this.state = 128; | ||
this.pickTransform(); | ||
this.state = 127; | ||
this.state = 129; | ||
this.match(SQLParser.SPREAD); | ||
this.state = 128; | ||
this.state = 130; | ||
this.match(SQLParser.CB); | ||
@@ -742,8 +756,19 @@ } | ||
this.enterRule(_localctx, 32, SQLParser.RULE_key); | ||
let _la: number; | ||
try { | ||
this.enterOuterAlt(_localctx, 1); | ||
{ | ||
this.state = 130; | ||
this.state = 132; | ||
this.match(SQLParser.ID); | ||
this.state = 134; | ||
this._errHandler.sync(this); | ||
_la = this._input.LA(1); | ||
if (_la === SQLParser.C_REQUIRED_MARK) { | ||
{ | ||
this.state = 133; | ||
this.match(SQLParser.C_REQUIRED_MARK); | ||
} | ||
} | ||
} | ||
} | ||
@@ -771,3 +796,3 @@ catch (re) { | ||
{ | ||
this.state = 132; | ||
this.state = 136; | ||
this.match(SQLParser.ID); | ||
@@ -797,3 +822,3 @@ } | ||
{ | ||
this.state = 134; | ||
this.state = 138; | ||
this.match(SQLParser.ID); | ||
@@ -818,3 +843,3 @@ } | ||
public static readonly _serializedATN: string = | ||
"\x03\uC91D\uCABA\u058D\uAFBA\u4F53\u0607\uEA8B\uC241\x03\x14\x8B\x04\x02" + | ||
"\x03\uC91D\uCABA\u058D\uAFBA\u4F53\u0607\uEA8B\uC241\x03\x16\x8F\x04\x02" + | ||
"\t\x02\x04\x03\t\x03\x04\x04\t\x04\x04\x05\t\x05\x04\x06\t\x06\x04\x07" + | ||
@@ -829,44 +854,47 @@ "\t\x07\x04\b\t\b\x04\t\t\t\x04\n\t\n\x04\v\t\v\x04\f\t\f\x04\r\t\r\x04" + | ||
"\n\x07\f\x07\x0E\x07V\v\x07\x03\b\x03\b\x03\t\x03\t\x03\t\x03\n\x03\n" + | ||
"\x03\v\x03\v\x03\v\x03\f\x03\f\x03\f\x03\f\x03\r\x03\r\x03\r\x03\x0E\x03" + | ||
"\x0E\x03\x0E\x05\x0El\n\x0E\x03\x0F\x03\x0F\x03\x0F\x03\x0F\x03\x10\x03" + | ||
"\x10\x03\x10\x03\x10\x07\x10v\n\x10\f\x10\x0E\x10y\v\x10\x03\x10\x05\x10" + | ||
"|\n\x10\x03\x10\x03\x10\x03\x11\x03\x11\x03\x11\x03\x11\x03\x11\x03\x12" + | ||
"\x03\x12\x03\x13\x03\x13\x03\x14\x03\x14\x03\x14\x03F\x02\x02\x15\x02" + | ||
"\x02\x04\x02\x06\x02\b\x02\n\x02\f\x02\x0E\x02\x10\x02\x12\x02\x14\x02" + | ||
"\x16\x02\x18\x02\x1A\x02\x1C\x02\x1E\x02 \x02\"\x02$\x02&\x02\x02\x04" + | ||
"\x03\x02\r\r\x05\x02\x03\x03\x05\x05\b\b\x02\x82\x02/\x03\x02\x02\x02" + | ||
"\x045\x03\x02\x02\x02\x068\x03\x02\x02\x02\bB\x03\x02\x02\x02\nK\x03\x02" + | ||
"\x02\x02\fN\x03\x02\x02\x02\x0EW\x03\x02\x02\x02\x10Y\x03\x02\x02\x02" + | ||
"\x12\\\x03\x02\x02\x02\x14^\x03\x02\x02\x02\x16a\x03\x02\x02\x02\x18e" + | ||
"\x03\x02\x02\x02\x1Ak\x03\x02\x02\x02\x1Cm\x03\x02\x02\x02\x1Eq\x03\x02" + | ||
"\x02\x02 \x7F\x03\x02\x02\x02\"\x84\x03\x02\x02\x02$\x86\x03\x02\x02\x02" + | ||
"&\x88\x03\x02\x02\x02(*\x05\b\x05\x02)(\x03\x02\x02\x02*-\x03\x02\x02" + | ||
"\x02+)\x03\x02\x02\x02+,\x03\x02\x02\x02,.\x03\x02\x02\x02-+\x03\x02\x02" + | ||
"\x02.0\x05\x04\x03\x02/+\x03\x02\x02\x0201\x03\x02\x02\x021/\x03\x02\x02" + | ||
"\x0212\x03\x02\x02\x0223\x03\x02\x02\x0234\x07\x02\x02\x034\x03\x03\x02" + | ||
"\x02\x0256\x05\x06\x04\x0267\x05\n\x06\x027\x05\x03\x02\x02\x0289\x07" + | ||
"\x04\x02\x029=\x05\x14\v\x02:<\x05\x16\f\x02;:\x03\x02\x02\x02<?\x03\x02" + | ||
"\x02\x02=;\x03\x02\x02\x02=>\x03\x02\x02\x02>@\x03\x02\x02\x02?=\x03\x02" + | ||
"\x02\x02@A\x07\x13\x02\x02A\x07\x03\x02\x02\x02BF\x07\x04\x02\x02CE\n" + | ||
"\x02\x02\x02DC\x03\x02\x02\x02EH\x03\x02\x02\x02FG\x03\x02\x02\x02FD\x03" + | ||
"\x02\x02\x02GI\x03\x02\x02\x02HF\x03\x02\x02\x02IJ\x07\x13\x02\x02J\t" + | ||
"\x03\x02\x02\x02KL\x05\f\x07\x02LM\x07\x06\x02\x02M\v\x03\x02\x02\x02" + | ||
"NT\x05\x0E\b\x02OS\x05\b\x05\x02PS\x05\x10\t\x02QS\x05\x0E\b\x02RO\x03" + | ||
"\x02\x02\x02RP\x03\x02\x02\x02RQ\x03\x02\x02\x02SV\x03\x02\x02\x02TR\x03" + | ||
"\x02\x02\x02TU\x03\x02\x02\x02U\r\x03\x02\x02\x02VT\x03\x02\x02\x02WX" + | ||
"\t\x03\x02\x02X\x0F\x03\x02\x02\x02YZ\x07\t\x02\x02Z[\x05\x12\n\x02[\x11" + | ||
"\x03\x02\x02\x02\\]\x07\x03\x02\x02]\x13\x03\x02\x02\x02^_\x07\r\x02\x02" + | ||
"_`\x05$\x13\x02`\x15\x03\x02\x02\x02ab\x07\x0E\x02\x02bc\x05&\x14\x02" + | ||
"cd\x05\x18\r\x02d\x17\x03\x02\x02\x02ef\x07\v\x02\x02fg\x05\x1A\x0E\x02" + | ||
"g\x19\x03\x02\x02\x02hl\x05\x1C\x0F\x02il\x05\x1E\x10\x02jl\x05 \x11\x02" + | ||
"kh\x03\x02\x02\x02ki\x03\x02\x02\x02kj\x03\x02\x02\x02l\x1B\x03\x02\x02" + | ||
"\x02mn\x07\x0F\x02\x02no\x07\f\x02\x02op\x07\x10\x02\x02p\x1D\x03\x02" + | ||
"\x02\x02qr\x07\x0F\x02\x02rw\x05\"\x12\x02st\x07\x11\x02\x02tv\x05\"\x12" + | ||
"\x02us\x03\x02\x02\x02vy\x03\x02\x02\x02wu\x03\x02\x02\x02wx\x03\x02\x02" + | ||
"\x02x{\x03\x02\x02\x02yw\x03\x02\x02\x02z|\x07\x11\x02\x02{z\x03\x02\x02" + | ||
"\x02{|\x03\x02\x02\x02|}\x03\x02\x02\x02}~\x07\x10\x02\x02~\x1F\x03\x02" + | ||
"\x02\x02\x7F\x80\x07\x0F\x02\x02\x80\x81\x05\x1E\x10\x02\x81\x82\x07\f" + | ||
"\x02\x02\x82\x83\x07\x10\x02\x02\x83!\x03\x02\x02\x02\x84\x85\x07\x03" + | ||
"\x02\x02\x85#\x03\x02\x02\x02\x86\x87\x07\x03\x02\x02\x87%\x03\x02\x02" + | ||
"\x02\x88\x89\x07\x03\x02\x02\x89\'\x03\x02\x02\x02\v+1=FRTkw{"; | ||
"\x05\n_\n\n\x03\v\x03\v\x03\v\x03\f\x03\f\x03\f\x03\f\x03\r\x03\r\x03" + | ||
"\r\x03\x0E\x03\x0E\x03\x0E\x05\x0En\n\x0E\x03\x0F\x03\x0F\x03\x0F\x03" + | ||
"\x0F\x03\x10\x03\x10\x03\x10\x03\x10\x07\x10x\n\x10\f\x10\x0E\x10{\v\x10" + | ||
"\x03\x10\x05\x10~\n\x10\x03\x10\x03\x10\x03\x11\x03\x11\x03\x11\x03\x11" + | ||
"\x03\x11\x03\x12\x03\x12\x05\x12\x89\n\x12\x03\x13\x03\x13\x03\x14\x03" + | ||
"\x14\x03\x14\x03F\x02\x02\x15\x02\x02\x04\x02\x06\x02\b\x02\n\x02\f\x02" + | ||
"\x0E\x02\x10\x02\x12\x02\x14\x02\x16\x02\x18\x02\x1A\x02\x1C\x02\x1E\x02" + | ||
" \x02\"\x02$\x02&\x02\x02\x04\x03\x02\x0E\x0E\x05\x02\x03\x03\x06\x06" + | ||
"\t\t\x02\x88\x02/\x03\x02\x02\x02\x045\x03\x02\x02\x02\x068\x03\x02\x02" + | ||
"\x02\bB\x03\x02\x02\x02\nK\x03\x02\x02\x02\fN\x03\x02\x02\x02\x0EW\x03" + | ||
"\x02\x02\x02\x10Y\x03\x02\x02\x02\x12\\\x03\x02\x02\x02\x14`\x03\x02\x02" + | ||
"\x02\x16c\x03\x02\x02\x02\x18g\x03\x02\x02\x02\x1Am\x03\x02\x02\x02\x1C" + | ||
"o\x03\x02\x02\x02\x1Es\x03\x02\x02\x02 \x81\x03\x02\x02\x02\"\x86\x03" + | ||
"\x02\x02\x02$\x8A\x03\x02\x02\x02&\x8C\x03\x02\x02\x02(*\x05\b\x05\x02" + | ||
")(\x03\x02\x02\x02*-\x03\x02\x02\x02+)\x03\x02\x02\x02+,\x03\x02\x02\x02" + | ||
",.\x03\x02\x02\x02-+\x03\x02\x02\x02.0\x05\x04\x03\x02/+\x03\x02\x02\x02" + | ||
"01\x03\x02\x02\x021/\x03\x02\x02\x0212\x03\x02\x02\x0223\x03\x02\x02\x02" + | ||
"34\x07\x02\x02\x034\x03\x03\x02\x02\x0256\x05\x06\x04\x0267\x05\n\x06" + | ||
"\x027\x05\x03\x02\x02\x0289\x07\x04\x02\x029=\x05\x14\v\x02:<\x05\x16" + | ||
"\f\x02;:\x03\x02\x02\x02<?\x03\x02\x02\x02=;\x03\x02\x02\x02=>\x03\x02" + | ||
"\x02\x02>@\x03\x02\x02\x02?=\x03\x02\x02\x02@A\x07\x15\x02\x02A\x07\x03" + | ||
"\x02\x02\x02BF\x07\x04\x02\x02CE\n\x02\x02\x02DC\x03\x02\x02\x02EH\x03" + | ||
"\x02\x02\x02FG\x03\x02\x02\x02FD\x03\x02\x02\x02GI\x03\x02\x02\x02HF\x03" + | ||
"\x02\x02\x02IJ\x07\x15\x02\x02J\t\x03\x02\x02\x02KL\x05\f\x07\x02LM\x07" + | ||
"\x07\x02\x02M\v\x03\x02\x02\x02NT\x05\x0E\b\x02OS\x05\b\x05\x02PS\x05" + | ||
"\x10\t\x02QS\x05\x0E\b\x02RO\x03\x02\x02\x02RP\x03\x02\x02\x02RQ\x03\x02" + | ||
"\x02\x02SV\x03\x02\x02\x02TR\x03\x02\x02\x02TU\x03\x02\x02\x02U\r\x03" + | ||
"\x02\x02\x02VT\x03\x02\x02\x02WX\t\x03\x02\x02X\x0F\x03\x02\x02\x02YZ" + | ||
"\x07\n\x02\x02Z[\x05\x12\n\x02[\x11\x03\x02\x02\x02\\^\x07\x03\x02\x02" + | ||
"]_\x07\x05\x02\x02^]\x03\x02\x02\x02^_\x03\x02\x02\x02_\x13\x03\x02\x02" + | ||
"\x02`a\x07\x0E\x02\x02ab\x05$\x13\x02b\x15\x03\x02\x02\x02cd\x07\x0F\x02" + | ||
"\x02de\x05&\x14\x02ef\x05\x18\r\x02f\x17\x03\x02\x02\x02gh\x07\f\x02\x02" + | ||
"hi\x05\x1A\x0E\x02i\x19\x03\x02\x02\x02jn\x05\x1C\x0F\x02kn\x05\x1E\x10" + | ||
"\x02ln\x05 \x11\x02mj\x03\x02\x02\x02mk\x03\x02\x02\x02ml\x03\x02\x02" + | ||
"\x02n\x1B\x03\x02\x02\x02op\x07\x10\x02\x02pq\x07\r\x02\x02qr\x07\x11" + | ||
"\x02\x02r\x1D\x03\x02\x02\x02st\x07\x10\x02\x02ty\x05\"\x12\x02uv\x07" + | ||
"\x12\x02\x02vx\x05\"\x12\x02wu\x03\x02\x02\x02x{\x03\x02\x02\x02yw\x03" + | ||
"\x02\x02\x02yz\x03\x02\x02\x02z}\x03\x02\x02\x02{y\x03\x02\x02\x02|~\x07" + | ||
"\x12\x02\x02}|\x03\x02\x02\x02}~\x03\x02\x02\x02~\x7F\x03\x02\x02\x02" + | ||
"\x7F\x80\x07\x11\x02\x02\x80\x1F\x03\x02\x02\x02\x81\x82\x07\x10\x02\x02" + | ||
"\x82\x83\x05\x1E\x10\x02\x83\x84\x07\r\x02\x02\x84\x85\x07\x11\x02\x02" + | ||
"\x85!\x03\x02\x02\x02\x86\x88\x07\x03\x02\x02\x87\x89\x07\x13\x02\x02" + | ||
"\x88\x87\x03\x02\x02\x02\x88\x89\x03\x02\x02\x02\x89#\x03\x02\x02\x02" + | ||
"\x8A\x8B\x07\x03\x02\x02\x8B%\x03\x02\x02\x02\x8C\x8D\x07\x03\x02\x02" + | ||
"\x8D\'\x03\x02\x02\x02\r+1=FRT^my}\x88"; | ||
public static __ATN: ATN; | ||
@@ -1205,2 +1233,3 @@ public static get _ATN(): ATN { | ||
public ID(): TerminalNode { return this.getToken(SQLParser.ID, 0); } | ||
public S_REQUIRED_MARK(): TerminalNode | undefined { return this.tryGetToken(SQLParser.S_REQUIRED_MARK, 0); } | ||
constructor(parent: ParserRuleContext | undefined, invokingState: number) { | ||
@@ -1492,2 +1521,3 @@ super(parent, invokingState); | ||
public ID(): TerminalNode { return this.getToken(SQLParser.ID, 0); } | ||
public C_REQUIRED_MARK(): TerminalNode | undefined { return this.tryGetToken(SQLParser.C_REQUIRED_MARK, 0); } | ||
constructor(parent: ParserRuleContext | undefined, invokingState: number) { | ||
@@ -1494,0 +1524,0 @@ super(parent, invokingState); |
@@ -1,2 +0,2 @@ | ||
import ts from 'typescript'; | ||
import * as ts from 'typescript'; | ||
import parseQuery, { Query } from './query'; | ||
@@ -3,0 +3,0 @@ import { ParseEvent } from '../sql/logger'; |
@@ -26,6 +26,7 @@ // Generated from src/loader/typescript/grammar/QueryLexer.g4 by ANTLR 4.9.0-SNAPSHOT | ||
public static readonly WORD = 7; | ||
public static readonly SPECIAL = 8; | ||
public static readonly EOF_STATEMENT = 9; | ||
public static readonly WSL = 10; | ||
public static readonly STRING = 11; | ||
public static readonly REQUIRED_MARK = 8; | ||
public static readonly SPECIAL = 9; | ||
public static readonly EOF_STATEMENT = 10; | ||
public static readonly WSL = 11; | ||
public static readonly STRING = 12; | ||
@@ -44,12 +45,14 @@ // tslint:disable:no-trailing-whitespace | ||
"QUOT", "ID", "SID", "SINGULAR_PARAM_MARK", "PLURAL_PARAM_MARK", "COMMA", | ||
"OB", "CB", "WORD", "SPECIAL", "EOF_STATEMENT", "WSL", "STRING", | ||
"OB", "CB", "WORD", "REQUIRED_MARK", "SPECIAL", "EOF_STATEMENT", "WSL", | ||
"STRING", | ||
]; | ||
private static readonly _LITERAL_NAMES: Array<string | undefined> = [ | ||
undefined, undefined, "'$'", "'$$'", "','", "'('", "')'", undefined, undefined, | ||
"';'", | ||
undefined, undefined, "'$'", "'$$'", "','", "'('", "')'", undefined, "'!'", | ||
undefined, "';'", | ||
]; | ||
private static readonly _SYMBOLIC_NAMES: Array<string | undefined> = [ | ||
undefined, "ID", "SINGULAR_PARAM_MARK", "PLURAL_PARAM_MARK", "COMMA", | ||
"OB", "CB", "WORD", "SPECIAL", "EOF_STATEMENT", "WSL", "STRING", | ||
"OB", "CB", "WORD", "REQUIRED_MARK", "SPECIAL", "EOF_STATEMENT", "WSL", | ||
"STRING", | ||
]; | ||
@@ -87,38 +90,40 @@ public static readonly VOCABULARY: Vocabulary = new VocabularyImpl(QueryLexer._LITERAL_NAMES, QueryLexer._SYMBOLIC_NAMES, []); | ||
public static readonly _serializedATN: string = | ||
"\x03\uC91D\uCABA\u058D\uAFBA\u4F53\u0607\uEA8B\uC241\x02\rT\b\x01\x04" + | ||
"\x03\uC91D\uCABA\u058D\uAFBA\u4F53\u0607\uEA8B\uC241\x02\x0EX\b\x01\x04" + | ||
"\x02\t\x02\x04\x03\t\x03\x04\x04\t\x04\x04\x05\t\x05\x04\x06\t\x06\x04" + | ||
"\x07\t\x07\x04\b\t\b\x04\t\t\t\x04\n\t\n\x04\v\t\v\x04\f\t\f\x04\r\t\r" + | ||
"\x04\x0E\t\x0E\x03\x02\x03\x02\x03\x03\x03\x03\x07\x03\"\n\x03\f\x03\x0E" + | ||
"\x03%\v\x03\x03\x04\x03\x04\x03\x04\x03\x04\x03\x05\x03\x05\x03\x06\x03" + | ||
"\x06\x03\x06\x03\x07\x03\x07\x03\b\x03\b\x03\t\x03\t\x03\n\x06\n7\n\n" + | ||
"\r\n\x0E\n8\x03\v\x06\v<\n\v\r\v\x0E\v=\x03\f\x03\f\x03\r\x06\rC\n\r\r" + | ||
"\r\x0E\rD\x03\r\x03\r\x03\x0E\x03\x0E\x03\x0E\x07\x0EL\n\x0E\f\x0E\x0E" + | ||
"\x0EO\v\x0E\x03\x0E\x03\x0E\x05\x0ES\n\x0E\x03M\x02\x02\x0F\x03\x02\x02" + | ||
"\x05\x02\x03\x07\x02\x02\t\x02\x04\v\x02\x05\r\x02\x06\x0F\x02\x07\x11" + | ||
"\x02\b\x13\x02\t\x15\x02\n\x17\x02\v\x19\x02\f\x1B\x02\r\x03\x02\x07\x05" + | ||
"\x02C\\aac|\x06\x022;C\\aac|\v\x02#(,-/1<<>B]]_`bb}\x80\x05\x02\v\f\x0F" + | ||
"\x0F\"\"\x03\x02^^\x02W\x02\x07\x03\x02\x02\x02\x02\t\x03\x02\x02\x02" + | ||
"\x02\v\x03\x02\x02\x02\x02\r\x03\x02\x02\x02\x02\x0F\x03\x02\x02\x02\x02" + | ||
"\x11\x03\x02\x02\x02\x02\x13\x03\x02\x02\x02\x02\x15\x03\x02\x02\x02\x02" + | ||
"\x17\x03\x02\x02\x02\x02\x19\x03\x02\x02\x02\x02\x1B\x03\x02\x02\x02\x03" + | ||
"\x1D\x03\x02\x02\x02\x05\x1F\x03\x02\x02\x02\x07&\x03\x02\x02\x02\t*\x03" + | ||
"\x02\x02\x02\v,\x03\x02\x02\x02\r/\x03\x02\x02\x02\x0F1\x03\x02\x02\x02" + | ||
"\x113\x03\x02\x02\x02\x136\x03\x02\x02\x02\x15;\x03\x02\x02\x02\x17?\x03" + | ||
"\x02\x02\x02\x19B\x03\x02\x02\x02\x1BH\x03\x02\x02\x02\x1D\x1E\x07)\x02" + | ||
"\x02\x1E\x04\x03\x02\x02\x02\x1F#\t\x02\x02\x02 \"\t\x03\x02\x02! \x03" + | ||
"\x02\x02\x02\"%\x03\x02\x02\x02#!\x03\x02\x02\x02#$\x03\x02\x02\x02$\x06" + | ||
"\x03\x02\x02\x02%#\x03\x02\x02\x02&\'\x05\x05\x03\x02\'(\x03\x02\x02\x02" + | ||
"()\b\x04\x02\x02)\b\x03\x02\x02\x02*+\x07&\x02\x02+\n\x03\x02\x02\x02" + | ||
",-\x07&\x02\x02-.\x07&\x02\x02.\f\x03\x02\x02\x02/0\x07.\x02\x020\x0E" + | ||
"\x03\x02\x02\x0212\x07*\x02\x022\x10\x03\x02\x02\x0234\x07+\x02\x024\x12" + | ||
"\x03\x02\x02\x0257\t\x03\x02\x0265\x03\x02\x02\x0278\x03\x02\x02\x028" + | ||
"6\x03\x02\x02\x0289\x03\x02\x02\x029\x14\x03\x02\x02\x02:<\t\x04\x02\x02" + | ||
";:\x03\x02\x02\x02<=\x03\x02\x02\x02=;\x03\x02\x02\x02=>\x03\x02\x02\x02" + | ||
">\x16\x03\x02\x02\x02?@\x07=\x02\x02@\x18\x03\x02\x02\x02AC\t\x05\x02" + | ||
"\x02BA\x03\x02\x02\x02CD\x03\x02\x02\x02DB\x03\x02\x02\x02DE\x03\x02\x02" + | ||
"\x02EF\x03\x02\x02\x02FG\b\r\x03\x02G\x1A\x03\x02\x02\x02HR\x05\x03\x02" + | ||
"\x02IS\x05\x03\x02\x02JL\v\x02\x02\x02KJ\x03\x02\x02\x02LO\x03\x02\x02" + | ||
"\x02MN\x03\x02\x02\x02MK\x03\x02\x02\x02NP\x03\x02\x02\x02OM\x03\x02\x02" + | ||
"\x02PQ\n\x06\x02\x02QS\x05\x03\x02\x02RI\x03\x02\x02\x02RM\x03\x02\x02" + | ||
"\x02S\x1C\x03\x02\x02\x02\t\x02#8=DMR\x04\t\x03\x02\b\x02\x02"; | ||
"\x04\x0E\t\x0E\x04\x0F\t\x0F\x03\x02\x03\x02\x03\x03\x03\x03\x07\x03$" + | ||
"\n\x03\f\x03\x0E\x03\'\v\x03\x03\x04\x03\x04\x03\x04\x03\x04\x03\x05\x03" + | ||
"\x05\x03\x06\x03\x06\x03\x06\x03\x07\x03\x07\x03\b\x03\b\x03\t\x03\t\x03" + | ||
"\n\x06\n9\n\n\r\n\x0E\n:\x03\v\x03\v\x03\f\x06\f@\n\f\r\f\x0E\fA\x03\r" + | ||
"\x03\r\x03\x0E\x06\x0EG\n\x0E\r\x0E\x0E\x0EH\x03\x0E\x03\x0E\x03\x0F\x03" + | ||
"\x0F\x03\x0F\x07\x0FP\n\x0F\f\x0F\x0E\x0FS\v\x0F\x03\x0F\x03\x0F\x05\x0F" + | ||
"W\n\x0F\x03Q\x02\x02\x10\x03\x02\x02\x05\x02\x03\x07\x02\x02\t\x02\x04" + | ||
"\v\x02\x05\r\x02\x06\x0F\x02\x07\x11\x02\b\x13\x02\t\x15\x02\n\x17\x02" + | ||
"\v\x19\x02\f\x1B\x02\r\x1D\x02\x0E\x03\x02\x07\x05\x02C\\aac|\x06\x02" + | ||
"2;C\\aac|\v\x02$(,-/1<<>B]]_`bb}\x80\x05\x02\v\f\x0F\x0F\"\"\x03\x02^" + | ||
"^\x02[\x02\x07\x03\x02\x02\x02\x02\t\x03\x02\x02\x02\x02\v\x03\x02\x02" + | ||
"\x02\x02\r\x03\x02\x02\x02\x02\x0F\x03\x02\x02\x02\x02\x11\x03\x02\x02" + | ||
"\x02\x02\x13\x03\x02\x02\x02\x02\x15\x03\x02\x02\x02\x02\x17\x03\x02\x02" + | ||
"\x02\x02\x19\x03\x02\x02\x02\x02\x1B\x03\x02\x02\x02\x02\x1D\x03\x02\x02" + | ||
"\x02\x03\x1F\x03\x02\x02\x02\x05!\x03\x02\x02\x02\x07(\x03\x02\x02\x02" + | ||
"\t,\x03\x02\x02\x02\v.\x03\x02\x02\x02\r1\x03\x02\x02\x02\x0F3\x03\x02" + | ||
"\x02\x02\x115\x03\x02\x02\x02\x138\x03\x02\x02\x02\x15<\x03\x02\x02\x02" + | ||
"\x17?\x03\x02\x02\x02\x19C\x03\x02\x02\x02\x1BF\x03\x02\x02\x02\x1DL\x03" + | ||
"\x02\x02\x02\x1F \x07)\x02\x02 \x04\x03\x02\x02\x02!%\t\x02\x02\x02\"" + | ||
"$\t\x03\x02\x02#\"\x03\x02\x02\x02$\'\x03\x02\x02\x02%#\x03\x02\x02\x02" + | ||
"%&\x03\x02\x02\x02&\x06\x03\x02\x02\x02\'%\x03\x02\x02\x02()\x05\x05\x03" + | ||
"\x02)*\x03\x02\x02\x02*+\b\x04\x02\x02+\b\x03\x02\x02\x02,-\x07&\x02\x02" + | ||
"-\n\x03\x02\x02\x02./\x07&\x02\x02/0\x07&\x02\x020\f\x03\x02\x02\x021" + | ||
"2\x07.\x02\x022\x0E\x03\x02\x02\x0234\x07*\x02\x024\x10\x03\x02\x02\x02" + | ||
"56\x07+\x02\x026\x12\x03\x02\x02\x0279\t\x03\x02\x0287\x03\x02\x02\x02" + | ||
"9:\x03\x02\x02\x02:8\x03\x02\x02\x02:;\x03\x02\x02\x02;\x14\x03\x02\x02" + | ||
"\x02<=\x07#\x02\x02=\x16\x03\x02\x02\x02>@\t\x04\x02\x02?>\x03\x02\x02" + | ||
"\x02@A\x03\x02\x02\x02A?\x03\x02\x02\x02AB\x03\x02\x02\x02B\x18\x03\x02" + | ||
"\x02\x02CD\x07=\x02\x02D\x1A\x03\x02\x02\x02EG\t\x05\x02\x02FE\x03\x02" + | ||
"\x02\x02GH\x03\x02\x02\x02HF\x03\x02\x02\x02HI\x03\x02\x02\x02IJ\x03\x02" + | ||
"\x02\x02JK\b\x0E\x03\x02K\x1C\x03\x02\x02\x02LV\x05\x03\x02\x02MW\x05" + | ||
"\x03\x02\x02NP\v\x02\x02\x02ON\x03\x02\x02\x02PS\x03\x02\x02\x02QR\x03" + | ||
"\x02\x02\x02QO\x03\x02\x02\x02RT\x03\x02\x02\x02SQ\x03\x02\x02\x02TU\n" + | ||
"\x06\x02\x02UW\x05\x03\x02\x02VM\x03\x02\x02\x02VQ\x03\x02\x02\x02W\x1E" + | ||
"\x03\x02\x02\x02\t\x02%:AHQV\x04\t\x03\x02\b\x02\x02"; | ||
public static __ATN: ATN; | ||
@@ -125,0 +130,0 @@ public static get _ATN(): ATN { |
@@ -38,10 +38,11 @@ // Generated from src/loader/typescript/grammar/QueryParser.g4 by ANTLR 4.9.0-SNAPSHOT | ||
public static readonly WORD = 7; | ||
public static readonly SPECIAL = 8; | ||
public static readonly EOF_STATEMENT = 9; | ||
public static readonly WSL = 10; | ||
public static readonly STRING = 11; | ||
public static readonly REQUIRED_MARK = 8; | ||
public static readonly SPECIAL = 9; | ||
public static readonly EOF_STATEMENT = 10; | ||
public static readonly WSL = 11; | ||
public static readonly STRING = 12; | ||
public static readonly RULE_input = 0; | ||
public static readonly RULE_query = 1; | ||
public static readonly RULE_ignored = 2; | ||
public static readonly RULE_param = 3; | ||
public static readonly RULE_param = 2; | ||
public static readonly RULE_ignored = 3; | ||
public static readonly RULE_scalarParam = 4; | ||
@@ -51,17 +52,19 @@ public static readonly RULE_pickParam = 5; | ||
public static readonly RULE_arrayParam = 7; | ||
public static readonly RULE_paramName = 8; | ||
public static readonly RULE_pickKey = 9; | ||
public static readonly RULE_scalarParamName = 8; | ||
public static readonly RULE_paramName = 9; | ||
public static readonly RULE_pickKey = 10; | ||
// tslint:disable:no-trailing-whitespace | ||
public static readonly ruleNames: string[] = [ | ||
"input", "query", "ignored", "param", "scalarParam", "pickParam", "arrayPickParam", | ||
"arrayParam", "paramName", "pickKey", | ||
"input", "query", "param", "ignored", "scalarParam", "pickParam", "arrayPickParam", | ||
"arrayParam", "scalarParamName", "paramName", "pickKey", | ||
]; | ||
private static readonly _LITERAL_NAMES: Array<string | undefined> = [ | ||
undefined, undefined, "'$'", "'$$'", "','", "'('", "')'", undefined, undefined, | ||
"';'", | ||
undefined, undefined, "'$'", "'$$'", "','", "'('", "')'", undefined, "'!'", | ||
undefined, "';'", | ||
]; | ||
private static readonly _SYMBOLIC_NAMES: Array<string | undefined> = [ | ||
undefined, "ID", "SINGULAR_PARAM_MARK", "PLURAL_PARAM_MARK", "COMMA", | ||
"OB", "CB", "WORD", "SPECIAL", "EOF_STATEMENT", "WSL", "STRING", | ||
"OB", "CB", "WORD", "REQUIRED_MARK", "SPECIAL", "EOF_STATEMENT", "WSL", | ||
"STRING", | ||
]; | ||
@@ -102,5 +105,5 @@ public static readonly VOCABULARY: Vocabulary = new VocabularyImpl(QueryParser._LITERAL_NAMES, QueryParser._SYMBOLIC_NAMES, []); | ||
{ | ||
this.state = 20; | ||
this.state = 22; | ||
this.query(); | ||
this.state = 22; | ||
this.state = 24; | ||
this._errHandler.sync(this); | ||
@@ -110,3 +113,3 @@ _la = this._input.LA(1); | ||
{ | ||
this.state = 21; | ||
this.state = 23; | ||
this.match(QueryParser.EOF_STATEMENT); | ||
@@ -116,3 +119,3 @@ } | ||
this.state = 24; | ||
this.state = 26; | ||
this.match(QueryParser.EOF); | ||
@@ -143,3 +146,3 @@ } | ||
{ | ||
this.state = 27; | ||
this.state = 29; | ||
this._errHandler.sync(this); | ||
@@ -150,11 +153,11 @@ _la = this._input.LA(1); | ||
{ | ||
this.state = 26; | ||
this.state = 28; | ||
this.ignored(); | ||
} | ||
} | ||
this.state = 29; | ||
this.state = 31; | ||
this._errHandler.sync(this); | ||
_la = this._input.LA(1); | ||
} while ((((_la) & ~0x1F) === 0 && ((1 << _la) & ((1 << QueryParser.ID) | (1 << QueryParser.COMMA) | (1 << QueryParser.OB) | (1 << QueryParser.CB) | (1 << QueryParser.WORD) | (1 << QueryParser.SPECIAL) | (1 << QueryParser.STRING))) !== 0)); | ||
this.state = 40; | ||
} while ((((_la) & ~0x1F) === 0 && ((1 << _la) & ((1 << QueryParser.ID) | (1 << QueryParser.COMMA) | (1 << QueryParser.OB) | (1 << QueryParser.CB) | (1 << QueryParser.WORD) | (1 << QueryParser.REQUIRED_MARK) | (1 << QueryParser.SPECIAL) | (1 << QueryParser.STRING))) !== 0)); | ||
this.state = 42; | ||
this._errHandler.sync(this); | ||
@@ -165,15 +168,15 @@ _la = this._input.LA(1); | ||
{ | ||
this.state = 31; | ||
this.state = 33; | ||
this.param(); | ||
this.state = 35; | ||
this.state = 37; | ||
this._errHandler.sync(this); | ||
_la = this._input.LA(1); | ||
while ((((_la) & ~0x1F) === 0 && ((1 << _la) & ((1 << QueryParser.ID) | (1 << QueryParser.COMMA) | (1 << QueryParser.OB) | (1 << QueryParser.CB) | (1 << QueryParser.WORD) | (1 << QueryParser.SPECIAL) | (1 << QueryParser.STRING))) !== 0)) { | ||
while ((((_la) & ~0x1F) === 0 && ((1 << _la) & ((1 << QueryParser.ID) | (1 << QueryParser.COMMA) | (1 << QueryParser.OB) | (1 << QueryParser.CB) | (1 << QueryParser.WORD) | (1 << QueryParser.REQUIRED_MARK) | (1 << QueryParser.SPECIAL) | (1 << QueryParser.STRING))) !== 0)) { | ||
{ | ||
{ | ||
this.state = 32; | ||
this.state = 34; | ||
this.ignored(); | ||
} | ||
} | ||
this.state = 37; | ||
this.state = 39; | ||
this._errHandler.sync(this); | ||
@@ -184,3 +187,3 @@ _la = this._input.LA(1); | ||
} | ||
this.state = 42; | ||
this.state = 44; | ||
this._errHandler.sync(this); | ||
@@ -206,5 +209,60 @@ _la = this._input.LA(1); | ||
// @RuleVersion(0) | ||
public param(): ParamContext { | ||
let _localctx: ParamContext = new ParamContext(this._ctx, this.state); | ||
this.enterRule(_localctx, 4, QueryParser.RULE_param); | ||
try { | ||
this.state = 49; | ||
this._errHandler.sync(this); | ||
switch ( this.interpreter.adaptivePredict(this._input, 4, this._ctx) ) { | ||
case 1: | ||
this.enterOuterAlt(_localctx, 1); | ||
{ | ||
this.state = 45; | ||
this.pickParam(); | ||
} | ||
break; | ||
case 2: | ||
this.enterOuterAlt(_localctx, 2); | ||
{ | ||
this.state = 46; | ||
this.arrayPickParam(); | ||
} | ||
break; | ||
case 3: | ||
this.enterOuterAlt(_localctx, 3); | ||
{ | ||
this.state = 47; | ||
this.scalarParam(); | ||
} | ||
break; | ||
case 4: | ||
this.enterOuterAlt(_localctx, 4); | ||
{ | ||
this.state = 48; | ||
this.arrayParam(); | ||
} | ||
break; | ||
} | ||
} | ||
catch (re) { | ||
if (re instanceof RecognitionException) { | ||
_localctx.exception = re; | ||
this._errHandler.reportError(this, re); | ||
this._errHandler.recover(this, re); | ||
} else { | ||
throw re; | ||
} | ||
} | ||
finally { | ||
this.exitRule(); | ||
} | ||
return _localctx; | ||
} | ||
// @RuleVersion(0) | ||
public ignored(): IgnoredContext { | ||
let _localctx: IgnoredContext = new IgnoredContext(this._ctx, this.state); | ||
this.enterRule(_localctx, 4, QueryParser.RULE_ignored); | ||
this.enterRule(_localctx, 6, QueryParser.RULE_ignored); | ||
let _la: number; | ||
@@ -215,3 +273,3 @@ try { | ||
{ | ||
this.state = 44; | ||
this.state = 52; | ||
this._errHandler.sync(this); | ||
@@ -224,5 +282,5 @@ _alt = 1; | ||
{ | ||
this.state = 43; | ||
this.state = 51; | ||
_la = this._input.LA(1); | ||
if (!((((_la) & ~0x1F) === 0 && ((1 << _la) & ((1 << QueryParser.ID) | (1 << QueryParser.COMMA) | (1 << QueryParser.OB) | (1 << QueryParser.CB) | (1 << QueryParser.WORD) | (1 << QueryParser.SPECIAL) | (1 << QueryParser.STRING))) !== 0))) { | ||
if (!((((_la) & ~0x1F) === 0 && ((1 << _la) & ((1 << QueryParser.ID) | (1 << QueryParser.COMMA) | (1 << QueryParser.OB) | (1 << QueryParser.CB) | (1 << QueryParser.WORD) | (1 << QueryParser.REQUIRED_MARK) | (1 << QueryParser.SPECIAL) | (1 << QueryParser.STRING))) !== 0))) { | ||
this._errHandler.recoverInline(this); | ||
@@ -243,5 +301,5 @@ } else { | ||
} | ||
this.state = 46; | ||
this.state = 54; | ||
this._errHandler.sync(this); | ||
_alt = this.interpreter.adaptivePredict(this._input, 4, this._ctx); | ||
_alt = this.interpreter.adaptivePredict(this._input, 5, this._ctx); | ||
} while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER); | ||
@@ -265,57 +323,2 @@ } | ||
// @RuleVersion(0) | ||
public param(): ParamContext { | ||
let _localctx: ParamContext = new ParamContext(this._ctx, this.state); | ||
this.enterRule(_localctx, 6, QueryParser.RULE_param); | ||
try { | ||
this.state = 52; | ||
this._errHandler.sync(this); | ||
switch ( this.interpreter.adaptivePredict(this._input, 5, this._ctx) ) { | ||
case 1: | ||
this.enterOuterAlt(_localctx, 1); | ||
{ | ||
this.state = 48; | ||
this.pickParam(); | ||
} | ||
break; | ||
case 2: | ||
this.enterOuterAlt(_localctx, 2); | ||
{ | ||
this.state = 49; | ||
this.arrayPickParam(); | ||
} | ||
break; | ||
case 3: | ||
this.enterOuterAlt(_localctx, 3); | ||
{ | ||
this.state = 50; | ||
this.scalarParam(); | ||
} | ||
break; | ||
case 4: | ||
this.enterOuterAlt(_localctx, 4); | ||
{ | ||
this.state = 51; | ||
this.arrayParam(); | ||
} | ||
break; | ||
} | ||
} | ||
catch (re) { | ||
if (re instanceof RecognitionException) { | ||
_localctx.exception = re; | ||
this._errHandler.reportError(this, re); | ||
this._errHandler.recover(this, re); | ||
} else { | ||
throw re; | ||
} | ||
} | ||
finally { | ||
this.exitRule(); | ||
} | ||
return _localctx; | ||
} | ||
// @RuleVersion(0) | ||
public scalarParam(): ScalarParamContext { | ||
@@ -327,6 +330,6 @@ let _localctx: ScalarParamContext = new ScalarParamContext(this._ctx, this.state); | ||
{ | ||
this.state = 54; | ||
this.state = 56; | ||
this.match(QueryParser.SINGULAR_PARAM_MARK); | ||
this.state = 55; | ||
this.paramName(); | ||
this.state = 57; | ||
this.scalarParamName(); | ||
} | ||
@@ -357,11 +360,11 @@ } | ||
{ | ||
this.state = 57; | ||
this.state = 59; | ||
this.match(QueryParser.SINGULAR_PARAM_MARK); | ||
this.state = 58; | ||
this.state = 60; | ||
this.paramName(); | ||
this.state = 59; | ||
this.state = 61; | ||
this.match(QueryParser.OB); | ||
this.state = 60; | ||
this.state = 62; | ||
this.pickKey(); | ||
this.state = 65; | ||
this.state = 67; | ||
this._errHandler.sync(this); | ||
@@ -373,5 +376,5 @@ _alt = this.interpreter.adaptivePredict(this._input, 6, this._ctx); | ||
{ | ||
this.state = 61; | ||
this.state = 63; | ||
this.match(QueryParser.COMMA); | ||
this.state = 62; | ||
this.state = 64; | ||
this.pickKey(); | ||
@@ -381,7 +384,7 @@ } | ||
} | ||
this.state = 67; | ||
this.state = 69; | ||
this._errHandler.sync(this); | ||
_alt = this.interpreter.adaptivePredict(this._input, 6, this._ctx); | ||
} | ||
this.state = 69; | ||
this.state = 71; | ||
this._errHandler.sync(this); | ||
@@ -391,3 +394,3 @@ _la = this._input.LA(1); | ||
{ | ||
this.state = 68; | ||
this.state = 70; | ||
this.match(QueryParser.COMMA); | ||
@@ -397,3 +400,3 @@ } | ||
this.state = 71; | ||
this.state = 73; | ||
this.match(QueryParser.CB); | ||
@@ -425,11 +428,11 @@ } | ||
{ | ||
this.state = 73; | ||
this.state = 75; | ||
this.match(QueryParser.PLURAL_PARAM_MARK); | ||
this.state = 74; | ||
this.state = 76; | ||
this.paramName(); | ||
this.state = 75; | ||
this.state = 77; | ||
this.match(QueryParser.OB); | ||
this.state = 76; | ||
this.state = 78; | ||
this.pickKey(); | ||
this.state = 81; | ||
this.state = 83; | ||
this._errHandler.sync(this); | ||
@@ -441,5 +444,5 @@ _alt = this.interpreter.adaptivePredict(this._input, 8, this._ctx); | ||
{ | ||
this.state = 77; | ||
this.state = 79; | ||
this.match(QueryParser.COMMA); | ||
this.state = 78; | ||
this.state = 80; | ||
this.pickKey(); | ||
@@ -449,7 +452,7 @@ } | ||
} | ||
this.state = 83; | ||
this.state = 85; | ||
this._errHandler.sync(this); | ||
_alt = this.interpreter.adaptivePredict(this._input, 8, this._ctx); | ||
} | ||
this.state = 85; | ||
this.state = 87; | ||
this._errHandler.sync(this); | ||
@@ -459,3 +462,3 @@ _la = this._input.LA(1); | ||
{ | ||
this.state = 84; | ||
this.state = 86; | ||
this.match(QueryParser.COMMA); | ||
@@ -465,3 +468,3 @@ } | ||
this.state = 87; | ||
this.state = 89; | ||
this.match(QueryParser.CB); | ||
@@ -491,6 +494,6 @@ } | ||
{ | ||
this.state = 89; | ||
this.state = 91; | ||
this.match(QueryParser.PLURAL_PARAM_MARK); | ||
this.state = 90; | ||
this.paramName(); | ||
this.state = 92; | ||
this.scalarParamName(); | ||
} | ||
@@ -513,9 +516,44 @@ } | ||
// @RuleVersion(0) | ||
public scalarParamName(): ScalarParamNameContext { | ||
let _localctx: ScalarParamNameContext = new ScalarParamNameContext(this._ctx, this.state); | ||
this.enterRule(_localctx, 16, QueryParser.RULE_scalarParamName); | ||
try { | ||
this.enterOuterAlt(_localctx, 1); | ||
{ | ||
this.state = 94; | ||
this.match(QueryParser.ID); | ||
this.state = 96; | ||
this._errHandler.sync(this); | ||
switch ( this.interpreter.adaptivePredict(this._input, 10, this._ctx) ) { | ||
case 1: | ||
{ | ||
this.state = 95; | ||
this.match(QueryParser.REQUIRED_MARK); | ||
} | ||
break; | ||
} | ||
} | ||
} | ||
catch (re) { | ||
if (re instanceof RecognitionException) { | ||
_localctx.exception = re; | ||
this._errHandler.reportError(this, re); | ||
this._errHandler.recover(this, re); | ||
} else { | ||
throw re; | ||
} | ||
} | ||
finally { | ||
this.exitRule(); | ||
} | ||
return _localctx; | ||
} | ||
// @RuleVersion(0) | ||
public paramName(): ParamNameContext { | ||
let _localctx: ParamNameContext = new ParamNameContext(this._ctx, this.state); | ||
this.enterRule(_localctx, 16, QueryParser.RULE_paramName); | ||
this.enterRule(_localctx, 18, QueryParser.RULE_paramName); | ||
try { | ||
this.enterOuterAlt(_localctx, 1); | ||
{ | ||
this.state = 92; | ||
this.state = 98; | ||
this.match(QueryParser.ID); | ||
@@ -541,9 +579,20 @@ } | ||
let _localctx: PickKeyContext = new PickKeyContext(this._ctx, this.state); | ||
this.enterRule(_localctx, 18, QueryParser.RULE_pickKey); | ||
this.enterRule(_localctx, 20, QueryParser.RULE_pickKey); | ||
let _la: number; | ||
try { | ||
this.enterOuterAlt(_localctx, 1); | ||
{ | ||
this.state = 94; | ||
this.state = 100; | ||
this.match(QueryParser.ID); | ||
this.state = 102; | ||
this._errHandler.sync(this); | ||
_la = this._input.LA(1); | ||
if (_la === QueryParser.REQUIRED_MARK) { | ||
{ | ||
this.state = 101; | ||
this.match(QueryParser.REQUIRED_MARK); | ||
} | ||
} | ||
} | ||
} | ||
@@ -566,41 +615,44 @@ catch (re) { | ||
public static readonly _serializedATN: string = | ||
"\x03\uC91D\uCABA\u058D\uAFBA\u4F53\u0607\uEA8B\uC241\x03\rc\x04\x02\t" + | ||
"\x02\x04\x03\t\x03\x04\x04\t\x04\x04\x05\t\x05\x04\x06\t\x06\x04\x07\t" + | ||
"\x07\x04\b\t\b\x04\t\t\t\x04\n\t\n\x04\v\t\v\x03\x02\x03\x02\x05\x02\x19" + | ||
"\n\x02\x03\x02\x03\x02\x03\x03\x06\x03\x1E\n\x03\r\x03\x0E\x03\x1F\x03" + | ||
"\x03\x03\x03\x07\x03$\n\x03\f\x03\x0E\x03\'\v\x03\x07\x03)\n\x03\f\x03" + | ||
"\x0E\x03,\v\x03\x03\x04\x06\x04/\n\x04\r\x04\x0E\x040\x03\x05\x03\x05" + | ||
"\x03\x05\x03\x05\x05\x057\n\x05\x03\x06\x03\x06\x03\x06\x03\x07\x03\x07" + | ||
"\x03\x07\x03\x07\x03\x07\x03\x07\x07\x07B\n\x07\f\x07\x0E\x07E\v\x07\x03" + | ||
"\x07\x05\x07H\n\x07\x03\x07\x03\x07\x03\b\x03\b\x03\b\x03\b\x03\b\x03" + | ||
"\b\x07\bR\n\b\f\b\x0E\bU\v\b\x03\b\x05\bX\n\b\x03\b\x03\b\x03\t\x03\t" + | ||
"\x03\t\x03\n\x03\n\x03\v\x03\v\x03\v\x02\x02\x02\f\x02\x02\x04\x02\x06" + | ||
"\x02\b\x02\n\x02\f\x02\x0E\x02\x10\x02\x12\x02\x14\x02\x02\x03\x05\x02" + | ||
"\x03\x03\x06\n\r\r\x02d\x02\x16\x03\x02\x02\x02\x04\x1D\x03\x02\x02\x02" + | ||
"\x06.\x03\x02\x02\x02\b6\x03\x02\x02\x02\n8\x03\x02\x02\x02\f;\x03\x02" + | ||
"\x02\x02\x0EK\x03\x02\x02\x02\x10[\x03\x02\x02\x02\x12^\x03\x02\x02\x02" + | ||
"\x14`\x03\x02\x02\x02\x16\x18\x05\x04\x03\x02\x17\x19\x07\v\x02\x02\x18" + | ||
"\x17\x03\x02\x02\x02\x18\x19\x03\x02\x02\x02\x19\x1A\x03\x02\x02\x02\x1A" + | ||
"\x1B\x07\x02\x02\x03\x1B\x03\x03\x02\x02\x02\x1C\x1E\x05\x06\x04\x02\x1D" + | ||
"\x1C\x03\x02\x02\x02\x1E\x1F\x03\x02\x02\x02\x1F\x1D\x03\x02\x02\x02\x1F" + | ||
" \x03\x02\x02\x02 *\x03\x02\x02\x02!%\x05\b\x05\x02\"$\x05\x06\x04\x02" + | ||
"#\"\x03\x02\x02\x02$\'\x03\x02\x02\x02%#\x03\x02\x02\x02%&\x03\x02\x02" + | ||
"\x02&)\x03\x02\x02\x02\'%\x03\x02\x02\x02(!\x03\x02\x02\x02),\x03\x02" + | ||
"\x02\x02*(\x03\x02\x02\x02*+\x03\x02\x02\x02+\x05\x03\x02\x02\x02,*\x03" + | ||
"\x02\x02\x02-/\t\x02\x02\x02.-\x03\x02\x02\x02/0\x03\x02\x02\x020.\x03" + | ||
"\x02\x02\x0201\x03\x02\x02\x021\x07\x03\x02\x02\x0227\x05\f\x07\x0237" + | ||
"\x05\x0E\b\x0247\x05\n\x06\x0257\x05\x10\t\x0262\x03\x02\x02\x0263\x03" + | ||
"\x02\x02\x0264\x03\x02\x02\x0265\x03\x02\x02\x027\t\x03\x02\x02\x0289" + | ||
"\x07\x04\x02\x029:\x05\x12\n\x02:\v\x03\x02\x02\x02;<\x07\x04\x02\x02" + | ||
"<=\x05\x12\n\x02=>\x07\x07\x02\x02>C\x05\x14\v\x02?@\x07\x06\x02\x02@" + | ||
"B\x05\x14\v\x02A?\x03\x02\x02\x02BE\x03\x02\x02\x02CA\x03\x02\x02\x02" + | ||
"CD\x03\x02\x02\x02DG\x03\x02\x02\x02EC\x03\x02\x02\x02FH\x07\x06\x02\x02" + | ||
"GF\x03\x02\x02\x02GH\x03\x02\x02\x02HI\x03\x02\x02\x02IJ\x07\b\x02\x02" + | ||
"J\r\x03\x02\x02\x02KL\x07\x05\x02\x02LM\x05\x12\n\x02MN\x07\x07\x02\x02" + | ||
"NS\x05\x14\v\x02OP\x07\x06\x02\x02PR\x05\x14\v\x02QO\x03\x02\x02\x02R" + | ||
"U\x03\x02\x02\x02SQ\x03\x02\x02\x02ST\x03\x02\x02\x02TW\x03\x02\x02\x02" + | ||
"US\x03\x02\x02\x02VX\x07\x06\x02\x02WV\x03\x02\x02\x02WX\x03\x02\x02\x02" + | ||
"XY\x03\x02\x02\x02YZ\x07\b\x02\x02Z\x0F\x03\x02\x02\x02[\\\x07\x05\x02" + | ||
"\x02\\]\x05\x12\n\x02]\x11\x03\x02\x02\x02^_\x07\x03\x02\x02_\x13\x03" + | ||
"\x02\x02\x02`a\x07\x03\x02\x02a\x15\x03\x02\x02\x02\f\x18\x1F%*06CGSW"; | ||
"\x03\uC91D\uCABA\u058D\uAFBA\u4F53\u0607\uEA8B\uC241\x03\x0Ek\x04\x02" + | ||
"\t\x02\x04\x03\t\x03\x04\x04\t\x04\x04\x05\t\x05\x04\x06\t\x06\x04\x07" + | ||
"\t\x07\x04\b\t\b\x04\t\t\t\x04\n\t\n\x04\v\t\v\x04\f\t\f\x03\x02\x03\x02" + | ||
"\x05\x02\x1B\n\x02\x03\x02\x03\x02\x03\x03\x06\x03 \n\x03\r\x03\x0E\x03" + | ||
"!\x03\x03\x03\x03\x07\x03&\n\x03\f\x03\x0E\x03)\v\x03\x07\x03+\n\x03\f" + | ||
"\x03\x0E\x03.\v\x03\x03\x04\x03\x04\x03\x04\x03\x04\x05\x044\n\x04\x03" + | ||
"\x05\x06\x057\n\x05\r\x05\x0E\x058\x03\x06\x03\x06\x03\x06\x03\x07\x03" + | ||
"\x07\x03\x07\x03\x07\x03\x07\x03\x07\x07\x07D\n\x07\f\x07\x0E\x07G\v\x07" + | ||
"\x03\x07\x05\x07J\n\x07\x03\x07\x03\x07\x03\b\x03\b\x03\b\x03\b\x03\b" + | ||
"\x03\b\x07\bT\n\b\f\b\x0E\bW\v\b\x03\b\x05\bZ\n\b\x03\b\x03\b\x03\t\x03" + | ||
"\t\x03\t\x03\n\x03\n\x05\nc\n\n\x03\v\x03\v\x03\f\x03\f\x05\fi\n\f\x03" + | ||
"\f\x02\x02\x02\r\x02\x02\x04\x02\x06\x02\b\x02\n\x02\f\x02\x0E\x02\x10" + | ||
"\x02\x12\x02\x14\x02\x16\x02\x02\x03\x05\x02\x03\x03\x06\v\x0E\x0E\x02" + | ||
"m\x02\x18\x03\x02\x02\x02\x04\x1F\x03\x02\x02\x02\x063\x03\x02\x02\x02" + | ||
"\b6\x03\x02\x02\x02\n:\x03\x02\x02\x02\f=\x03\x02\x02\x02\x0EM\x03\x02" + | ||
"\x02\x02\x10]\x03\x02\x02\x02\x12`\x03\x02\x02\x02\x14d\x03\x02\x02\x02" + | ||
"\x16f\x03\x02\x02\x02\x18\x1A\x05\x04\x03\x02\x19\x1B\x07\f\x02\x02\x1A" + | ||
"\x19\x03\x02\x02\x02\x1A\x1B\x03\x02\x02\x02\x1B\x1C\x03\x02\x02\x02\x1C" + | ||
"\x1D\x07\x02\x02\x03\x1D\x03\x03\x02\x02\x02\x1E \x05\b\x05\x02\x1F\x1E" + | ||
"\x03\x02\x02\x02 !\x03\x02\x02\x02!\x1F\x03\x02\x02\x02!\"\x03\x02\x02" + | ||
"\x02\",\x03\x02\x02\x02#\'\x05\x06\x04\x02$&\x05\b\x05\x02%$\x03\x02\x02" + | ||
"\x02&)\x03\x02\x02\x02\'%\x03\x02\x02\x02\'(\x03\x02\x02\x02(+\x03\x02" + | ||
"\x02\x02)\'\x03\x02\x02\x02*#\x03\x02\x02\x02+.\x03\x02\x02\x02,*\x03" + | ||
"\x02\x02\x02,-\x03\x02\x02\x02-\x05\x03\x02\x02\x02.,\x03\x02\x02\x02" + | ||
"/4\x05\f\x07\x0204\x05\x0E\b\x0214\x05\n\x06\x0224\x05\x10\t\x023/\x03" + | ||
"\x02\x02\x0230\x03\x02\x02\x0231\x03\x02\x02\x0232\x03\x02\x02\x024\x07" + | ||
"\x03\x02\x02\x0257\t\x02\x02\x0265\x03\x02\x02\x0278\x03\x02\x02\x028" + | ||
"6\x03\x02\x02\x0289\x03\x02\x02\x029\t\x03\x02\x02\x02:;\x07\x04\x02\x02" + | ||
";<\x05\x12\n\x02<\v\x03\x02\x02\x02=>\x07\x04\x02\x02>?\x05\x14\v\x02" + | ||
"?@\x07\x07\x02\x02@E\x05\x16\f\x02AB\x07\x06\x02\x02BD\x05\x16\f\x02C" + | ||
"A\x03\x02\x02\x02DG\x03\x02\x02\x02EC\x03\x02\x02\x02EF\x03\x02\x02\x02" + | ||
"FI\x03\x02\x02\x02GE\x03\x02\x02\x02HJ\x07\x06\x02\x02IH\x03\x02\x02\x02" + | ||
"IJ\x03\x02\x02\x02JK\x03\x02\x02\x02KL\x07\b\x02\x02L\r\x03\x02\x02\x02" + | ||
"MN\x07\x05\x02\x02NO\x05\x14\v\x02OP\x07\x07\x02\x02PU\x05\x16\f\x02Q" + | ||
"R\x07\x06\x02\x02RT\x05\x16\f\x02SQ\x03\x02\x02\x02TW\x03\x02\x02\x02" + | ||
"US\x03\x02\x02\x02UV\x03\x02\x02\x02VY\x03\x02\x02\x02WU\x03\x02\x02\x02" + | ||
"XZ\x07\x06\x02\x02YX\x03\x02\x02\x02YZ\x03\x02\x02\x02Z[\x03\x02\x02\x02" + | ||
"[\\\x07\b\x02\x02\\\x0F\x03\x02\x02\x02]^\x07\x05\x02\x02^_\x05\x12\n" + | ||
"\x02_\x11\x03\x02\x02\x02`b\x07\x03\x02\x02ac\x07\n\x02\x02ba\x03\x02" + | ||
"\x02\x02bc\x03\x02\x02\x02c\x13\x03\x02\x02\x02de\x07\x03\x02\x02e\x15" + | ||
"\x03\x02\x02\x02fh\x07\x03\x02\x02gi\x07\n\x02\x02hg\x03\x02\x02\x02h" + | ||
"i\x03\x02\x02\x02i\x17\x03\x02\x02\x02\x0E\x1A!\',38EIUYbh"; | ||
public static __ATN: ATN; | ||
@@ -698,2 +750,43 @@ public static get _ATN(): ATN { | ||
export class ParamContext extends ParserRuleContext { | ||
public pickParam(): PickParamContext | undefined { | ||
return this.tryGetRuleContext(0, PickParamContext); | ||
} | ||
public arrayPickParam(): ArrayPickParamContext | undefined { | ||
return this.tryGetRuleContext(0, ArrayPickParamContext); | ||
} | ||
public scalarParam(): ScalarParamContext | undefined { | ||
return this.tryGetRuleContext(0, ScalarParamContext); | ||
} | ||
public arrayParam(): ArrayParamContext | undefined { | ||
return this.tryGetRuleContext(0, ArrayParamContext); | ||
} | ||
constructor(parent: ParserRuleContext | undefined, invokingState: number) { | ||
super(parent, invokingState); | ||
} | ||
// @Override | ||
public get ruleIndex(): number { return QueryParser.RULE_param; } | ||
// @Override | ||
public enterRule(listener: QueryParserListener): void { | ||
if (listener.enterParam) { | ||
listener.enterParam(this); | ||
} | ||
} | ||
// @Override | ||
public exitRule(listener: QueryParserListener): void { | ||
if (listener.exitParam) { | ||
listener.exitParam(this); | ||
} | ||
} | ||
// @Override | ||
public accept<Result>(visitor: QueryParserVisitor<Result>): Result { | ||
if (visitor.visitParam) { | ||
return visitor.visitParam(this); | ||
} else { | ||
return visitor.visitChildren(this); | ||
} | ||
} | ||
} | ||
export class IgnoredContext extends ParserRuleContext { | ||
@@ -763,2 +856,11 @@ public ID(): TerminalNode[]; | ||
} | ||
public REQUIRED_MARK(): TerminalNode[]; | ||
public REQUIRED_MARK(i: number): TerminalNode; | ||
public REQUIRED_MARK(i?: number): TerminalNode | TerminalNode[] { | ||
if (i === undefined) { | ||
return this.getTokens(QueryParser.REQUIRED_MARK); | ||
} else { | ||
return this.getToken(QueryParser.REQUIRED_MARK, i); | ||
} | ||
} | ||
constructor(parent: ParserRuleContext | undefined, invokingState: number) { | ||
@@ -792,47 +894,6 @@ super(parent, invokingState); | ||
export class ParamContext extends ParserRuleContext { | ||
public pickParam(): PickParamContext | undefined { | ||
return this.tryGetRuleContext(0, PickParamContext); | ||
} | ||
public arrayPickParam(): ArrayPickParamContext | undefined { | ||
return this.tryGetRuleContext(0, ArrayPickParamContext); | ||
} | ||
public scalarParam(): ScalarParamContext | undefined { | ||
return this.tryGetRuleContext(0, ScalarParamContext); | ||
} | ||
public arrayParam(): ArrayParamContext | undefined { | ||
return this.tryGetRuleContext(0, ArrayParamContext); | ||
} | ||
constructor(parent: ParserRuleContext | undefined, invokingState: number) { | ||
super(parent, invokingState); | ||
} | ||
// @Override | ||
public get ruleIndex(): number { return QueryParser.RULE_param; } | ||
// @Override | ||
public enterRule(listener: QueryParserListener): void { | ||
if (listener.enterParam) { | ||
listener.enterParam(this); | ||
} | ||
} | ||
// @Override | ||
public exitRule(listener: QueryParserListener): void { | ||
if (listener.exitParam) { | ||
listener.exitParam(this); | ||
} | ||
} | ||
// @Override | ||
public accept<Result>(visitor: QueryParserVisitor<Result>): Result { | ||
if (visitor.visitParam) { | ||
return visitor.visitParam(this); | ||
} else { | ||
return visitor.visitChildren(this); | ||
} | ||
} | ||
} | ||
export class ScalarParamContext extends ParserRuleContext { | ||
public SINGULAR_PARAM_MARK(): TerminalNode { return this.getToken(QueryParser.SINGULAR_PARAM_MARK, 0); } | ||
public paramName(): ParamNameContext { | ||
return this.getRuleContext(0, ParamNameContext); | ||
public scalarParamName(): ScalarParamNameContext { | ||
return this.getRuleContext(0, ScalarParamNameContext); | ||
} | ||
@@ -975,4 +1036,4 @@ constructor(parent: ParserRuleContext | undefined, invokingState: number) { | ||
public PLURAL_PARAM_MARK(): TerminalNode { return this.getToken(QueryParser.PLURAL_PARAM_MARK, 0); } | ||
public paramName(): ParamNameContext { | ||
return this.getRuleContext(0, ParamNameContext); | ||
public scalarParamName(): ScalarParamNameContext { | ||
return this.getRuleContext(0, ScalarParamNameContext); | ||
} | ||
@@ -1007,2 +1068,33 @@ constructor(parent: ParserRuleContext | undefined, invokingState: number) { | ||
export class ScalarParamNameContext extends ParserRuleContext { | ||
public ID(): TerminalNode { return this.getToken(QueryParser.ID, 0); } | ||
public REQUIRED_MARK(): TerminalNode | undefined { return this.tryGetToken(QueryParser.REQUIRED_MARK, 0); } | ||
constructor(parent: ParserRuleContext | undefined, invokingState: number) { | ||
super(parent, invokingState); | ||
} | ||
// @Override | ||
public get ruleIndex(): number { return QueryParser.RULE_scalarParamName; } | ||
// @Override | ||
public enterRule(listener: QueryParserListener): void { | ||
if (listener.enterScalarParamName) { | ||
listener.enterScalarParamName(this); | ||
} | ||
} | ||
// @Override | ||
public exitRule(listener: QueryParserListener): void { | ||
if (listener.exitScalarParamName) { | ||
listener.exitScalarParamName(this); | ||
} | ||
} | ||
// @Override | ||
public accept<Result>(visitor: QueryParserVisitor<Result>): Result { | ||
if (visitor.visitScalarParamName) { | ||
return visitor.visitScalarParamName(this); | ||
} else { | ||
return visitor.visitChildren(this); | ||
} | ||
} | ||
} | ||
export class ParamNameContext extends ParserRuleContext { | ||
@@ -1040,2 +1132,3 @@ public ID(): TerminalNode { return this.getToken(QueryParser.ID, 0); } | ||
public ID(): TerminalNode { return this.getToken(QueryParser.ID, 0); } | ||
public REQUIRED_MARK(): TerminalNode | undefined { return this.tryGetToken(QueryParser.REQUIRED_MARK, 0); } | ||
constructor(parent: ParserRuleContext | undefined, invokingState: number) { | ||
@@ -1042,0 +1135,0 @@ super(parent, invokingState); |
@@ -8,4 +8,4 @@ // Generated from src/loader/typescript/grammar/QueryParser.g4 by ANTLR 4.9.0-SNAPSHOT | ||
import { QueryContext } from "./QueryParser"; | ||
import { ParamContext } from "./QueryParser"; | ||
import { IgnoredContext } from "./QueryParser"; | ||
import { ParamContext } from "./QueryParser"; | ||
import { ScalarParamContext } from "./QueryParser"; | ||
@@ -15,2 +15,3 @@ import { PickParamContext } from "./QueryParser"; | ||
import { ArrayParamContext } from "./QueryParser"; | ||
import { ScalarParamNameContext } from "./QueryParser"; | ||
import { ParamNameContext } from "./QueryParser"; | ||
@@ -48,22 +49,22 @@ import { PickKeyContext } from "./QueryParser"; | ||
/** | ||
* Enter a parse tree produced by `QueryParser.ignored`. | ||
* Enter a parse tree produced by `QueryParser.param`. | ||
* @param ctx the parse tree | ||
*/ | ||
enterIgnored?: (ctx: IgnoredContext) => void; | ||
enterParam?: (ctx: ParamContext) => void; | ||
/** | ||
* Exit a parse tree produced by `QueryParser.ignored`. | ||
* Exit a parse tree produced by `QueryParser.param`. | ||
* @param ctx the parse tree | ||
*/ | ||
exitIgnored?: (ctx: IgnoredContext) => void; | ||
exitParam?: (ctx: ParamContext) => void; | ||
/** | ||
* Enter a parse tree produced by `QueryParser.param`. | ||
* Enter a parse tree produced by `QueryParser.ignored`. | ||
* @param ctx the parse tree | ||
*/ | ||
enterParam?: (ctx: ParamContext) => void; | ||
enterIgnored?: (ctx: IgnoredContext) => void; | ||
/** | ||
* Exit a parse tree produced by `QueryParser.param`. | ||
* Exit a parse tree produced by `QueryParser.ignored`. | ||
* @param ctx the parse tree | ||
*/ | ||
exitParam?: (ctx: ParamContext) => void; | ||
exitIgnored?: (ctx: IgnoredContext) => void; | ||
@@ -115,2 +116,13 @@ /** | ||
/** | ||
* Enter a parse tree produced by `QueryParser.scalarParamName`. | ||
* @param ctx the parse tree | ||
*/ | ||
enterScalarParamName?: (ctx: ScalarParamNameContext) => void; | ||
/** | ||
* Exit a parse tree produced by `QueryParser.scalarParamName`. | ||
* @param ctx the parse tree | ||
*/ | ||
exitScalarParamName?: (ctx: ScalarParamNameContext) => void; | ||
/** | ||
* Enter a parse tree produced by `QueryParser.paramName`. | ||
@@ -117,0 +129,0 @@ * @param ctx the parse tree |
@@ -8,4 +8,4 @@ // Generated from src/loader/typescript/grammar/QueryParser.g4 by ANTLR 4.9.0-SNAPSHOT | ||
import { QueryContext } from "./QueryParser"; | ||
import { ParamContext } from "./QueryParser"; | ||
import { IgnoredContext } from "./QueryParser"; | ||
import { ParamContext } from "./QueryParser"; | ||
import { ScalarParamContext } from "./QueryParser"; | ||
@@ -15,2 +15,3 @@ import { PickParamContext } from "./QueryParser"; | ||
import { ArrayParamContext } from "./QueryParser"; | ||
import { ScalarParamNameContext } from "./QueryParser"; | ||
import { ParamNameContext } from "./QueryParser"; | ||
@@ -43,14 +44,14 @@ import { PickKeyContext } from "./QueryParser"; | ||
/** | ||
* Visit a parse tree produced by `QueryParser.ignored`. | ||
* Visit a parse tree produced by `QueryParser.param`. | ||
* @param ctx the parse tree | ||
* @return the visitor result | ||
*/ | ||
visitIgnored?: (ctx: IgnoredContext) => Result; | ||
visitParam?: (ctx: ParamContext) => Result; | ||
/** | ||
* Visit a parse tree produced by `QueryParser.param`. | ||
* Visit a parse tree produced by `QueryParser.ignored`. | ||
* @param ctx the parse tree | ||
* @return the visitor result | ||
*/ | ||
visitParam?: (ctx: ParamContext) => Result; | ||
visitIgnored?: (ctx: IgnoredContext) => Result; | ||
@@ -86,2 +87,9 @@ /** | ||
/** | ||
* Visit a parse tree produced by `QueryParser.scalarParamName`. | ||
* @param ctx the parse tree | ||
* @return the visitor result | ||
*/ | ||
visitScalarParamName?: (ctx: ScalarParamNameContext) => Result; | ||
/** | ||
* Visit a parse tree produced by `QueryParser.paramName`. | ||
@@ -88,0 +96,0 @@ * @param ctx the parse tree |
@@ -6,2 +6,3 @@ import { QueryParserListener } from './parser/QueryParserListener'; | ||
import { | ||
ArrayParamContext, | ||
ParamContext, | ||
@@ -12,9 +13,5 @@ ParamNameContext, | ||
QueryParser, | ||
ScalarParamNameContext, | ||
} from './parser/QueryParser'; | ||
import { | ||
Logger, | ||
ParseEvent, | ||
ParseEventType, | ||
ParseWarningType, | ||
} from '../sql/logger'; | ||
import { Logger, ParseEvent } from '../sql/logger'; | ||
import { Interval } from 'antlr4ts/misc'; | ||
@@ -29,2 +26,7 @@ | ||
export interface ParamKey { | ||
name: string; | ||
required: boolean; | ||
} | ||
export type ParamSelection = | ||
@@ -39,3 +41,3 @@ | { | ||
type: ParamType.Object | ParamType.ObjectArray; | ||
keys: string[]; | ||
keys: ParamKey[]; | ||
}; | ||
@@ -46,2 +48,3 @@ | ||
selection: ParamSelection; | ||
required: boolean; | ||
location: CodeInterval; | ||
@@ -100,2 +103,12 @@ } | ||
enterScalarParamName(ctx: ScalarParamNameContext) { | ||
const required = !!ctx.REQUIRED_MARK(); | ||
const name = ctx.ID().text; | ||
this.currentParam = { | ||
name, | ||
required, | ||
}; | ||
} | ||
exitParam(ctx: ParamContext) { | ||
@@ -143,3 +156,7 @@ const defLoc = { | ||
assert('keys' in this.currentSelection); | ||
this.currentSelection.keys!.push(ctx.text); | ||
const required = !!ctx.REQUIRED_MARK(); | ||
const name = ctx.ID().text; | ||
this.currentSelection.keys!.push({ name, required }); | ||
} | ||
@@ -152,3 +169,3 @@ } | ||
): { query: Query; events: ParseEvent[] } { | ||
const logger = new Logger(text); | ||
const logger = new Logger(); | ||
const inputStream = CharStreams.fromString(text); | ||
@@ -155,0 +172,0 @@ const lexer = new QueryLexer(inputStream); |
@@ -52,2 +52,3 @@ import parseSQLQuery from './loader/sql'; | ||
name: 'id', | ||
required: false, | ||
type: ParamTransform.Scalar, | ||
@@ -58,2 +59,3 @@ }, | ||
name: 'age', | ||
required: false, | ||
type: ParamTransform.Scalar, | ||
@@ -97,2 +99,3 @@ }, | ||
name: 'id', | ||
required: false, | ||
type: ParamTransform.Scalar, | ||
@@ -140,2 +143,3 @@ }, | ||
type: ParamTransform.Spread, | ||
required: false, | ||
assignedIndex: 1, | ||
@@ -181,2 +185,3 @@ }, | ||
name: 'ages', | ||
required: false, | ||
type: ParamTransform.Spread, | ||
@@ -225,2 +230,3 @@ assignedIndex: 1, | ||
type: ParamTransform.Spread, | ||
required: false, | ||
assignedIndex: 1, | ||
@@ -231,2 +237,3 @@ }, | ||
type: ParamTransform.Scalar, | ||
required: false, | ||
assignedIndex: 2, | ||
@@ -278,2 +285,3 @@ }, | ||
type: ParamTransform.Scalar, | ||
required: false, | ||
}, | ||
@@ -284,2 +292,3 @@ age: { | ||
type: ParamTransform.Scalar, | ||
required: false, | ||
}, | ||
@@ -332,2 +341,3 @@ }, | ||
type: ParamTransform.Scalar, | ||
required: false, | ||
}, | ||
@@ -338,2 +348,3 @@ age: { | ||
type: ParamTransform.Scalar, | ||
required: false, | ||
}, | ||
@@ -385,2 +396,3 @@ }, | ||
type: ParamTransform.Scalar, | ||
required: false, | ||
assignedIndex: 1, | ||
@@ -391,2 +403,3 @@ }, | ||
type: ParamTransform.Scalar, | ||
required: false, | ||
assignedIndex: 2, | ||
@@ -445,2 +458,3 @@ }, | ||
type: ParamTransform.Scalar, | ||
required: false, | ||
assignedIndex: 1, | ||
@@ -451,2 +465,3 @@ }, | ||
type: ParamTransform.Scalar, | ||
required: false, | ||
assignedIndex: 2, | ||
@@ -473,1 +488,136 @@ }, | ||
}); | ||
test('(SQL) scalar param required and optional', () => { | ||
const query = ` | ||
/* @name selectSomeUsers */ | ||
SELECT id, name from users where id = :id! and user_id = :id;`; | ||
const fileAST = parseSQLQuery(query); | ||
const parameters = { | ||
id: '123', | ||
}; | ||
const expectedInterpolationResult = { | ||
query: 'SELECT id, name from users where id = $1 and user_id = $1', | ||
mapping: [], | ||
bindings: ['123'], | ||
}; | ||
const expectedMappingResult = { | ||
query: 'SELECT id, name from users where id = $1 and user_id = $1', | ||
mapping: [ | ||
{ | ||
assignedIndex: 1, | ||
name: 'id', | ||
required: true, | ||
type: ParamTransform.Scalar, | ||
}, | ||
], | ||
bindings: [], | ||
}; | ||
const interpolationResult = processSQLQueryAST( | ||
fileAST.queries[0], | ||
parameters, | ||
); | ||
const mappingResult = processSQLQueryAST(fileAST.queries[0]); | ||
expect(interpolationResult).toEqual(expectedInterpolationResult); | ||
expect(mappingResult).toEqual(expectedMappingResult); | ||
}); | ||
test('(SQL) pick param required', () => { | ||
const query = ` | ||
/* | ||
@name insertUsers | ||
@param user -> (name!, age) | ||
*/ | ||
INSERT INTO users (name, age) VALUES :user RETURNING id;`; | ||
const fileAST = parseSQLQuery(query); | ||
const parameters = { | ||
user: { name: 'Bob', age: 12 }, | ||
}; | ||
const expectedInterpolationResult = { | ||
query: 'INSERT INTO users (name, age) VALUES ($1,$2) RETURNING id', | ||
bindings: ['Bob', 12], | ||
mapping: [], | ||
}; | ||
const expectedMappingResult = { | ||
query: 'INSERT INTO users (name, age) VALUES ($1,$2) RETURNING id', | ||
bindings: [], | ||
mapping: [ | ||
{ | ||
name: 'user', | ||
type: ParamTransform.Pick, | ||
dict: { | ||
name: { | ||
assignedIndex: 1, | ||
name: 'name', | ||
type: ParamTransform.Scalar, | ||
required: true, | ||
}, | ||
age: { | ||
assignedIndex: 2, | ||
name: 'age', | ||
type: ParamTransform.Scalar, | ||
required: false, | ||
}, | ||
}, | ||
}, | ||
], | ||
}; | ||
const interpolationResult = processSQLQueryAST( | ||
fileAST.queries[0], | ||
parameters, | ||
); | ||
expect(interpolationResult).toEqual(expectedInterpolationResult); | ||
const mappingResult = processSQLQueryAST(fileAST.queries[0]); | ||
expect(mappingResult).toEqual(expectedMappingResult); | ||
}); | ||
test('(SQL) array param required', () => { | ||
const query = ` | ||
/* | ||
@name selectSomeUsers | ||
@param ages -> (...) | ||
*/ | ||
SELECT FROM users WHERE age in :ages!;`; | ||
const fileAST = parseSQLQuery(query); | ||
const parameters = { | ||
ages: [23, 27, 50], | ||
}; | ||
const expectedInterpolationResult = { | ||
query: 'SELECT FROM users WHERE age in ($1,$2,$3)', | ||
bindings: [23, 27, 50], | ||
mapping: [], | ||
}; | ||
const expectedMappingResult = { | ||
query: 'SELECT FROM users WHERE age in ($1)', | ||
bindings: [], | ||
mapping: [ | ||
{ | ||
name: 'ages', | ||
type: ParamTransform.Spread, | ||
required: true, | ||
assignedIndex: 1, | ||
}, | ||
], | ||
}; | ||
const interpolationResult = processSQLQueryAST( | ||
fileAST.queries[0], | ||
parameters, | ||
); | ||
const mappingResult = processSQLQueryAST(fileAST.queries[0]); | ||
expect(interpolationResult).toEqual(expectedInterpolationResult); | ||
expect(mappingResult).toEqual(expectedMappingResult); | ||
}); |
@@ -48,2 +48,3 @@ import { assert, SQLQueryAST, TransformType } from './loader/sql'; | ||
assignedIndex: idx, | ||
required: usedParam.required, | ||
} as IScalarArrayParam); | ||
@@ -67,6 +68,7 @@ sub = `$${idx}`; | ||
const sub = usedParam.transform.keys | ||
.map((pickKey) => { | ||
.map(({ name, required }) => { | ||
const idx = i++; | ||
dict[pickKey] = { | ||
name: pickKey, | ||
dict[name] = { | ||
name, | ||
required, | ||
type: ParamTransform.Scalar, | ||
@@ -79,3 +81,3 @@ assignedIndex: idx, | ||
] as INestedParameters; | ||
const val = paramValue[pickKey]; | ||
const val = paramValue[name]; | ||
bindings.push(val); | ||
@@ -112,4 +114,4 @@ } | ||
const ssub = usedParam.transform.keys | ||
.map((pickKey) => { | ||
const val = entity[pickKey]; | ||
.map(({ name }) => { | ||
const val = entity[name]; | ||
bindings.push(val); | ||
@@ -127,6 +129,7 @@ return `$${i++}`; | ||
sub = usedParam.transform.keys | ||
.map((pickKey) => { | ||
.map(({ name, required }) => { | ||
const idx = i++; | ||
dict[pickKey] = { | ||
name: pickKey, | ||
dict[name] = { | ||
name, | ||
required, | ||
type: ParamTransform.Scalar, | ||
@@ -164,2 +167,3 @@ assignedIndex: idx, | ||
assignedIndex, | ||
required: usedParam.required, | ||
} as IScalarParam); | ||
@@ -166,0 +170,0 @@ } |
import { parseTSQuery } from './loader/typescript'; | ||
import { ParamTransform } from './preprocessor'; | ||
import { processTSQueryAST } from './preprocessor-ts'; | ||
import { ParamTransform } from './preprocessor'; | ||
@@ -123,9 +123,2 @@ test('(TS) name parameter interpolation', () => { | ||
const parameters = { | ||
user: { | ||
name: 'Bob', | ||
age: 12, | ||
}, | ||
}; | ||
const expectedResult = { | ||
@@ -142,2 +135,3 @@ query: 'INSERT INTO users (name, age) VALUES ($1, $2) RETURNING id', | ||
type: ParamTransform.Scalar, | ||
required: false, | ||
}, | ||
@@ -148,2 +142,3 @@ age: { | ||
type: ParamTransform.Scalar, | ||
required: false, | ||
}, | ||
@@ -198,2 +193,3 @@ }, | ||
type: ParamTransform.Spread, | ||
required: false, | ||
assignedIndex: [1], | ||
@@ -204,2 +200,3 @@ }, | ||
type: ParamTransform.Spread, | ||
required: false, | ||
assignedIndex: [2], | ||
@@ -252,2 +249,3 @@ }, | ||
type: ParamTransform.Scalar, | ||
required: false, | ||
assignedIndex: 1, | ||
@@ -258,2 +256,3 @@ }, | ||
type: ParamTransform.Scalar, | ||
required: false, | ||
assignedIndex: 2, | ||
@@ -287,2 +286,3 @@ }, | ||
type: ParamTransform.Scalar, | ||
required: false, | ||
assignedIndex: 1, | ||
@@ -293,2 +293,3 @@ }, | ||
type: ParamTransform.Scalar, | ||
required: false, | ||
assignedIndex: 2, | ||
@@ -418,7 +419,7 @@ }, | ||
const query = | ||
'SELECT $userId $age $userId $$users $age $user(id) $$users $user(id, parentId) $$comments(id, text) $user(age)'; | ||
'SELECT $userId $age! $userId $$users $age $user(id) $$users $user(id, parentId, age) $$comments(id!, text) $user(age!)'; | ||
const parsedQuery = parseTSQuery(query); | ||
const expectedResult = { | ||
query: 'SELECT $1 $2 $1 ($3) $2 ($4) ($3) ($4, $5) ($6, $7) ($8)', | ||
query: 'SELECT $1 $2 $1 ($3) $2 ($4) ($3) ($4, $5, $6) ($7, $8) ($6)', | ||
bindings: [], | ||
@@ -429,2 +430,3 @@ mapping: [ | ||
type: ParamTransform.Scalar, | ||
required: false, | ||
assignedIndex: 1, | ||
@@ -435,2 +437,3 @@ }, | ||
type: ParamTransform.Scalar, | ||
required: true, | ||
assignedIndex: 2, | ||
@@ -441,2 +444,3 @@ }, | ||
type: ParamTransform.Spread, | ||
required: false, | ||
assignedIndex: [3], | ||
@@ -451,2 +455,3 @@ }, | ||
type: ParamTransform.Scalar, | ||
required: false, | ||
assignedIndex: 4, | ||
@@ -457,3 +462,4 @@ }, | ||
type: ParamTransform.Scalar, | ||
assignedIndex: 8, | ||
required: true, | ||
assignedIndex: 6, | ||
}, | ||
@@ -463,2 +469,3 @@ parentId: { | ||
type: ParamTransform.Scalar, | ||
required: false, | ||
assignedIndex: 5, | ||
@@ -475,3 +482,4 @@ }, | ||
type: ParamTransform.Scalar, | ||
assignedIndex: 6, | ||
required: true, | ||
assignedIndex: 7, | ||
}, | ||
@@ -481,3 +489,4 @@ text: { | ||
type: ParamTransform.Scalar, | ||
assignedIndex: 7, | ||
required: false, | ||
assignedIndex: 8, | ||
}, | ||
@@ -493,1 +502,22 @@ }, | ||
}); | ||
test('(TS) required spread', () => { | ||
const query = 'SELECT $$users!'; | ||
const parsedQuery = parseTSQuery(query); | ||
const expectedResult = { | ||
query: 'SELECT ($1)', | ||
bindings: [], | ||
mapping: [ | ||
{ | ||
name: 'users', | ||
type: ParamTransform.Spread, | ||
required: true, | ||
assignedIndex: [1], | ||
}, | ||
], | ||
}; | ||
const result = processTSQueryAST(parsedQuery.query); | ||
expect(result).toEqual(expectedResult); | ||
}); |
import { TSQueryAST } from './loader/typescript'; | ||
import { ParamType } from './loader/typescript/query'; | ||
import { Param, ParamKey, ParamType } from './loader/typescript/query'; | ||
import { assert } from './loader/sql'; | ||
@@ -19,3 +19,3 @@ import { | ||
function processScalar( | ||
paramName: string, | ||
{ name, required }: Param, | ||
nextIndex: number, | ||
@@ -39,6 +39,11 @@ existingConfig?: IScalarParam, | ||
replacement = `$${assignedIndex}`; | ||
config = { assignedIndex, type: ParamTransform.Scalar, name: paramName }; | ||
config = { | ||
assignedIndex, | ||
type: ParamTransform.Scalar, | ||
name, | ||
required, | ||
}; | ||
if (parameters) { | ||
const value = parameters[paramName] as Scalar; | ||
const value = parameters[name] as Scalar; | ||
bindings.push(value); | ||
@@ -51,3 +56,3 @@ } | ||
function processScalarArray( | ||
paramName: string, | ||
{ name, required }: Param, | ||
nextIndex: number, | ||
@@ -71,3 +76,3 @@ existingConfig?: IScalarArrayParam, | ||
if (parameters) { | ||
const values = parameters[paramName] as Scalar[]; | ||
const values = parameters[name] as Scalar[]; | ||
assignedIndex = values.map((val) => { | ||
@@ -80,3 +85,8 @@ bindings.push(val); | ||
} | ||
config = { assignedIndex, type: ParamTransform.Spread, name: paramName }; | ||
config = { | ||
assignedIndex, | ||
type: ParamTransform.Spread, | ||
name, | ||
required, | ||
}; | ||
} | ||
@@ -90,3 +100,3 @@ const replacement = '(' + assignedIndex.map((v) => `$${v}`).join(', ') + ')'; | ||
paramName: string, | ||
keys: string[], | ||
keys: ParamKey[], | ||
nextIndex: number, | ||
@@ -107,16 +117,18 @@ existingConfig?: IDictParam, | ||
const keyIndices = keys.map((key) => { | ||
if (key in config.dict) { | ||
const keyIndices = keys.map(({ name, required }) => { | ||
if (name in config.dict) { | ||
config.dict[name].required = config.dict[name].required || required; | ||
// reuse index if parameter was seen before | ||
return `$${config.dict[key].assignedIndex}`; | ||
return `$${config.dict[name].assignedIndex}`; | ||
} | ||
const assignedIndex = ++index; | ||
config.dict[key] = { | ||
config.dict[name] = { | ||
assignedIndex, | ||
name, | ||
required, | ||
type: ParamTransform.Scalar, | ||
name: key, | ||
}; | ||
if (parameters) { | ||
const value = (parameters[paramName] as INestedParameters)[key]; | ||
const value = (parameters[paramName] as INestedParameters)[name]; | ||
bindings.push(value); | ||
@@ -133,3 +145,3 @@ } | ||
paramName: string, | ||
keys: string[], | ||
keys: ParamKey[], | ||
nextIndex: number, | ||
@@ -161,4 +173,4 @@ existingConfig?: IDictArrayParam, | ||
keys | ||
.map((key) => { | ||
bindings.push(val[key]); | ||
.map(({ name }) => { | ||
bindings.push(val[name]); | ||
return `$${++index}`; | ||
@@ -175,13 +187,14 @@ }) | ||
} else { | ||
const keyIndices = keys.map((key) => { | ||
if (key in config.dict) { | ||
const keyIndices = keys.map(({ name, required }) => { | ||
if (name in config.dict) { | ||
// reuse index if parameter was seen before | ||
return `$${config.dict[key].assignedIndex}`; | ||
return `$${config.dict[name].assignedIndex}`; | ||
} | ||
const assignedIndex = ++index; | ||
config.dict[key] = { | ||
config.dict[name] = { | ||
assignedIndex, | ||
name, | ||
required, | ||
type: ParamTransform.Scalar, | ||
name: key, | ||
}; | ||
@@ -212,7 +225,7 @@ return `$${assignedIndex}`; | ||
const prevConfig = baseMap[param.name] as IScalarParam | undefined; | ||
result = processScalar(param.name, i, prevConfig, parameters); | ||
result = processScalar(param, i, prevConfig, parameters); | ||
} | ||
if (param.selection.type === ParamType.ScalarArray) { | ||
const prevConfig = baseMap[param.name] as IScalarArrayParam | undefined; | ||
result = processScalarArray(param.name, i, prevConfig, parameters); | ||
result = processScalarArray(param, i, prevConfig, parameters); | ||
} | ||
@@ -219,0 +232,0 @@ if (param.selection.type === ParamType.Object) { |
@@ -13,2 +13,3 @@ export type Scalar = string | number | null; | ||
type: ParamTransform.Scalar; | ||
required: boolean; | ||
assignedIndex: number; | ||
@@ -28,2 +29,3 @@ } | ||
type: ParamTransform.Spread; | ||
required: boolean; | ||
assignedIndex: number | number[]; | ||
@@ -39,3 +41,2 @@ } | ||
} | ||
export type QueryParam = | ||
@@ -77,3 +78,2 @@ | IScalarParam | ||
const a = str.slice(0, interval.a + offset); | ||
const b = str.slice(interval.a + offset, interval.b + offset + 1); | ||
const c = str.slice(interval.b + offset + 1, str.length); | ||
@@ -80,0 +80,0 @@ result = a + interval.sub + c; |
@@ -5,3 +5,2 @@ import { processTSQueryAST } from './preprocessor-ts'; | ||
import { parseTSQuery, TSQueryAST } from './loader/typescript'; | ||
import { parseTypeScriptFile } from './index'; | ||
@@ -8,0 +7,0 @@ export interface IDatabaseConnection { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1030915
21101
+ Added@pgtyped/wire@0.12.0(transitive)
- Removed@pgtyped/wire@0.11.0(transitive)
Updated@pgtyped/wire@^0.12.0