fixed content regex

This commit is contained in:
danhanson committed 2026-09-14 21:29:27 -05:00
1 parent 831acd3516
commit fa0d880e68
4 files changed
+33 -6

No files matched your search

+1 -1
View File
@@ -603,7 +603,7 @@ const django = grammar({
endTagOpen: ($) => seq("{%", $._group_open_tag_read, optional(SEP)), endTagOpen: ($) => seq("{%", $._group_open_tag_read, optional(SEP)),
endTagClose: ($) => endTagClose: ($) =>
seq(optional($.unexpected_argument), $._group_close, optional(SEP), "%}"), seq(optional($.unexpected_argument), $._group_close, optional(SEP), "%}"),
content: ($) => /(?:[^\{]|\{[^\{#%}])+/, content: ($) => /(?:[^\{]|\{[^\{#%])+/,
// the separator between the parts of a tag; see SEP // the separator between the parts of a tag; see SEP
_sep: ($) => /[ \t\r\n]+/, _sep: ($) => /[ \t\r\n]+/,
template_node: ($) => template_node: ($) =>
+1 -1
View File
@@ -327,7 +327,7 @@
}, },
"content": { "content": {
"type": "PATTERN", "type": "PATTERN",
"value": "(?:[^\\{]|\\{[^\\{#%}])+" "value": "(?:[^\\{]|\\{[^\\{#%])+"
}, },
"_sep": { "_sep": {
"type": "PATTERN", "type": "PATTERN",
+2 -4
View File
@@ -8211,8 +8211,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
if (lookahead == '#') ADVANCE(53); if (lookahead == '#') ADVANCE(53);
if (lookahead == '%') ADVANCE(26); if (lookahead == '%') ADVANCE(26);
if (lookahead == '{') ADVANCE(51); if (lookahead == '{') ADVANCE(51);
if (lookahead != 0 && if (lookahead != 0) ADVANCE(28);
lookahead != '}') ADVANCE(28);
END_STATE(); END_STATE();
case 7: case 7:
if (lookahead == '%') ADVANCE(17); if (lookahead == '%') ADVANCE(17);
@@ -8303,8 +8302,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
if (lookahead != 0 && if (lookahead != 0 &&
lookahead != '#' && lookahead != '#' &&
lookahead != '%' && lookahead != '%' &&
lookahead != '{' && lookahead != '{') ADVANCE(28);
lookahead != '}') ADVANCE(28);
END_STATE(); END_STATE();
case 21: case 21:
if (lookahead != 0 && if (lookahead != 0 &&
+29
View File
@@ -211,6 +211,7 @@ Template Variable Literal Adjacent To Name
--- ---
================== ==================
Template Variable With Escaped String Template Variable With Escaped String
================== ==================
@@ -272,6 +273,7 @@ Template Variable Attribute Beginning With Underscore
--- ---
================== ==================
Template Variable Translated String Template Variable Translated String
================== ==================
@@ -320,6 +322,7 @@ Template Variable Translated String With Spaces
--- ---
================== ==================
Template Variable Spanning Lines Template Variable Spanning Lines
================== ==================
@@ -462,6 +465,7 @@ Template Variable Attribute Of A Literal
--- ---
================== ==================
Template Variable Trailing Dot With An Exponent Template Variable Trailing Dot With An Exponent
================== ==================
@@ -489,6 +493,7 @@ Template Variable Trailing Dot
--- ---
================== ==================
Template Variable Signed Trailing Dot Template Variable Signed Trailing Dot
:error :error
@@ -498,3 +503,27 @@ Template Variable Signed Trailing Dot
--- ---
==================
Braces That Open Nothing Are Text
==================
{% if x %}Hello {} world{% endif %}
---
(template
(content)
(if_group
(if_block
(if_tag
(predicate
(filtered_value
(value
(variable_attribute
(identifier))))))
(template
(content)))
(endif_tag))
(content))