fix grammar

This commit is contained in:
mhoffm
2021-09-19 13:25:57 +02:00
committed by Michael Hoffmann
parent b048a42c6d
commit 5c348bd23c
8 changed files with 15076 additions and 13487 deletions

View File

@@ -231,7 +231,7 @@ module.exports = grammar({
function_arguments: $ => prec.right(seq(
$.expression,
repeat(seq($._comma, $.expression,)),
optional(choice(',', $.ellipsis)),
optional(choice($._comma, $.ellipsis)),
)),
ellipsis: $ => token('...'),
@@ -307,7 +307,7 @@ module.exports = grammar({
// TODO
template_directive: $ => choice(
$.template_for,
//$.template_if,
$.template_if,
),
template_for: $ => seq(
@@ -336,6 +336,45 @@ module.exports = grammar({
$.template_directive_end
),
template_if: $ => seq(
$.template_if_branch,
optional($.template_else_branch),
$.template_if_end,
),
template_if_branch: $ => seq(
$.template_if_intro, $._template
),
template_if_intro: $ => seq(
$.template_directive_start,
optional($.strip_marker),
"if",
$.expression,
optional($.strip_marker),
$.template_directive_end
),
template_else_branch: $ => seq(
$.template_else_intro, $._template
),
template_else_intro: $ => seq(
$.template_directive_start,
optional($.strip_marker),
"else",
optional($.strip_marker),
$.template_directive_end
),
template_if_end: $ => seq(
$.template_directive_start,
optional($.strip_marker),
"endif",
optional($.strip_marker),
$.template_directive_end
),
// http://stackoverflow.com/questions/13014947/regex-to-match-a-c-style-multiline-comment/36328890#36328890
comment: $ => token(choice(
seq('#', /.*/),