Skip to content

Commit fc5aec4

Browse files
committed
make ASI consider validity of '(' and '[' rather than considering them always disallowed as lookahead chars
1 parent eac8429 commit fc5aec4

File tree

4 files changed

+50079
-44786
lines changed

4 files changed

+50079
-44786
lines changed

grammar.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ module.exports = grammar({
1717
$._ternary_qmark,
1818
$._shorthand_arrow,
1919
$.html_comment,
20+
// we use these just as signaling to the ASI scanner
2021
'||',
22+
'(',
23+
'[',
2124
// We use escape sequence and regex pattern to tell the scanner if we're currently inside a string or template string, in which case
2225
// it should NOT parse html comments.
2326
$.escape_sequence,
@@ -785,7 +788,7 @@ module.exports = grammar({
785788
call_expression: $ => choice(
786789
prec('call', seq(
787790
field('function', choice($.primary_expression, $.import)),
788-
field('arguments', $.arguments),
791+
field('arguments', choice($.arguments, $.template_string)),
789792
)),
790793
prec('template_call', seq(
791794
field('function', $.primary_expression),

src/grammar.json

Lines changed: 19 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)