massive rename
This commit is contained in:
1 parent
cb8c9f9c0b
commit
9f2fdaf746
49 files changed
+6378
-6403
No files matched your search
+10
-10
@@ -22,7 +22,7 @@
|
||||
; If it is not, some pass through it binds nothing, so every definition inside
|
||||
; is conditional. If it is, a definition escapes only when every branch makes
|
||||
; it. Each capture names both halves of the pair, so no ancestor walk is needed
|
||||
; and no clause has to be attributed to a group by name.
|
||||
; and no block has to be attributed to a group by name.
|
||||
;
|
||||
; Branches nest, so the same test applies again to a group inside a branch.
|
||||
;
|
||||
@@ -34,20 +34,20 @@
|
||||
; of the three pushes a context, so this is the case the check exists for.
|
||||
(if_group
|
||||
[
|
||||
(if_clause)
|
||||
(elif_clause)
|
||||
(if_block)
|
||||
(elif_block)
|
||||
] @conditional.branch) @conditional.group
|
||||
|
||||
(if_group
|
||||
(else_clause) @conditional.default) @conditional.group
|
||||
(else_block) @conditional.default) @conditional.group
|
||||
|
||||
; ifchanged renders its body only when the watched value differs from the
|
||||
; previous pass, and its else otherwise. It pushes no context either.
|
||||
(ifchanged_group
|
||||
(ifchanged_clause) @conditional.branch) @conditional.group
|
||||
(ifchanged_block) @conditional.branch) @conditional.group
|
||||
|
||||
(ifchanged_group
|
||||
(else_clause) @conditional.default) @conditional.group
|
||||
(else_block) @conditional.default) @conditional.group
|
||||
|
||||
; The loop body runs once per item and empty runs when there are none, so the
|
||||
; two partition every render. Both are inside ForNode's context.push() — the
|
||||
@@ -55,21 +55,21 @@
|
||||
; nothing escapes either way. Named here because the construct does branch, and
|
||||
; because a tool reading only this file should not have to infer that it does.
|
||||
(for_group
|
||||
(for_clause) @conditional.branch) @conditional.group
|
||||
(for_block) @conditional.branch) @conditional.group
|
||||
|
||||
(for_group
|
||||
(empty_clause) @conditional.default) @conditional.group
|
||||
(empty_block) @conditional.default) @conditional.group
|
||||
|
||||
; A cache body is skipped entirely on a cache hit, and CacheNode pushes no
|
||||
; context, so a binding made inside it reaches the rest of the template on the
|
||||
; first render and is gone on the next. One branch and no default: never
|
||||
; exhaustive, which is the right answer.
|
||||
(cache_group
|
||||
(cache_clause) @conditional.branch) @conditional.group
|
||||
(cache_block) @conditional.branch) @conditional.group
|
||||
|
||||
; Not here, deliberately: block and partialdef bodies may also fail to render —
|
||||
; a child template overrides the block, and a partial renders only where
|
||||
; {% partial %} names it — but both clauses are @local.scope in locals.scm, so
|
||||
; {% partial %} names it — but both blocks are @local.scope in locals.scm, so
|
||||
; nothing they bind escapes to be checked. Bodies that always render once
|
||||
; (with, filter, autoescape, spaceless, language, localize, localtime,
|
||||
; timezone) are not conditional at all, and comment, verbatim and
|
||||
|
||||
+23
-23
@@ -1,16 +1,16 @@
|
||||
; Everything in a template that an editor should report as a problem.
|
||||
;
|
||||
; A group whose required tag is missing parses without an ERROR: the scanner
|
||||
; supplies a zero-width marker where the tag belongs, so the group, its clauses
|
||||
; supplies a zero-width marker where the tag belongs, so the group, its blocks
|
||||
; and the scopes they open stay intact for completion and the other queries.
|
||||
; Such a tree has no error of its own (ts_node_has_error is false), so a tool
|
||||
; has to run this query to find them.
|
||||
;
|
||||
; @error.syntax input the grammar could not parse
|
||||
; @error.missing a token that tree-sitter's error recovery inserted
|
||||
; @error.missing_block expected tag block is missing
|
||||
; @error.missing_tag expected tag block is missing
|
||||
;
|
||||
; The markers are listed one by one, as MISSING_BLOCKS in grammar.js: the
|
||||
; The markers are listed one by one, as MISSING_TAGS in grammar.js: the
|
||||
; generator drops a supertype whose members are aliases, so there is no single
|
||||
; node type to match them all. A new tag group, or a new kind of marker, is
|
||||
; added here.
|
||||
@@ -20,24 +20,24 @@
|
||||
(MISSING) @error.missing
|
||||
|
||||
[
|
||||
(missing_endautoescape_block)
|
||||
(missing_endblock_block)
|
||||
(missing_endblocktrans_block)
|
||||
(missing_endblocktranslate_block)
|
||||
(missing_endcache_block)
|
||||
(missing_endcomment_block)
|
||||
(missing_endfilter_block)
|
||||
(missing_endfor_block)
|
||||
(missing_endif_block)
|
||||
(missing_endifchanged_block)
|
||||
(missing_endlanguage_block)
|
||||
(missing_endlocalize_block)
|
||||
(missing_endlocaltime_block)
|
||||
(missing_endpartialdef_block)
|
||||
(missing_endspaceless_block)
|
||||
(missing_endtimezone_block)
|
||||
(missing_endverbatim_block)
|
||||
(missing_endwith_block)
|
||||
(missing_plural_block)] @error.missing_block
|
||||
(missing_endautoescape_tag)
|
||||
(missing_endblock_tag)
|
||||
(missing_endblocktrans_tag)
|
||||
(missing_endblocktranslate_tag)
|
||||
(missing_endcache_tag)
|
||||
(missing_endcomment_tag)
|
||||
(missing_endfilter_tag)
|
||||
(missing_endfor_tag)
|
||||
(missing_endif_tag)
|
||||
(missing_endifchanged_tag)
|
||||
(missing_endlanguage_tag)
|
||||
(missing_endlocalize_tag)
|
||||
(missing_endlocaltime_tag)
|
||||
(missing_endpartialdef_tag)
|
||||
(missing_endspaceless_tag)
|
||||
(missing_endtimezone_tag)
|
||||
(missing_endverbatim_tag)
|
||||
(missing_endwith_tag)
|
||||
(missing_plural_tag)] @error.missing_tag
|
||||
|
||||
(unexpected_block) @error.unexpected_block
|
||||
(unexpected_tag) @error.unexpected_tag
|
||||
+4
-4
@@ -21,10 +21,10 @@
|
||||
; scope span could have separated them; that is why this is a separate file
|
||||
; rather than a narrower scope in locals.scm.
|
||||
|
||||
(blocktrans_clause
|
||||
(blocktrans_block
|
||||
(blocktrans_block
|
||||
(blocktrans_tag
|
||||
asvar: (identifier) @export.name)) @export.from
|
||||
|
||||
(blocktranslate_clause
|
||||
(blocktranslate_block
|
||||
(blocktranslate_block
|
||||
(blocktranslate_tag
|
||||
asvar: (identifier) @export.name)) @export.from
|
||||
@@ -4,13 +4,13 @@
|
||||
variable: (identifier) @variable.parameter
|
||||
|
||||
|
||||
(block_block
|
||||
(block_tag
|
||||
(push_block) @type)
|
||||
|
||||
(partialdef_block
|
||||
(partialdef_tag
|
||||
(push_partial) @type)
|
||||
|
||||
(verbatim_block
|
||||
(verbatim_tag
|
||||
(push_verbatim) @type)
|
||||
|
||||
(comment_content) @comment
|
||||
@@ -47,7 +47,7 @@ variable: (identifier) @variable.parameter
|
||||
(library
|
||||
(identifier) @module)
|
||||
|
||||
tag: [
|
||||
tag_name: [
|
||||
("autoescape")
|
||||
("endautoescape")
|
||||
("block")
|
||||
@@ -120,7 +120,7 @@ tag: [
|
||||
("endwith")] @function
|
||||
|
||||
(filter
|
||||
name: [
|
||||
filter_name: [
|
||||
("add")
|
||||
("addslashes")
|
||||
("capfirst")
|
||||
@@ -190,10 +190,10 @@ tag: [
|
||||
|
||||
; a filter or tag a "load" brought in, whose name the grammar does not know
|
||||
(filter
|
||||
name: (identifier) @function.call)
|
||||
filter_name: (identifier) @function.call)
|
||||
|
||||
(custom_tag_block
|
||||
tag: (identifier) @function.call)
|
||||
(custom_tag
|
||||
tag_name: (identifier) @function.call)
|
||||
|
||||
(load_block
|
||||
(load_tag
|
||||
(identifier) @function)
|
||||
+39
-39
@@ -15,81 +15,81 @@
|
||||
; heads, so that the capture is both the name to look up and the range to
|
||||
; report. A paired tag names the opening tag only.
|
||||
|
||||
(static_block
|
||||
tag: ("static") @library.static)
|
||||
(static_tag
|
||||
tag_name: ("static") @library.static)
|
||||
|
||||
(get_static_prefix_block
|
||||
tag: ("get_static_prefix") @library.static)
|
||||
(get_static_prefix_tag
|
||||
tag_name: ("get_static_prefix") @library.static)
|
||||
|
||||
(get_media_prefix_block
|
||||
tag: ("get_media_prefix") @library.static)
|
||||
(get_media_prefix_tag
|
||||
tag_name: ("get_media_prefix") @library.static)
|
||||
|
||||
(blocktrans_block
|
||||
tag: ("blocktrans") @library.i18n)
|
||||
(blocktrans_tag
|
||||
tag_name: ("blocktrans") @library.i18n)
|
||||
|
||||
(blocktranslate_block
|
||||
tag: ("blocktranslate") @library.i18n)
|
||||
(blocktranslate_tag
|
||||
tag_name: ("blocktranslate") @library.i18n)
|
||||
|
||||
(translate_block
|
||||
tag: [
|
||||
(translate_tag
|
||||
tag_name: [
|
||||
("trans")
|
||||
("translate")] @library.i18n)
|
||||
|
||||
(language_block
|
||||
tag: ("language") @library.i18n)
|
||||
(language_tag
|
||||
tag_name: ("language") @library.i18n)
|
||||
|
||||
(get_available_languages_block
|
||||
tag: ("get_available_languages") @library.i18n)
|
||||
(get_available_languages_tag
|
||||
tag_name: ("get_available_languages") @library.i18n)
|
||||
|
||||
(get_current_language_block
|
||||
tag: ("get_current_language") @library.i18n)
|
||||
(get_current_language_tag
|
||||
tag_name: ("get_current_language") @library.i18n)
|
||||
|
||||
(get_current_language_bidi_block
|
||||
tag: ("get_current_language_bidi") @library.i18n)
|
||||
(get_current_language_bidi_tag
|
||||
tag_name: ("get_current_language_bidi") @library.i18n)
|
||||
|
||||
(get_language_info_block
|
||||
tag: ("get_language_info") @library.i18n)
|
||||
(get_language_info_tag
|
||||
tag_name: ("get_language_info") @library.i18n)
|
||||
|
||||
(get_language_info_list_block
|
||||
tag: ("get_language_info_list") @library.i18n)
|
||||
(get_language_info_list_tag
|
||||
tag_name: ("get_language_info_list") @library.i18n)
|
||||
|
||||
(filter
|
||||
name: [
|
||||
filter_name: [
|
||||
("language_bidi")
|
||||
("language_name")
|
||||
("language_name_local")
|
||||
("language_name_translated")] @library.i18n)
|
||||
|
||||
(cache_block
|
||||
tag: ("cache") @library.cache)
|
||||
(cache_tag
|
||||
tag_name: ("cache") @library.cache)
|
||||
|
||||
(localize_block
|
||||
tag: ("localize") @library.l10n)
|
||||
(localize_tag
|
||||
tag_name: ("localize") @library.l10n)
|
||||
|
||||
(filter
|
||||
name: [
|
||||
filter_name: [
|
||||
("localize")
|
||||
("unlocalize")] @library.l10n)
|
||||
|
||||
(localtime_block
|
||||
tag: ("localtime") @library.tz)
|
||||
(localtime_tag
|
||||
tag_name: ("localtime") @library.tz)
|
||||
|
||||
(timezone_block
|
||||
tag: ("timezone") @library.tz)
|
||||
(timezone_tag
|
||||
tag_name: ("timezone") @library.tz)
|
||||
|
||||
(get_current_timezone_block
|
||||
tag: ("get_current_timezone") @library.tz)
|
||||
(get_current_timezone_tag
|
||||
tag_name: ("get_current_timezone") @library.tz)
|
||||
|
||||
(filter
|
||||
name: [
|
||||
filter_name: [
|
||||
("localtime")
|
||||
("timezone")
|
||||
("utc")] @library.tz)
|
||||
|
||||
; "{% load static %}" makes every name in the library available; "{% load
|
||||
; static from staticfiles %}" makes only the names listed available.
|
||||
(load_block
|
||||
(load_tag
|
||||
(library) @load.library)
|
||||
|
||||
(load_block
|
||||
(load_tag
|
||||
(identifier) @load.name)
|
||||
+9
-9
@@ -6,22 +6,22 @@ variable: (identifier) @local.definition
|
||||
; The tags whose Node pushes a context, so that what they bind is not visible
|
||||
; after them. Verified by rendering: "{% block b %}{% now "Y" as n %}{% endblock %}{{ n }}"
|
||||
; is empty, while the same around an "{% if %}" is not, because if does not push.
|
||||
(with_clause) @local.scope
|
||||
(for_clause) @local.scope
|
||||
(block_clause) @local.scope
|
||||
(partialdef_clause) @local.scope
|
||||
(with_block) @local.scope
|
||||
(for_block) @local.scope
|
||||
(block_block) @local.scope
|
||||
(partialdef_block) @local.scope
|
||||
|
||||
; ForNode renders nodelist_empty inside the same context.push() as the loop
|
||||
; body, so "{% empty %}" is part of the loop's scope even though it is a
|
||||
; separate clause: "{% for x in ys %}a{% empty %}{% now "Y" as n %}{% endfor %}{{ n }}"
|
||||
; is empty. queries/conditionals.scm names both clauses as branches of the
|
||||
; separate block: "{% for x in ys %}a{% empty %}{% now "Y" as n %}{% endfor %}{{ n }}"
|
||||
; is empty. queries/conditionals.scm names both blocks as branches of the
|
||||
; same group and relies on this.
|
||||
(empty_clause) @local.scope
|
||||
(empty_block) @local.scope
|
||||
|
||||
; blocktranslate pushes a context for its "with" and "count" bindings. Its
|
||||
; asvar target is not one of them: it is written in the same tag but assigned
|
||||
; outside it, and carries an "asvar" field rather than "variable" so that this
|
||||
; scope does not swallow it. A tool that wants it must define it in the scope
|
||||
; around the block, which a locals query has no way to say.
|
||||
(blocktrans_clause) @local.scope
|
||||
(blocktranslate_clause) @local.scope
|
||||
(blocktrans_block) @local.scope
|
||||
(blocktranslate_block) @local.scope
|
||||
+10
-10
@@ -1,20 +1,20 @@
|
||||
(load_block
|
||||
(load_tag
|
||||
(identifier) @name) @definition.function
|
||||
|
||||
(partialdef_block (push_partial) @name) @definition.method
|
||||
(partial_block (identifier) @name) @reference.call
|
||||
(partialdef_tag (push_partial) @name) @definition.method
|
||||
(partial_tag (identifier) @name) @reference.call
|
||||
|
||||
; a tag that opens no body names itself; a group is named by the first block of
|
||||
; its first clause, so neither its end block nor the blocks opening its later
|
||||
; clauses are references of their own
|
||||
(tag_block_group
|
||||
tag: _ @name) @reference.call
|
||||
; a tag that opens no body names itself; a group is named by the first tag of
|
||||
; its first block, so neither its end tag nor the tags opening its later blocks
|
||||
; are references of their own
|
||||
(template_tag
|
||||
tag_name: _ @name) @reference.call
|
||||
|
||||
(tag_block_group
|
||||
(template_tag
|
||||
.
|
||||
(_
|
||||
.
|
||||
(_
|
||||
tag: _ @name))) @reference.call
|
||||
tag_name: _ @name))) @reference.call
|
||||
|
||||
(filter) @reference.call
|
||||
Reference in new issue
Block a user