Skip to content

Commit a23f0bf

Browse files
committed
added rest param to tag() and modified _else_if_tag accordingly
1 parent c18c7d8 commit a23f0bf

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

grammar.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,10 @@ module.exports = grammar(HTML, {
138138
'}',
139139
),
140140

141-
// Since 'else' and 'if' are separated by space, we cannot put them in a simple tag() like $._else_tag or $._if_start_tag
142-
else_if_tag: $ => seq(
143-
tag(':', 'else'),
144-
field('tag', 'if'),
145-
),
141+
_else_if_tag: _ => tag(':', 'else', 'if'),
146142
else_if_start: $ => seq(
147143
'{',
148-
alias($.else_if_tag, $.block_tag),
144+
alias($._else_if_tag, $.block_tag),
149145
field('condition', $.svelte_raw_text),
150146
'}',
151147
),
@@ -314,9 +310,10 @@ module.exports = grammar(HTML, {
314310
* @param {string} text
315311
* @return {SeqRule}
316312
*/
317-
function tag(sym, text) {
313+
function tag(sym, text, ...other) {
318314
return seq(
319315
sym,
320316
field('tag', token.immediate(text)),
317+
...other.map(rule => field('tag', rule)),
321318
);
322319
}

0 commit comments

Comments
 (0)