fix(grammar): make brace and keyword separately queryable

This commit is contained in:
2026-05-17 06:00:21 +02:00
parent 218d2869a6
commit 6f4a0df871
7 changed files with 716 additions and 522 deletions
+12 -6
View File
@@ -26,20 +26,27 @@ export default grammar({
content: _ => token(prec(-1, /([^{]|\{[^A-Za-z/])+/)),
block_open: $ => seq(
$._block_open_start,
"{",
$.block_keyword,
":",
$.block_name,
optional($.attributes),
"}",
),
block_close: $ => seq(
$._block_close_start,
"{",
"/",
$.block_keyword,
":",
$.block_name,
"}",
),
lang_tag: $ => seq(
$._lang_start,
"{",
$.lang_keyword,
":",
$.lang_text,
"}",
),
@@ -65,9 +72,8 @@ export default grammar({
prefix_argument: _ => /[A-Za-z][A-Za-z0-9 _-]*/,
lang_text: _ => /[^}]+/,
_block_open_start: _ => /\{[Bb][Ll][Oo][Cc][Kk]:/,
_block_close_start: _ => /\{\/[Bb][Ll][Oo][Cc][Kk]:/,
_lang_start: _ => /\{[Ll][Aa][Nn][Gg]:/,
block_keyword: _ => token(prec(1, /[Bb][Ll][Oo][Cc][Kk]/)),
lang_keyword: _ => token(prec(1, /[Ll][Aa][Nn][Gg]/)),
_space: _ => /[ \t]+/,
},
});