Fix grammar to exclude , in string
This commit is contained in:
Родитель
3e0e16ba7a
Коммит
5c64c92329
|
@ -121,7 +121,7 @@ DB: 'db';
|
|||
LF: '\n';
|
||||
CRLF: '\r\n';
|
||||
|
||||
STRING_LITERAL: ((~["\\ \t\n:.;(){}\-]) | STRING_ESCAPE )+ {!this.isExternalIdentifierText(this.text)}?;
|
||||
STRING_LITERAL: ((~[",\\ \t\n:.;(){}\-]) | STRING_ESCAPE )+ {!this.isExternalIdentifierText(this.text)}?;
|
||||
DOUBLE_QUOTED_STRING_LITERAL: '"' ((~["\\]) | STRING_ESCAPE)* '"';
|
||||
SINGLE_QUOTED_STRING_LITERAL: '\'' ((~['\\]) | STRING_ESCAPE)* '\'';
|
||||
|
||||
|
|
|
@ -143,7 +143,7 @@ export class mongoLexer extends Lexer {
|
|||
"\r\x19\x02\x0E\x1B\x02\x0F\x1D\x02\x10\x1F\x02\x11!\x02\x12#\x02\x13%"+
|
||||
"\x02\x14\'\x02\x15)\x02\x16+\x02\x17-\x02\x18/\x02\x191\x02\x1A3\x02\x02"+
|
||||
"5\x02\x027\x02\x029\x02\x02;\x02\x1B\x03\x02\f\x05\x02\f\f\x0F\x0F\u202A"+
|
||||
"\u202B\v\x02\v\f\"\"$$*+/0<=^^}}\x7F\x7F\x04\x02$$^^\x04\x02))^^\x05\x02"+
|
||||
"\u202B\v\x02\v\f\"\"$$*+.0<=^^}}\x7F\x7F\x04\x02$$^^\x04\x02))^^\x05\x02"+
|
||||
"$$))^^\x03\x023;\x04\x02GGgg\x04\x02--//\x03\x022;\x04\x02\v\v\"\"\xF2"+
|
||||
"\x02\x03\x03\x02\x02\x02\x02\x05\x03\x02\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"+
|
||||
|
|
|
@ -60,7 +60,7 @@ export class CompletionItemsVisitor extends MongoVisitor<Promise<CompletionItem[
|
|||
|
||||
visitArguments(ctx: mongoParser.ArgumentsContext): Promise<CompletionItem[]> {
|
||||
const terminalNode = this.getLastTerminalNode(ctx);
|
||||
if (terminalNode.symbol === ctx._CLOSED_PARENTHESIS) {
|
||||
if (terminalNode && terminalNode.symbol === ctx._CLOSED_PARENTHESIS) {
|
||||
return this.thenable(this.createDbKeywordCompletion(this.createRangeAfter(terminalNode)));
|
||||
}
|
||||
return this.thenable();
|
||||
|
@ -212,7 +212,7 @@ export class CompletionItemsVisitor extends MongoVisitor<Promise<CompletionItem[
|
|||
}
|
||||
|
||||
private getLastTerminalNode(ctx: ParserRuleContext): TerminalNode {
|
||||
return <TerminalNode>ctx.children.slice().reverse().filter(node => node instanceof TerminalNode && node.symbol.stopIndex > -1 && node.symbol.stopIndex < this.offset)[0];
|
||||
return ctx.children ? <TerminalNode>ctx.children.slice().reverse().filter(node => node instanceof TerminalNode && node.symbol.stopIndex > -1 && node.symbol.stopIndex < this.offset)[0] : null;
|
||||
}
|
||||
|
||||
private getPreviousNode(node: ParseTree): ParseTree {
|
||||
|
|
Загрузка…
Ссылка в новой задаче