Skip to content

Commit

Permalink
add new call type to existing precedences, add to tests, fix some ws
Browse files Browse the repository at this point in the history
  • Loading branch information
jackschu committed Aug 24, 2024
1 parent e8aa753 commit 4308c48
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ module.exports = grammar({
precedences: $ => [
[
'member',
'template_call',
'call',
$.update_expression,
'unary_void',
Expand All @@ -78,7 +79,7 @@ module.exports = grammar({
$.arrow_function,
],
['assign', $.primary_expression],
['member', 'template_call', 'new', 'call', $.expression],
['member', 'template_call', 'new', 'call', $.expression],
['declaration', 'literal'],
[$.primary_expression, $.statement_block, 'object'],
[$.meta_property, $.import],
Expand Down
4 changes: 4 additions & 0 deletions src/grammar.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions test/corpus/expressions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ Complex function calls with template strings
new f()`hello`;
new f`hello`;
arr[0]`hello`;
f`hello``goodbye`;

---
(program
Expand All @@ -176,6 +177,14 @@ arr[0]`hello`;
(subscript_expression
(identifier)
(number))
(template_string
(string_fragment))))
(expression_statement
(call_expression
(call_expression
(identifier)
(template_string
(string_fragment)))
(template_string
(string_fragment)))))

Expand Down

0 comments on commit 4308c48

Please sign in to comment.