Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
parse curly braces directive only with single expressions

Co-authored-by: Jonatan Kłosko <[email protected]>
  • Loading branch information
kevinschweikert and jonatanklosko authored Dec 9, 2024
1 parent cd47553 commit a5075e6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
14 changes: 1 addition & 13 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,19 +131,7 @@ module.exports = grammar({
)
)
),
seq(
choice("{"),
prec.left(
seq(
choice(
$.partial_expression_value,
$.ending_expression_value,
$.expression_value
),
choice("}")
)
)
)
alias($.expression, "expression")
),

comment: ($) => choice($._html_comment, $._bang_comment, $._hash_comment),
Expand Down
7 changes: 7 additions & 0 deletions test/corpus/directives.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ Curly braces as directive

<div>
{ @message }
{@message}
{"#{1}"}
</div>

--------------------------------------------------------------------------------

(fragment
Expand All @@ -56,5 +59,9 @@ Curly braces as directive
(tag_name))
(directive
(expression_value))
(directive
(expression_value))
(directive
(expression_value))
(end_tag
(tag_name))))

0 comments on commit a5075e6

Please sign in to comment.