From 530fbff65ac9eb24b21e044d980266d154cc0cec Mon Sep 17 00:00:00 2001 From: Michael Netshipise Date: Mon, 19 Jan 2026 21:11:32 +0200 Subject: [PATCH] Simplify comment and raw block patterns to single regex Remove alias() calls that referenced undefined rules, which prevented proper node type generation. Use simple regex patterns instead. Co-Authored-By: Claude Opus 4.5 --- grammar.js | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/grammar.js b/grammar.js index 77e6d16..17f8994 100644 --- a/grammar.js +++ b/grammar.js @@ -568,32 +568,17 @@ module.exports = grammar({ comment: ($) => choice($.template_comment, $.html_comment), // Template comments: @* ... *@ - template_comment: ($) => - seq( - alias("@*", $.comment_start), - optional($.comment_content), - alias("*@", $.comment_end) - ), - comment_content: ($) => /([^*]|\*[^@])*/, + template_comment: ($) => /@\*([^*]|\*[^@])*\*@/, // HTML comment: - html_comment: ($) => seq(""), - - html_comment_content: ($) => /([^-]|-[^-]|--[^>])*/, + html_comment: ($) => //, // Raw blocks: @# ... #@ - raw_block: ($) => - seq( - alias("@#", $.raw_start), - optional($.raw_content), - alias("#@", $.raw_end) - ), - raw_content: ($) => /([^#]|#[^@])*/, + raw_block: ($) => /@#([^#]|#[^@])*#@/, // Embedded language blocks: @```lang ... ```@ embedded_language: ($) => - seq("@```", $.language_name, optional($.embedded_content), "```@"), - embedded_content: ($) => /([^`]|`[^`]|``[^`]|```[^@])*/, + seq("@```", $.language_name, /([^`]|`[^`]|``[^`]|```[^@])*/, "```@"), language_name: ($) => choice("html", "css", "js", "javascript", "json", "alpine", "style"),