rename missing_tag to missing_block
This commit is contained in:
1 parent
2d7d0db471
commit
1648dc82f3
6 files changed
+751
-752
No files matched your search
@@ -238,7 +238,7 @@ Fifteen external tokens, for the constraints a context-free grammar cannot expre
|
||||
blocktranslate entry into its counted kind, which waits for `plural` before its end tag. `tag_groups`
|
||||
holds each kind's opening name and the names that belong to it, and `group_names` **must stay in sync
|
||||
with `NAMES_INSIDE_A_TAG_GROUP`**.
|
||||
- `_missing_tag` — the marker where a group's required tag is missing, aliased at each use to
|
||||
- `_missing_block` — the marker where a group's required tag block is missing, aliased at each use to
|
||||
`missing_endX_block` or `missing_plural_block` (`MISSING_BLOCKS`). It is placed only at the end of
|
||||
input; before a tag whose name is reserved to some other group, which therefore cannot belong to this
|
||||
body; or before an `endblock`/`endpartialdef` naming a block further out than the innermost. It closes
|
||||
@@ -274,7 +274,7 @@ Zero-width guards carry one hazard: `recover_with_missing` can supply one withou
|
||||
during tree-sitter's mark-everything-valid recovery pass, so new guards go **below** it — and above the
|
||||
whitespace loop, which skips the separator the grammar still has to match. A guard must also never be valid
|
||||
where `content` is: a zero-width token at a content boundary preempts the internal lexer and `content` stops
|
||||
matching. `_missing_tag` is the one exception, and is safe only because it returns a token solely at the end
|
||||
matching. `_missing_block` is the one exception, and is safe only because it returns a token solely at the end
|
||||
of input or at `{%`, where `content` cannot match. It is scanned above the raw-text scanners, which find
|
||||
nothing at the end of an empty body.
|
||||
|
||||
@@ -307,7 +307,7 @@ A branch that is also a `@local.scope` confines its bindings whichever way the b
|
||||
`context.push()` as the loop body, so `empty_clause` is a scope alongside `for_clause`.
|
||||
|
||||
`queries/errors.scm` collects what an editor should report: `(ERROR)` as `@error.syntax`, `(MISSING)` as
|
||||
`@error.missing`, and every missing-tag marker as `@error.missing_tag`. A tree holding only markers has
|
||||
`@error.missing`, and every missing-tag marker as `@error.missing_block`. A tree holding only markers has
|
||||
no `has_error`, so a tool that checks that flag alone misses them. Adding a tag group means adding its
|
||||
marker there, since no supertype matches them all.
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ Five of the files in `queries/` are query files an editor loads:
|
||||
the HTML around the tags can be parsed by its own grammar. It names no language, leaving the editor to
|
||||
supply one.
|
||||
- **`errors.scm`** — what to report as a problem: `(ERROR)` as `@error.syntax`, tree-sitter's own
|
||||
`(MISSING)` as `@error.missing`, and `@error.missing_tag` for the marker placed where a group's required
|
||||
`(MISSING)` as `@error.missing`, and `@error.missing_block` for the marker placed where a group's required
|
||||
tag is missing. An unterminated `{% if a %}x` parses as an `if_group` ending in a zero-width
|
||||
`missing_endif_block` rather than as an `ERROR`, so completion and the scope queries keep working while
|
||||
a template is being written — and the tree reports no error of its own, so this query is how to find
|
||||
|
||||
+20
-20
@@ -263,7 +263,7 @@ function blocktransRules(tag) {
|
||||
optional($._translate_body),
|
||||
choice(
|
||||
$.plural_clause,
|
||||
alias($._missing_tag, $.missing_plural_block),
|
||||
alias($._missing_block, $.missing_plural_block),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -481,7 +481,7 @@ const django = grammar({
|
||||
$._tag_open,
|
||||
$._bt_option,
|
||||
$._kwarg_name,
|
||||
$._missing_tag,
|
||||
$._missing_block,
|
||||
$._group_open,
|
||||
$._group_close,
|
||||
],
|
||||
@@ -684,7 +684,7 @@ const django = grammar({
|
||||
$.autoescape_clause,
|
||||
choice(
|
||||
$.endautoescape_block,
|
||||
alias($._missing_tag, $.missing_endautoescape_block),
|
||||
alias($._missing_block, $.missing_endautoescape_block),
|
||||
),
|
||||
),
|
||||
// the scanner takes the whitespace before a name it has to match itself
|
||||
@@ -696,7 +696,7 @@ const django = grammar({
|
||||
$.block_clause,
|
||||
choice(
|
||||
$.endblock_block,
|
||||
alias($._missing_tag, $.missing_endblock_block),
|
||||
alias($._missing_block, $.missing_endblock_block),
|
||||
),
|
||||
),
|
||||
plural_block: ($) => groupBlock($._group_close, "plural"),
|
||||
@@ -709,14 +709,14 @@ const django = grammar({
|
||||
$.blocktrans_clause,
|
||||
choice(
|
||||
$.endblocktrans_block,
|
||||
alias($._missing_tag, $.missing_endblocktrans_block),
|
||||
alias($._missing_block, $.missing_endblocktrans_block),
|
||||
),
|
||||
),
|
||||
seq(
|
||||
$.blocktranslate_clause,
|
||||
choice(
|
||||
$.endblocktranslate_block,
|
||||
alias($._missing_tag, $.missing_endblocktranslate_block),
|
||||
alias($._missing_block, $.missing_endblocktranslate_block),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -780,7 +780,7 @@ const django = grammar({
|
||||
$.cache_clause,
|
||||
choice(
|
||||
$.endcache_block,
|
||||
alias($._missing_tag, $.missing_endcache_block),
|
||||
alias($._missing_block, $.missing_endcache_block),
|
||||
),
|
||||
),
|
||||
comment_block: ($) =>
|
||||
@@ -792,7 +792,7 @@ const django = grammar({
|
||||
$.comment_clause,
|
||||
choice(
|
||||
$.endcomment_block,
|
||||
alias($._missing_tag, $.missing_endcomment_block),
|
||||
alias($._missing_block, $.missing_endcomment_block),
|
||||
),
|
||||
),
|
||||
// csp_nonce_attr(context, media=None)
|
||||
@@ -835,7 +835,7 @@ const django = grammar({
|
||||
$.filter_clause,
|
||||
choice(
|
||||
$.endfilter_block,
|
||||
alias($._missing_tag, $.missing_endfilter_block),
|
||||
alias($._missing_block, $.missing_endfilter_block),
|
||||
),
|
||||
),
|
||||
firstof_block: ($) =>
|
||||
@@ -880,7 +880,7 @@ const django = grammar({
|
||||
seq(
|
||||
$.for_clause,
|
||||
optional($.empty_clause),
|
||||
choice($.endfor_block, alias($._missing_tag, $.missing_endfor_block)),
|
||||
choice($.endfor_block, alias($._missing_block, $.missing_endfor_block)),
|
||||
),
|
||||
/**
|
||||
* django.templatetags.i18n. Each of these requires exactly "as <name>",
|
||||
@@ -924,7 +924,7 @@ const django = grammar({
|
||||
$.if_clause,
|
||||
repeat($.elif_clause),
|
||||
optional($.else_clause),
|
||||
choice($.endif_block, alias($._missing_tag, $.missing_endif_block)),
|
||||
choice($.endif_block, alias($._missing_block, $.missing_endif_block)),
|
||||
),
|
||||
ifchanged_block: ($) =>
|
||||
groupBlock($._group_open, "ifchanged", repeat(part($.filtered_value))),
|
||||
@@ -936,7 +936,7 @@ const django = grammar({
|
||||
optional($.else_clause),
|
||||
choice(
|
||||
$.endifchanged_block,
|
||||
alias($._missing_tag, $.missing_endifchanged_block),
|
||||
alias($._missing_block, $.missing_endifchanged_block),
|
||||
),
|
||||
),
|
||||
/**
|
||||
@@ -964,7 +964,7 @@ const django = grammar({
|
||||
$.language_clause,
|
||||
choice(
|
||||
$.endlanguage_block,
|
||||
alias($._missing_tag, $.missing_endlanguage_block),
|
||||
alias($._missing_block, $.missing_endlanguage_block),
|
||||
),
|
||||
),
|
||||
library: ($) => seq($.identifier, optional(seq(".", $.identifier))),
|
||||
@@ -993,7 +993,7 @@ const django = grammar({
|
||||
$.localize_clause,
|
||||
choice(
|
||||
$.endlocalize_block,
|
||||
alias($._missing_tag, $.missing_endlocalize_block),
|
||||
alias($._missing_block, $.missing_endlocalize_block),
|
||||
),
|
||||
),
|
||||
/** django.templatetags.tz, taking "on" or "off" as localize does. */
|
||||
@@ -1010,7 +1010,7 @@ const django = grammar({
|
||||
$.localtime_clause,
|
||||
choice(
|
||||
$.endlocaltime_block,
|
||||
alias($._missing_tag, $.missing_endlocaltime_block),
|
||||
alias($._missing_block, $.missing_endlocaltime_block),
|
||||
),
|
||||
),
|
||||
lorem_block: ($) =>
|
||||
@@ -1031,7 +1031,7 @@ const django = grammar({
|
||||
$.partialdef_clause,
|
||||
choice(
|
||||
$.endpartialdef_block,
|
||||
alias($._missing_tag, $.missing_endpartialdef_block),
|
||||
alias($._missing_block, $.missing_endpartialdef_block),
|
||||
),
|
||||
),
|
||||
// querystring(context, *args, **kwargs)
|
||||
@@ -1053,7 +1053,7 @@ const django = grammar({
|
||||
$.spaceless_clause,
|
||||
choice(
|
||||
$.endspaceless_block,
|
||||
alias($._missing_tag, $.missing_endspaceless_block),
|
||||
alias($._missing_block, $.missing_endspaceless_block),
|
||||
),
|
||||
),
|
||||
static_block: ($) =>
|
||||
@@ -1084,7 +1084,7 @@ const django = grammar({
|
||||
$.timezone_clause,
|
||||
choice(
|
||||
$.endtimezone_block,
|
||||
alias($._missing_tag, $.missing_endtimezone_block),
|
||||
alias($._missing_block, $.missing_endtimezone_block),
|
||||
),
|
||||
),
|
||||
/**
|
||||
@@ -1129,7 +1129,7 @@ const django = grammar({
|
||||
$.verbatim_clause,
|
||||
choice(
|
||||
$.endverbatim_block,
|
||||
alias($._missing_tag, $.missing_endverbatim_block),
|
||||
alias($._missing_block, $.missing_endverbatim_block),
|
||||
),
|
||||
),
|
||||
widthratio_block: ($) =>
|
||||
@@ -1147,7 +1147,7 @@ const django = grammar({
|
||||
with_group: ($) =>
|
||||
seq(
|
||||
$.with_clause,
|
||||
choice($.endwith_block, alias($._missing_tag, $.missing_endwith_block)),
|
||||
choice($.endwith_block, alias($._missing_block, $.missing_endwith_block)),
|
||||
),
|
||||
},
|
||||
});
|
||||
|
||||
+2
-3
@@ -8,8 +8,7 @@
|
||||
;
|
||||
; @error.syntax input the grammar could not parse
|
||||
; @error.missing a token that tree-sitter's error recovery inserted
|
||||
; @error.missing_tag a tag its group requires, absent where the marker is;
|
||||
; the marker's type names the tag
|
||||
; @error.missing_block expected tag block is missing
|
||||
;
|
||||
; The markers are listed one by one, as MISSING_BLOCKS in grammar.js: the
|
||||
; generator drops a supertype whose members are aliases, so there is no single
|
||||
@@ -39,4 +38,4 @@
|
||||
(missing_endtimezone_block)
|
||||
(missing_endverbatim_block)
|
||||
(missing_endwith_block)
|
||||
(missing_plural_block)] @error.missing_tag
|
||||
(missing_plural_block)] @error.missing_block
|
||||
+21
-21
@@ -1515,7 +1515,7 @@
|
||||
"type": "ALIAS",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "_missing_tag"
|
||||
"name": "_missing_block"
|
||||
},
|
||||
"named": true,
|
||||
"value": "missing_endautoescape_block"
|
||||
@@ -1665,7 +1665,7 @@
|
||||
"type": "ALIAS",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "_missing_tag"
|
||||
"name": "_missing_block"
|
||||
},
|
||||
"named": true,
|
||||
"value": "missing_endblock_block"
|
||||
@@ -1939,7 +1939,7 @@
|
||||
"type": "ALIAS",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "_missing_tag"
|
||||
"name": "_missing_block"
|
||||
},
|
||||
"named": true,
|
||||
"value": "missing_plural_block"
|
||||
@@ -2194,7 +2194,7 @@
|
||||
"type": "ALIAS",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "_missing_tag"
|
||||
"name": "_missing_block"
|
||||
},
|
||||
"named": true,
|
||||
"value": "missing_plural_block"
|
||||
@@ -2275,7 +2275,7 @@
|
||||
"type": "ALIAS",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "_missing_tag"
|
||||
"name": "_missing_block"
|
||||
},
|
||||
"named": true,
|
||||
"value": "missing_endblocktrans_block"
|
||||
@@ -2302,7 +2302,7 @@
|
||||
"type": "ALIAS",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "_missing_tag"
|
||||
"name": "_missing_block"
|
||||
},
|
||||
"named": true,
|
||||
"value": "missing_endblocktranslate_block"
|
||||
@@ -2741,7 +2741,7 @@
|
||||
"type": "ALIAS",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "_missing_tag"
|
||||
"name": "_missing_block"
|
||||
},
|
||||
"named": true,
|
||||
"value": "missing_endcache_block"
|
||||
@@ -2908,7 +2908,7 @@
|
||||
"type": "ALIAS",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "_missing_tag"
|
||||
"name": "_missing_block"
|
||||
},
|
||||
"named": true,
|
||||
"value": "missing_endcomment_block"
|
||||
@@ -3631,7 +3631,7 @@
|
||||
"type": "ALIAS",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "_missing_tag"
|
||||
"name": "_missing_block"
|
||||
},
|
||||
"named": true,
|
||||
"value": "missing_endfilter_block"
|
||||
@@ -4152,7 +4152,7 @@
|
||||
"type": "ALIAS",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "_missing_tag"
|
||||
"name": "_missing_block"
|
||||
},
|
||||
"named": true,
|
||||
"value": "missing_endfor_block"
|
||||
@@ -5143,7 +5143,7 @@
|
||||
"type": "ALIAS",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "_missing_tag"
|
||||
"name": "_missing_block"
|
||||
},
|
||||
"named": true,
|
||||
"value": "missing_endif_block"
|
||||
@@ -5317,7 +5317,7 @@
|
||||
"type": "ALIAS",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "_missing_tag"
|
||||
"name": "_missing_block"
|
||||
},
|
||||
"named": true,
|
||||
"value": "missing_endifchanged_block"
|
||||
@@ -5666,7 +5666,7 @@
|
||||
"type": "ALIAS",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "_missing_tag"
|
||||
"name": "_missing_block"
|
||||
},
|
||||
"named": true,
|
||||
"value": "missing_endlanguage_block"
|
||||
@@ -5985,7 +5985,7 @@
|
||||
"type": "ALIAS",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "_missing_tag"
|
||||
"name": "_missing_block"
|
||||
},
|
||||
"named": true,
|
||||
"value": "missing_endlocalize_block"
|
||||
@@ -6161,7 +6161,7 @@
|
||||
"type": "ALIAS",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "_missing_tag"
|
||||
"name": "_missing_block"
|
||||
},
|
||||
"named": true,
|
||||
"value": "missing_endlocaltime_block"
|
||||
@@ -6587,7 +6587,7 @@
|
||||
"type": "ALIAS",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "_missing_tag"
|
||||
"name": "_missing_block"
|
||||
},
|
||||
"named": true,
|
||||
"value": "missing_endpartialdef_block"
|
||||
@@ -7057,7 +7057,7 @@
|
||||
"type": "ALIAS",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "_missing_tag"
|
||||
"name": "_missing_block"
|
||||
},
|
||||
"named": true,
|
||||
"value": "missing_endspaceless_block"
|
||||
@@ -7403,7 +7403,7 @@
|
||||
"type": "ALIAS",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "_missing_tag"
|
||||
"name": "_missing_block"
|
||||
},
|
||||
"named": true,
|
||||
"value": "missing_endtimezone_block"
|
||||
@@ -8765,7 +8765,7 @@
|
||||
"type": "ALIAS",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "_missing_tag"
|
||||
"name": "_missing_block"
|
||||
},
|
||||
"named": true,
|
||||
"value": "missing_endverbatim_block"
|
||||
@@ -9041,7 +9041,7 @@
|
||||
"type": "ALIAS",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "_missing_tag"
|
||||
"name": "_missing_block"
|
||||
},
|
||||
"named": true,
|
||||
"value": "missing_endwith_block"
|
||||
@@ -9179,7 +9179,7 @@
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "_missing_tag"
|
||||
"name": "_missing_block"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
|
||||
+704
-704
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user