WIP add heredoc templates; only EOF marker at the moment

This commit is contained in:
mhoffm
2021-06-21 22:04:28 +02:00
parent d57a44c2c3
commit 5a58000ba1
7 changed files with 12426 additions and 10739 deletions

View File

@@ -25,6 +25,7 @@ module.exports = grammar({
$._template_literal_chunk,
$._template_interpolation_start,
$._template_interpolation_end,
$.heredoc_identifier,
],
extras: $ => [
@@ -265,7 +266,7 @@ module.exports = grammar({
template_expr: $ => choice(
$.quoted_template,
// $.heredoc_template,
$.heredoc_template,
),
quoted_template: $ => prec(PREC.quoted_template, seq(
@@ -278,6 +279,20 @@ module.exports = grammar({
$._quoted_template_end,
)),
// TODO user chosen identifiers
heredoc_template: $ => seq(
$.heredoc_start,
$.heredoc_identifier,
repeat(choice(
$.template_literal,
$.template_interpolation,
$.template_directive,
)),
$.heredoc_identifier,
),
heredoc_start: $ => choice('<<', '<<-'),
strip_marker: $ => '~',
template_literal: $ => prec.right(repeat1(