From 124d299d232c3ef047a976ed9b2931541b5ef823 Mon Sep 17 00:00:00 2001 From: Yury Kurlykov Date: Sun, 26 Apr 2020 21:21:03 +1000 Subject: [PATCH] Postpone template strings and for/of support --- grammars/JavaScriptLexer.g4 | 2 +- grammars/JavaScriptParser.g4 | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/grammars/JavaScriptLexer.g4 b/grammars/JavaScriptLexer.g4 index dfcd2b2..c73dea6 100644 --- a/grammars/JavaScriptLexer.g4 +++ b/grammars/JavaScriptLexer.g4 @@ -192,7 +192,7 @@ StringLiteral: ('"' DoubleStringCharacter* '"' ; // TODO: `${`tmp`}` -TemplateStringLiteral: '`' ('\\`' | ~'`')* '`'; +//TemplateStringLiteral: '`' ('\\`' | ~'`')* '`'; WhiteSpaces: [\t\u000B\u000C\u0020\u00A0]+ -> channel(HIDDEN); diff --git a/grammars/JavaScriptParser.g4 b/grammars/JavaScriptParser.g4 index 6ba81e9..bc0a719 100644 --- a/grammars/JavaScriptParser.g4 +++ b/grammars/JavaScriptParser.g4 @@ -150,7 +150,7 @@ iterationStatement | For '(' (expressionSequence | variableDeclarationList)? ';' expressionSequence? ';' expressionSequence? ')' statement # ForStatement | For '(' (singleExpression | variableDeclarationList) In expressionSequence ')' statement # ForInStatement // strange, 'of' is an identifier. and self.p("of") not work in sometime. - | For /*Await?*/ '(' (singleExpression | variableDeclarationList) identifier{self.p("of")}? expressionSequence ')' statement # ForOfStatement +// | For /*Await?*/ '(' (singleExpression | variableDeclarationList) identifier{self.p("of")}? expressionSequence ')' statement # ForOfStatement ; varModifier // let, const - ECMAScript 6 @@ -346,7 +346,7 @@ singleExpression | singleExpression '=' singleExpression # AssignmentExpression | singleExpression assignmentOperator singleExpression # AssignmentOperatorExpression | Import '(' singleExpression ')' # ImportExpression - | singleExpression TemplateStringLiteral # TemplateStringExpression // ECMAScript 6 +// | singleExpression TemplateStringLiteral # TemplateStringExpression // ECMAScript 6 // | yieldStatement # YieldExpression // ECMAScript 6 | This # ThisExpression | identifier # IdentifierExpression @@ -402,7 +402,7 @@ literal : NullLiteral | BooleanLiteral | StringLiteral - | TemplateStringLiteral +// | TemplateStringLiteral | RegularExpressionLiteral | numericLiteral | bigintLiteral