Skip to content

Commit 25edee6

Browse files
parse curly braces as expression instead of directive
1 parent a5075e6 commit 25edee6

File tree

6 files changed

+1351
-1495
lines changed

6 files changed

+1351
-1495
lines changed

grammar.js

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,15 @@ module.exports = grammar({
55
fragment: ($) => repeat($._node),
66

77
_node: ($) =>
8-
choice($.doctype, $.tag, $.component, $.text, $.comment, $.directive),
8+
choice(
9+
$.doctype,
10+
$.tag,
11+
$.component,
12+
$.text,
13+
$.comment,
14+
$.directive,
15+
$.expression
16+
),
917

1018
doctype: ($) => seq("<!", "DOCTYPE", "html", ">"),
1119

@@ -117,21 +125,18 @@ module.exports = grammar({
117125
),
118126

119127
directive: ($) =>
120-
choice(
121-
seq(
122-
choice("<%", "<%=", "<%%", "<%%="),
123-
prec.left(
124-
seq(
125-
choice(
126-
$.partial_expression_value,
127-
$.ending_expression_value,
128-
$.expression_value
129-
),
130-
choice("%>")
131-
)
128+
seq(
129+
choice("<%", "<%=", "<%%", "<%%="),
130+
prec.left(
131+
seq(
132+
choice(
133+
$.partial_expression_value,
134+
$.ending_expression_value,
135+
$.expression_value
136+
),
137+
choice("%>")
132138
)
133-
),
134-
alias($.expression, "expression")
139+
)
135140
),
136141

137142
comment: ($) => choice($._html_comment, $._bang_comment, $._hash_comment),

src/grammar.json

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

src/node-types.json

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

0 commit comments

Comments
 (0)