Skip to content

Commit 9ff82dc

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

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

grammar.js

Lines changed: 5 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
),
@@ -312,11 +308,13 @@ module.exports = grammar(HTML, {
312308
/**
313309
* @param {string} sym
314310
* @param {string} text
311+
* @rest param {string} ...other
315312
* @return {SeqRule}
316313
*/
317-
function tag(sym, text) {
314+
function tag(sym, text, ...other) {
318315
return seq(
319316
sym,
320317
field('tag', token.immediate(text)),
318+
...other.map(rule => field('tag', rule)),
321319
);
322320
}

0 commit comments

Comments
 (0)