add tests and queries
This commit is contained in:
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"parser-directories": ["."]
|
||||||
|
}
|
||||||
+165
-120
@@ -28,28 +28,24 @@ const django = grammar({
|
|||||||
$.matcher_error,
|
$.matcher_error,
|
||||||
],
|
],
|
||||||
reserved: {
|
reserved: {
|
||||||
global: ($) => ["not", "if", "in", "is", "as"],
|
global: ($) => ["not", "if", "in", "is", "as", "for", "from"],
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
template: ($) => repeat1(choice($.template_tag, $.content)),
|
template: ($) => repeat1(choice($.template_tag, $.content)),
|
||||||
content: ($) => /(?:[^\{]|\{[^\{#%}])+/,
|
content: ($) => /(?:[^\{]|\{[^\{#%}])+/,
|
||||||
template_tag: ($) => choice($.template_block_groups, $.template_variable, $.template_comment),
|
template_tag: ($) =>
|
||||||
filtered_value: ($) => seq(
|
choice($.template_block_groups, $.template_variable, $.template_comment),
|
||||||
$.value,
|
filtered_value: ($) =>
|
||||||
optional(
|
seq($.value, optional(seq(token.immediate("|"), $.filter_expression))),
|
||||||
seq(
|
filter_expression: ($) =>
|
||||||
token.immediate("|"),
|
seq($.filter, repeat(seq(token.immediate("|"), $.filter))),
|
||||||
$.filter_expression
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
filter_expression: ($) => seq($.filter, repeat(seq(token.immediate("|"), $.filter))),
|
|
||||||
value: ($) => choice($.literal, $.variable_attribute),
|
value: ($) => choice($.literal, $.variable_attribute),
|
||||||
literal: ($) => choice($.number, $.string),
|
literal: ($) => choice($.number, $.string),
|
||||||
number: ($) => /-?(?:[0-9]+(?:\.[0-9]*)?|\.[0-9]+)(?:[eE]-?[0-9]+)?/,
|
number: ($) => /-?(?:[0-9]+(?:\.[0-9]*)?|\.[0-9]+)(?:[eE]-?[0-9]+)?/,
|
||||||
string: ($) => /"(?:[^"\\]|\\\\|\\")*"|'(?:[^'\\]|\\\\|\\')*'/,
|
string: ($) => /"(?:[^"\\]|\\\\|\\")*"|'(?:[^'\\]|\\\\|\\')*'/,
|
||||||
attribute: ($) => /[a-zA-Z0-9_]+(?:\.[a-zA-Z0-9_]+)*/,
|
attribute: ($) => /[a-zA-Z0-9_]+(?:\.[a-zA-Z0-9_]+)*/,
|
||||||
variable_attribute: ($) => seq($.identifier, optional(seq(token.immediate('.'), $.attribute))),
|
variable_attribute: ($) =>
|
||||||
|
seq($.identifier, optional(seq(token.immediate("."), $.attribute))),
|
||||||
identifier: ($) => /[a-zA-Z][a-zA-Z0-9_]*/,
|
identifier: ($) => /[a-zA-Z][a-zA-Z0-9_]*/,
|
||||||
binaryOperator: ($) =>
|
binaryOperator: ($) =>
|
||||||
choice(
|
choice(
|
||||||
@@ -64,13 +60,13 @@ const django = grammar({
|
|||||||
"in",
|
"in",
|
||||||
prec(1, seq("not", "in")),
|
prec(1, seq("not", "in")),
|
||||||
"is",
|
"is",
|
||||||
prec(1, seq("is", "not"))
|
prec(1, seq("is", "not")),
|
||||||
),
|
),
|
||||||
predicate: ($) =>
|
predicate: ($) =>
|
||||||
seq(
|
seq(
|
||||||
optional("not"),
|
optional("not"),
|
||||||
$.filtered_value,
|
$.filtered_value,
|
||||||
repeat(seq($.binaryOperator, optional("not"), $.filtered_value))
|
repeat(seq($.binaryOperator, optional("not"), $.filtered_value)),
|
||||||
),
|
),
|
||||||
template_variable: ($) => seq("{{", $.filtered_value, "}}"),
|
template_variable: ($) => seq("{{", $.filtered_value, "}}"),
|
||||||
template_comment: ($) => seq("{#", /(?:[^#]|#[^}])*/, "#}"),
|
template_comment: ($) => seq("{#", /(?:[^#]|#[^}])*/, "#}"),
|
||||||
@@ -89,6 +85,7 @@ const django = grammar({
|
|||||||
$.if_group,
|
$.if_group,
|
||||||
$.ifchanged_group,
|
$.ifchanged_group,
|
||||||
$.include,
|
$.include,
|
||||||
|
$.load,
|
||||||
$.lorem,
|
$.lorem,
|
||||||
$.now,
|
$.now,
|
||||||
$.partial,
|
$.partial,
|
||||||
@@ -100,106 +97,127 @@ const django = grammar({
|
|||||||
$.template_tag_block,
|
$.template_tag_block,
|
||||||
$.url_block,
|
$.url_block,
|
||||||
$.verbatim_group,
|
$.verbatim_group,
|
||||||
$.with_group
|
$.width_ratio,
|
||||||
|
$.with_group,
|
||||||
|
),
|
||||||
|
filter: ($) =>
|
||||||
|
choice(
|
||||||
|
seq("add:", $.value),
|
||||||
|
"addslashes",
|
||||||
|
"capfirst",
|
||||||
|
seq("center:", $.value),
|
||||||
|
seq("cut:", $.value),
|
||||||
|
choice(seq("date:", $.value), "date"),
|
||||||
|
seq("default:", $.value),
|
||||||
|
seq("default_if_none:", $.value),
|
||||||
|
seq("dictsort:", $.value),
|
||||||
|
seq("dictsortreversed:", $.value),
|
||||||
|
seq("divisibleby:", $.value),
|
||||||
|
"escape",
|
||||||
|
"escapejs",
|
||||||
|
"filesizeformat",
|
||||||
|
"first",
|
||||||
|
choice(seq("floatformat:", $.value), "floatformat"),
|
||||||
|
"force_escape",
|
||||||
|
seq("get_digit:", $.value),
|
||||||
|
"iriencode",
|
||||||
|
seq("join:", $.value),
|
||||||
|
choice(seq("json_script:", $.value), "json_script"),
|
||||||
|
"last",
|
||||||
|
"length",
|
||||||
|
seq("length_is:", $.value),
|
||||||
|
"linebreaks",
|
||||||
|
"linebreaksbr",
|
||||||
|
"linenumbers",
|
||||||
|
seq("ljust:", $.value),
|
||||||
|
"lower",
|
||||||
|
"make_list",
|
||||||
|
"phone2numeric",
|
||||||
|
choice(seq("pluralize:", $.value), "pluralize"),
|
||||||
|
"pprint",
|
||||||
|
"random",
|
||||||
|
seq("rjust:", $.value),
|
||||||
|
"safe",
|
||||||
|
"safeseq",
|
||||||
|
seq("slice:", $.value),
|
||||||
|
"slugify",
|
||||||
|
seq("stringformat:", $.value),
|
||||||
|
"striptags",
|
||||||
|
choice(seq("time:", $.value), "time"),
|
||||||
|
choice(seq("timesince:", $.value), "timesince"),
|
||||||
|
choice(seq("timeuntil:", $.value), "timeuntil"),
|
||||||
|
"title",
|
||||||
|
seq("truncatechars:", $.value),
|
||||||
|
seq("truncatechars_html:", $.value),
|
||||||
|
seq("truncatewords:", $.value),
|
||||||
|
seq("truncatewords_html:", $.value),
|
||||||
|
"unordered_list",
|
||||||
|
"upper",
|
||||||
|
choice(seq("urlencode:", $.value), "urlencode"),
|
||||||
|
"urlize",
|
||||||
|
seq("urlizetrunc:", $.value),
|
||||||
|
"wordcount",
|
||||||
|
seq("wordwrap:", $.value),
|
||||||
|
choice(seq("yesno:", $.value), "yesno"),
|
||||||
),
|
),
|
||||||
filter: ($) => choice(
|
|
||||||
seq("add:", $.value),
|
|
||||||
"addslashes",
|
|
||||||
"capfirst",
|
|
||||||
seq("center:", $.value),
|
|
||||||
seq("cut:", $.value),
|
|
||||||
choice(seq("date:", $.value), "date"),
|
|
||||||
seq("default:", $.value),
|
|
||||||
seq("default_if_none:", $.value),
|
|
||||||
seq("dictsort:", $.value),
|
|
||||||
seq("dictsortreversed:", $.value),
|
|
||||||
seq("divisibleby:", $.value),
|
|
||||||
"escape",
|
|
||||||
"escapejs",
|
|
||||||
"filesizeformat",
|
|
||||||
"first",
|
|
||||||
choice(seq("floatformat:", $.value), "floatformat"),
|
|
||||||
"force_escape",
|
|
||||||
seq("get_digit:", $.value),
|
|
||||||
"iriencode",
|
|
||||||
seq("join:", $.value),
|
|
||||||
choice(seq("json_script:", $.value), "json_script"),
|
|
||||||
"last",
|
|
||||||
"length",
|
|
||||||
seq("length_is:", $.value),
|
|
||||||
"linebreaks",
|
|
||||||
"linebreaksbr",
|
|
||||||
"linenumbers",
|
|
||||||
seq("ljust:", $.value),
|
|
||||||
"lower",
|
|
||||||
"make_list",
|
|
||||||
"phone2numeric",
|
|
||||||
choice(seq("pluralize:", $.value), "pluralize"),
|
|
||||||
"pprint",
|
|
||||||
"random",
|
|
||||||
seq("rjust:", $.value),
|
|
||||||
"safe",
|
|
||||||
"safeseq",
|
|
||||||
seq("slice:", $.value),
|
|
||||||
"slugify",
|
|
||||||
seq("stringformat:", $.value),
|
|
||||||
"striptags",
|
|
||||||
choice(seq("time:", $.value), "time"),
|
|
||||||
choice(seq("timesince:", $.value), "timesince"),
|
|
||||||
choice(seq("timeuntil:", $.value), "timeuntil"),
|
|
||||||
"title",
|
|
||||||
seq("truncatechars:", $.value),
|
|
||||||
seq("truncatechars_html:", $.value),
|
|
||||||
seq("truncatewords:", $.value),
|
|
||||||
seq("truncatewords_html:", $.value),
|
|
||||||
"unordered_list",
|
|
||||||
"upper",
|
|
||||||
choice(seq("urlencode:", $.value), "urlencode"),
|
|
||||||
"urlize",
|
|
||||||
seq("urlizetrunc:", $.value),
|
|
||||||
"wordcount",
|
|
||||||
seq("wordwrap:", $.value),
|
|
||||||
choice(seq("yesno:", $.value), "yesno"),
|
|
||||||
),
|
|
||||||
autoescape_group: ($) =>
|
autoescape_group: ($) =>
|
||||||
seq(block("autoescape", choice("on", "off")), optional($.template), block("endautoescape")),
|
seq(
|
||||||
|
block("autoescape", choice("on", "off")),
|
||||||
|
optional($.template),
|
||||||
|
block("endautoescape"),
|
||||||
|
),
|
||||||
block_group: ($) =>
|
block_group: ($) =>
|
||||||
seq(
|
seq(
|
||||||
block("block", field("name", $.push_block)),
|
block("block", field("name", $.push_block)),
|
||||||
optional($.template),
|
optional($.template),
|
||||||
block("endblock", $.pop_block)
|
block("endblock", $.pop_block),
|
||||||
),
|
),
|
||||||
comment_group: ($) =>
|
comment_group: ($) =>
|
||||||
seq(
|
seq(
|
||||||
block("comment", optional($.string)),
|
block("comment", optional($.string)),
|
||||||
optional($.comment_content),
|
optional($.comment_content),
|
||||||
prec(1, block("endcomment"))
|
block("endcomment"),
|
||||||
),
|
),
|
||||||
csrf_token: ($) => block("csrf_token"),
|
csrf_token: ($) => block("csrf_token"),
|
||||||
cycle: ($) =>
|
cycle: ($) =>
|
||||||
block(
|
block(
|
||||||
"cycle",
|
"cycle",
|
||||||
repeat1($.filtered_value),
|
repeat1($.filtered_value),
|
||||||
optional(seq("as", field("name", $.identifier))),
|
optional(seq("as", field("variable", $.identifier))),
|
||||||
optional("silent")
|
optional("silent"),
|
||||||
),
|
),
|
||||||
debug: ($) => block("debug"),
|
debug: ($) => block("debug"),
|
||||||
extends: ($) => block("extends", $.filtered_value),
|
extends: ($) => block("extends", $.filtered_value),
|
||||||
filter_group: ($) =>
|
filter_group: ($) =>
|
||||||
seq(block("filter", $.filter_expression), optional($.template), block("endfilter")),
|
seq(
|
||||||
firstof: ($) => block("firstof", repeat1($.filtered_value), optional(seq("as", $.identifier))),
|
block("filter", $.filter_expression),
|
||||||
|
optional($.template),
|
||||||
|
block("endfilter"),
|
||||||
|
),
|
||||||
|
firstof: ($) =>
|
||||||
|
block(
|
||||||
|
"firstof",
|
||||||
|
repeat1($.filtered_value),
|
||||||
|
optional(seq("as", $.identifier)),
|
||||||
|
),
|
||||||
|
for_scope: ($) =>
|
||||||
|
prec.left(
|
||||||
|
seq(
|
||||||
|
block(
|
||||||
|
"for",
|
||||||
|
field("variable", $.identifier),
|
||||||
|
repeat(seq(",", field("variable", $.identifier))),
|
||||||
|
"in",
|
||||||
|
$.filtered_value,
|
||||||
|
),
|
||||||
|
optional($.template),
|
||||||
|
),
|
||||||
|
),
|
||||||
for_group: ($) =>
|
for_group: ($) =>
|
||||||
seq(
|
seq(
|
||||||
block(
|
$.for_scope,
|
||||||
"for",
|
|
||||||
field("variables", $.identifier),
|
|
||||||
repeat(seq(",", field("variables", $.identifier))),
|
|
||||||
"in",
|
|
||||||
$.filtered_value
|
|
||||||
),
|
|
||||||
optional($.template),
|
|
||||||
optional(seq(block("empty"), optional($.template))),
|
optional(seq(block("empty"), optional($.template))),
|
||||||
block("endfor")
|
block("endfor"),
|
||||||
),
|
),
|
||||||
if_group: ($) =>
|
if_group: ($) =>
|
||||||
seq(
|
seq(
|
||||||
@@ -207,44 +225,61 @@ const django = grammar({
|
|||||||
optional($.template),
|
optional($.template),
|
||||||
repeat(seq(block("elif", $.predicate), optional($.template))),
|
repeat(seq(block("elif", $.predicate), optional($.template))),
|
||||||
optional(seq(block("else"), optional($.template))),
|
optional(seq(block("else"), optional($.template))),
|
||||||
block("endif")
|
block("endif"),
|
||||||
),
|
),
|
||||||
ifchanged_group: ($) =>
|
ifchanged_group: ($) =>
|
||||||
seq(
|
seq(
|
||||||
block("ifchanged", repeat($.filtered_value)),
|
block("ifchanged", repeat($.filtered_value)),
|
||||||
optional($.template),
|
optional($.template),
|
||||||
block("endifchanged")
|
block("endifchanged"),
|
||||||
),
|
),
|
||||||
include: ($) => block("include", $.filtered_value),
|
include: ($) => block("include", $.filtered_value),
|
||||||
|
library: ($) =>
|
||||||
|
prec(
|
||||||
|
-1,
|
||||||
|
seq($.identifier, optional(seq(token.immediate("."), $.identifier))),
|
||||||
|
),
|
||||||
load: ($) =>
|
load: ($) =>
|
||||||
block(
|
block(
|
||||||
"load",
|
"load",
|
||||||
choice(
|
choice(
|
||||||
repeat1($.variable_attribute),
|
seq(repeat1($.identifier), "from", $.library),
|
||||||
seq(repeat1($.identifier), "from", $.variable_attribute)
|
repeat1($.library),
|
||||||
)
|
),
|
||||||
),
|
),
|
||||||
lorem: ($) => block("lorem", $.filtered_value, choice("w", "p", "b"), optional("random")),
|
lorem: ($) =>
|
||||||
now: ($) => block("now", $.string, optional(seq("as", field("variable", $.identifier)))),
|
block(
|
||||||
partial: ($) => block("partial", field("name", $.identifier)),
|
"lorem",
|
||||||
|
$.filtered_value,
|
||||||
|
choice("w", "p", "b"),
|
||||||
|
optional("random"),
|
||||||
|
),
|
||||||
|
now: ($) =>
|
||||||
|
block("now", $.string, optional(seq("as", field("name", $.identifier)))),
|
||||||
|
partial: ($) => block("partial", $.identifier),
|
||||||
partialdef_group: ($) =>
|
partialdef_group: ($) =>
|
||||||
seq(
|
seq(
|
||||||
block("partialdef", field("name", $.push_partial), optional("inline")),
|
block("partialdef", $.push_partial, optional("inline")),
|
||||||
optional($.template),
|
optional($.template),
|
||||||
block("endpartialdef", $.pop_partial)
|
block("endpartialdef", $.pop_partial),
|
||||||
),
|
),
|
||||||
query_string: ($) =>
|
query_string: ($) =>
|
||||||
block("querystring", repeat($.identifier), repeat(seq($.identifier, "=", $.filtered_value))),
|
block(
|
||||||
|
"querystring",
|
||||||
|
repeat($.identifier),
|
||||||
|
repeat(seq($.identifier, "=", $.filtered_value)),
|
||||||
|
),
|
||||||
regroup: ($) =>
|
regroup: ($) =>
|
||||||
block(
|
block(
|
||||||
"regroup",
|
"regroup",
|
||||||
$.filtered_value,
|
$.filtered_value,
|
||||||
"by",
|
"by",
|
||||||
$.attribute,
|
$.attribute,
|
||||||
optional(seq("as", field("variable", $.identifier)))
|
optional(seq("as", field("variable", $.identifier))),
|
||||||
),
|
),
|
||||||
reset_cycle: ($) => block("resetcycle", optional($.identifier)),
|
reset_cycle: ($) => block("resetcycle", optional($.identifier)),
|
||||||
spaceless_group: ($) => seq(block("spaceless"), optional($.template), block("endspaceless")),
|
spaceless_group: ($) =>
|
||||||
|
seq(block("spaceless"), optional($.template), block("endspaceless")),
|
||||||
template_tag_block: ($) =>
|
template_tag_block: ($) =>
|
||||||
block(
|
block(
|
||||||
"templatetag",
|
"templatetag",
|
||||||
@@ -256,33 +291,43 @@ const django = grammar({
|
|||||||
"openbrace",
|
"openbrace",
|
||||||
"closebrace",
|
"closebrace",
|
||||||
"opencomment",
|
"opencomment",
|
||||||
"closecomment"
|
"closecomment",
|
||||||
)
|
|
||||||
),
|
|
||||||
url_block: $ => block(
|
|
||||||
"url",
|
|
||||||
choice($.string, $.identifier),
|
|
||||||
optional(
|
|
||||||
choice(
|
|
||||||
repeat1($.filtered_value),
|
|
||||||
repeat1(seq($.identifier, '=', $.filtered_value)),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
optional(
|
url_block: ($) =>
|
||||||
seq("as", field("variable", $.identifier)),
|
block(
|
||||||
|
"url",
|
||||||
|
choice($.string, $.identifier),
|
||||||
|
optional(
|
||||||
|
choice(
|
||||||
|
repeat1($.filtered_value),
|
||||||
|
repeat1(seq($.identifier, "=", $.filtered_value)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
optional(seq("as", field("variable", $.identifier))),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
verbatim_group: ($) =>
|
verbatim_group: ($) =>
|
||||||
seq(
|
seq(
|
||||||
block("verbatim", field("name", $.push_verbatim)),
|
block("verbatim", $.push_verbatim),
|
||||||
optional($.verbatim_content),
|
optional($.verbatim_content),
|
||||||
block("endverbatim", $.pop_verbatim),
|
block("endverbatim", $.pop_verbatim),
|
||||||
),
|
),
|
||||||
|
width_ratio: ($) =>
|
||||||
|
block(
|
||||||
|
"widthratio",
|
||||||
|
$.filtered_value,
|
||||||
|
$.filtered_value,
|
||||||
|
$.filtered_value,
|
||||||
|
optional(seq("as", field("variable", $.identifier))),
|
||||||
|
),
|
||||||
with_group: ($) =>
|
with_group: ($) =>
|
||||||
seq(
|
seq(
|
||||||
block("with", field("variables", repeat1(seq(field("name", $.identifier), "=", $.filtered_value)))),
|
block(
|
||||||
|
"with",
|
||||||
|
repeat1(seq(field("variable", $.identifier), "=", $.filtered_value)),
|
||||||
|
),
|
||||||
optional($.template),
|
optional($.template),
|
||||||
block("endwith")
|
block("endwith"),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -12,6 +12,8 @@
|
|||||||
"parser-test": "tree-sitter test",
|
"parser-test": "tree-sitter test",
|
||||||
"parser-generate": "tree-sitter generate",
|
"parser-generate": "tree-sitter generate",
|
||||||
"parser-build": "tree-sitter build --wasm",
|
"parser-build": "tree-sitter build --wasm",
|
||||||
|
"highlight": "tree-sitter highlight",
|
||||||
|
"tag": "tree-sitter tag",
|
||||||
"playground": "tree-sitter playground"
|
"playground": "tree-sitter playground"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
+145
-14
@@ -1,29 +1,160 @@
|
|||||||
; Identifiers
|
|
||||||
|
|
||||||
(cycle name:
|
(identifier) @variable
|
||||||
name: (identifier) @variable)
|
|
||||||
|
variable: (identifier) @variable.parameter
|
||||||
|
|
||||||
|
|
||||||
(block_group
|
(block_group
|
||||||
name: (push_block) @block_name)
|
(push_block) @type)
|
||||||
|
|
||||||
(partialdef_group
|
(partialdef_group
|
||||||
name: (push_partial) @partial_name)
|
(push_partial) @type)
|
||||||
|
|
||||||
(verbatim_group
|
(verbatim_group
|
||||||
name: (push_verbatim) @verbatim_name)
|
(push_verbatim) @type)
|
||||||
|
|
||||||
(with_group
|
(comment_content) @comment
|
||||||
variables: (_
|
(template_comment) @comment
|
||||||
name: (identifier) @variable))
|
(attribute) @attribute
|
||||||
|
|
||||||
; Literals
|
[
|
||||||
|
(binaryOperator)
|
||||||
|
("is")
|
||||||
|
("not")
|
||||||
|
("as")
|
||||||
|
("in")
|
||||||
|
("=")
|
||||||
|
("|")
|
||||||
|
(".")] @operator
|
||||||
|
|
||||||
|
[
|
||||||
|
("{{")
|
||||||
|
("{#")
|
||||||
|
("{%")
|
||||||
|
("}}")
|
||||||
|
("#}")
|
||||||
|
("%}")
|
||||||
|
(",")] @punctuation
|
||||||
|
|
||||||
(number) @number
|
(number) @number
|
||||||
(string) @string
|
(string) @string
|
||||||
|
|
||||||
; Constants
|
(library
|
||||||
|
(identifier) @module)
|
||||||
|
|
||||||
(template_block_groups
|
tag: [
|
||||||
tag: (_) @tag)
|
("autoescape")
|
||||||
|
("endautoescape")
|
||||||
|
("block")
|
||||||
|
("endblock")
|
||||||
|
("comment")
|
||||||
|
("endcomment")
|
||||||
|
("csrf_token")
|
||||||
|
("cycle")
|
||||||
|
("debug")
|
||||||
|
("extends")
|
||||||
|
("filter")
|
||||||
|
("endfilter")
|
||||||
|
("firstof")
|
||||||
|
("for")
|
||||||
|
("empty")
|
||||||
|
("endfor")
|
||||||
|
("for")
|
||||||
|
("empty")
|
||||||
|
("endfor")
|
||||||
|
("if")
|
||||||
|
("elif")
|
||||||
|
("else")
|
||||||
|
("endif")
|
||||||
|
("ifchanged")
|
||||||
|
("endifchanged")
|
||||||
|
("include")
|
||||||
|
("lorem")
|
||||||
|
("load")
|
||||||
|
("now")
|
||||||
|
("partial")
|
||||||
|
("partialdef")
|
||||||
|
("endpartialdef")
|
||||||
|
("querystring")
|
||||||
|
("regroup")
|
||||||
|
("resetcycle")
|
||||||
|
("spaceless")
|
||||||
|
("endspaceless")
|
||||||
|
("templatetag")
|
||||||
|
("url")
|
||||||
|
("verbatim")
|
||||||
|
("endverbatim")
|
||||||
|
("with")
|
||||||
|
("endwith")] @function
|
||||||
|
|
||||||
(filter . (_) @filter)
|
(filter .
|
||||||
|
[
|
||||||
|
("add:")
|
||||||
|
("addslashes")
|
||||||
|
("capfirst")
|
||||||
|
("center:")
|
||||||
|
("cut:")
|
||||||
|
("date")
|
||||||
|
("date:")
|
||||||
|
("default:")
|
||||||
|
("default_if_none:")
|
||||||
|
("dictsort:")
|
||||||
|
("dictsortreversed:")
|
||||||
|
("divisibleby:")
|
||||||
|
("escape")
|
||||||
|
("escapejs")
|
||||||
|
("filesizeformat")
|
||||||
|
("first")
|
||||||
|
("floatformat")
|
||||||
|
("floatformat:")
|
||||||
|
("force_escape")
|
||||||
|
("get_digit:")
|
||||||
|
("iriencode")
|
||||||
|
("join:")
|
||||||
|
("json_script")
|
||||||
|
("json_script:")
|
||||||
|
("last")
|
||||||
|
("length")
|
||||||
|
("length_is:")
|
||||||
|
("linebreaks")
|
||||||
|
("linebreaksbr")
|
||||||
|
("linenumbers")
|
||||||
|
("ljust:")
|
||||||
|
("lower")
|
||||||
|
("make_list")
|
||||||
|
("phone2numeric")
|
||||||
|
("pluralize")
|
||||||
|
("pluralize:")
|
||||||
|
("pprint")
|
||||||
|
("random")
|
||||||
|
("rjust:")
|
||||||
|
("safe")
|
||||||
|
("safeseq")
|
||||||
|
("slice:")
|
||||||
|
("slugify")
|
||||||
|
("stringformat:")
|
||||||
|
("striptags")
|
||||||
|
("time")
|
||||||
|
("time:")
|
||||||
|
("timesince")
|
||||||
|
("timesince:")
|
||||||
|
("timeuntil")
|
||||||
|
("timeuntil:")
|
||||||
|
("title")
|
||||||
|
("truncatechars:")
|
||||||
|
("truncatechars_html:")
|
||||||
|
("truncatewords:")
|
||||||
|
("truncatewords_html:")
|
||||||
|
("unordered_list")
|
||||||
|
("upper")
|
||||||
|
("urlencode")
|
||||||
|
("urlencode:")
|
||||||
|
("urlize")
|
||||||
|
("urlizetrunc:")
|
||||||
|
("wordcount")
|
||||||
|
("wordwrap:")
|
||||||
|
("yesno")
|
||||||
|
("yesno:")] @function)
|
||||||
|
|
||||||
|
(load
|
||||||
|
(identifier) @function)
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
[(content) (verbatim_content)] @injection.content @injection.combined
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
(identifier) @local.reference
|
||||||
|
|
||||||
|
variable: (identifier) @local.definition
|
||||||
|
|
||||||
|
(with_group) @local.scope
|
||||||
|
(for_scope) @local.scope
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
(load
|
||||||
|
(identifier) @name) @definition.function
|
||||||
|
|
||||||
|
(partialdef_group (push_partial) @name) @definition.method
|
||||||
|
(partial (identifier) @name) @reference.call
|
||||||
|
|
||||||
|
(template_block_groups
|
||||||
|
[
|
||||||
|
(_
|
||||||
|
tag: _ @name) @reference.call
|
||||||
|
(for_group
|
||||||
|
(for_scope
|
||||||
|
tag: "for" @reference.call))])
|
||||||
|
|
||||||
|
(filter) @reference.call
|
||||||
+242
-138
@@ -392,6 +392,10 @@
|
|||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "include"
|
"name": "include"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "load"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "lorem"
|
"name": "lorem"
|
||||||
@@ -436,6 +440,10 @@
|
|||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "verbatim_group"
|
"name": "verbatim_group"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "width_ratio"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "with_group"
|
"name": "with_group"
|
||||||
@@ -1218,29 +1226,25 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "PREC",
|
"type": "SEQ",
|
||||||
"value": 1,
|
"members": [
|
||||||
"content": {
|
{
|
||||||
"type": "SEQ",
|
"type": "STRING",
|
||||||
"members": [
|
"value": "{%"
|
||||||
{
|
},
|
||||||
|
{
|
||||||
|
"type": "FIELD",
|
||||||
|
"name": "tag",
|
||||||
|
"content": {
|
||||||
"type": "STRING",
|
"type": "STRING",
|
||||||
"value": "{%"
|
"value": "endcomment"
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "FIELD",
|
|
||||||
"name": "tag",
|
|
||||||
"content": {
|
|
||||||
"type": "STRING",
|
|
||||||
"value": "endcomment"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "STRING",
|
|
||||||
"value": "%}"
|
|
||||||
}
|
}
|
||||||
]
|
},
|
||||||
}
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "%}"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -1299,7 +1303,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "FIELD",
|
"type": "FIELD",
|
||||||
"name": "name",
|
"name": "variable",
|
||||||
"content": {
|
"content": {
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "identifier"
|
"name": "identifier"
|
||||||
@@ -1488,77 +1492,90 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"for_scope": {
|
||||||
|
"type": "PREC_LEFT",
|
||||||
|
"value": 0,
|
||||||
|
"content": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "{%"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "FIELD",
|
||||||
|
"name": "tag",
|
||||||
|
"content": {
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "for"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "FIELD",
|
||||||
|
"name": "variable",
|
||||||
|
"content": {
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "identifier"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "REPEAT",
|
||||||
|
"content": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": ","
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "FIELD",
|
||||||
|
"name": "variable",
|
||||||
|
"content": {
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "in"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "filtered_value"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "%}"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "CHOICE",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "template"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "BLANK"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
"for_group": {
|
"for_group": {
|
||||||
"type": "SEQ",
|
"type": "SEQ",
|
||||||
"members": [
|
"members": [
|
||||||
{
|
{
|
||||||
"type": "SEQ",
|
"type": "SYMBOL",
|
||||||
"members": [
|
"name": "for_scope"
|
||||||
{
|
|
||||||
"type": "STRING",
|
|
||||||
"value": "{%"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "FIELD",
|
|
||||||
"name": "tag",
|
|
||||||
"content": {
|
|
||||||
"type": "STRING",
|
|
||||||
"value": "for"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "FIELD",
|
|
||||||
"name": "variables",
|
|
||||||
"content": {
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "identifier"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "REPEAT",
|
|
||||||
"content": {
|
|
||||||
"type": "SEQ",
|
|
||||||
"members": [
|
|
||||||
{
|
|
||||||
"type": "STRING",
|
|
||||||
"value": ","
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "FIELD",
|
|
||||||
"name": "variables",
|
|
||||||
"content": {
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "identifier"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "STRING",
|
|
||||||
"value": "in"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "filtered_value"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "STRING",
|
|
||||||
"value": "%}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "CHOICE",
|
|
||||||
"members": [
|
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "template"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "BLANK"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "CHOICE",
|
"type": "CHOICE",
|
||||||
@@ -1874,6 +1891,43 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"library": {
|
||||||
|
"type": "PREC",
|
||||||
|
"value": -1,
|
||||||
|
"content": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "identifier"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "CHOICE",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "IMMEDIATE_TOKEN",
|
||||||
|
"content": {
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "identifier"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "BLANK"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
"load": {
|
"load": {
|
||||||
"type": "SEQ",
|
"type": "SEQ",
|
||||||
"members": [
|
"members": [
|
||||||
@@ -1892,13 +1946,6 @@
|
|||||||
{
|
{
|
||||||
"type": "CHOICE",
|
"type": "CHOICE",
|
||||||
"members": [
|
"members": [
|
||||||
{
|
|
||||||
"type": "REPEAT1",
|
|
||||||
"content": {
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "variable_attribute"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "SEQ",
|
"type": "SEQ",
|
||||||
"members": [
|
"members": [
|
||||||
@@ -1915,9 +1962,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "variable_attribute"
|
"name": "library"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "REPEAT1",
|
||||||
|
"content": {
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "library"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -2012,7 +2066,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "FIELD",
|
"type": "FIELD",
|
||||||
"name": "variable",
|
"name": "name",
|
||||||
"content": {
|
"content": {
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "identifier"
|
"name": "identifier"
|
||||||
@@ -2047,12 +2101,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "FIELD",
|
"type": "SYMBOL",
|
||||||
"name": "name",
|
"name": "identifier"
|
||||||
"content": {
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "identifier"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "STRING",
|
"type": "STRING",
|
||||||
@@ -2079,12 +2129,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "FIELD",
|
"type": "SYMBOL",
|
||||||
"name": "name",
|
"name": "push_partial"
|
||||||
"content": {
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "push_partial"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "CHOICE",
|
"type": "CHOICE",
|
||||||
@@ -2517,12 +2563,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "FIELD",
|
"type": "SYMBOL",
|
||||||
"name": "name",
|
"name": "push_verbatim"
|
||||||
"content": {
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "push_verbatim"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "STRING",
|
"type": "STRING",
|
||||||
@@ -2569,6 +2611,64 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"width_ratio": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "{%"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "FIELD",
|
||||||
|
"name": "tag",
|
||||||
|
"content": {
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "widthratio"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "filtered_value"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "filtered_value"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "filtered_value"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "CHOICE",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "as"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "FIELD",
|
||||||
|
"name": "variable",
|
||||||
|
"content": {
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "BLANK"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "%}"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"with_group": {
|
"with_group": {
|
||||||
"type": "SEQ",
|
"type": "SEQ",
|
||||||
"members": [
|
"members": [
|
||||||
@@ -2588,31 +2688,27 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "FIELD",
|
"type": "REPEAT1",
|
||||||
"name": "variables",
|
|
||||||
"content": {
|
"content": {
|
||||||
"type": "REPEAT1",
|
"type": "SEQ",
|
||||||
"content": {
|
"members": [
|
||||||
"type": "SEQ",
|
{
|
||||||
"members": [
|
"type": "FIELD",
|
||||||
{
|
"name": "variable",
|
||||||
"type": "FIELD",
|
"content": {
|
||||||
"name": "name",
|
|
||||||
"content": {
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "identifier"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "STRING",
|
|
||||||
"value": "="
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "filtered_value"
|
"name": "identifier"
|
||||||
}
|
}
|
||||||
]
|
},
|
||||||
}
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "="
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "filtered_value"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -2733,6 +2829,14 @@
|
|||||||
{
|
{
|
||||||
"type": "STRING",
|
"type": "STRING",
|
||||||
"value": "as"
|
"value": "as"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "for"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "from"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
+174
-73
@@ -55,6 +55,10 @@
|
|||||||
"type": "include",
|
"type": "include",
|
||||||
"named": true
|
"named": true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "load",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "lorem",
|
"type": "lorem",
|
||||||
"named": true
|
"named": true
|
||||||
@@ -99,6 +103,10 @@
|
|||||||
"type": "verbatim_group",
|
"type": "verbatim_group",
|
||||||
"named": true
|
"named": true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "width_ratio",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "with_group",
|
"type": "with_group",
|
||||||
"named": true
|
"named": true
|
||||||
@@ -256,16 +264,6 @@
|
|||||||
"type": "cycle",
|
"type": "cycle",
|
||||||
"named": true,
|
"named": true,
|
||||||
"fields": {
|
"fields": {
|
||||||
"name": {
|
|
||||||
"multiple": false,
|
|
||||||
"required": false,
|
|
||||||
"types": [
|
|
||||||
{
|
|
||||||
"type": "identifier",
|
|
||||||
"named": true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"tag": {
|
"tag": {
|
||||||
"multiple": false,
|
"multiple": false,
|
||||||
"required": true,
|
"required": true,
|
||||||
@@ -275,6 +273,16 @@
|
|||||||
"named": false
|
"named": false
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"variable": {
|
||||||
|
"multiple": false,
|
||||||
|
"required": false,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "identifier",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"children": {
|
"children": {
|
||||||
@@ -458,14 +466,40 @@
|
|||||||
{
|
{
|
||||||
"type": "endfor",
|
"type": "endfor",
|
||||||
"named": false
|
"named": false
|
||||||
},
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"children": {
|
||||||
|
"multiple": true,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "for_scope",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "template",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "for_scope",
|
||||||
|
"named": true,
|
||||||
|
"fields": {
|
||||||
|
"tag": {
|
||||||
|
"multiple": false,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
{
|
{
|
||||||
"type": "for",
|
"type": "for",
|
||||||
"named": false
|
"named": false
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"variables": {
|
"variable": {
|
||||||
"multiple": true,
|
"multiple": true,
|
||||||
"required": true,
|
"required": true,
|
||||||
"types": [
|
"types": [
|
||||||
@@ -593,6 +627,21 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "library",
|
||||||
|
"named": true,
|
||||||
|
"fields": {},
|
||||||
|
"children": {
|
||||||
|
"multiple": true,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "identifier",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "literal",
|
"type": "literal",
|
||||||
"named": true,
|
"named": true,
|
||||||
@@ -612,6 +661,36 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "load",
|
||||||
|
"named": true,
|
||||||
|
"fields": {
|
||||||
|
"tag": {
|
||||||
|
"multiple": false,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "load",
|
||||||
|
"named": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"children": {
|
||||||
|
"multiple": true,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "identifier",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "library",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "lorem",
|
"type": "lorem",
|
||||||
"named": true,
|
"named": true,
|
||||||
@@ -642,6 +721,16 @@
|
|||||||
"type": "now",
|
"type": "now",
|
||||||
"named": true,
|
"named": true,
|
||||||
"fields": {
|
"fields": {
|
||||||
|
"name": {
|
||||||
|
"multiple": false,
|
||||||
|
"required": false,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "identifier",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"tag": {
|
"tag": {
|
||||||
"multiple": false,
|
"multiple": false,
|
||||||
"required": true,
|
"required": true,
|
||||||
@@ -651,16 +740,6 @@
|
|||||||
"named": false
|
"named": false
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
|
||||||
"variable": {
|
|
||||||
"multiple": false,
|
|
||||||
"required": false,
|
|
||||||
"types": [
|
|
||||||
{
|
|
||||||
"type": "identifier",
|
|
||||||
"named": true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"children": {
|
"children": {
|
||||||
@@ -678,16 +757,6 @@
|
|||||||
"type": "partial",
|
"type": "partial",
|
||||||
"named": true,
|
"named": true,
|
||||||
"fields": {
|
"fields": {
|
||||||
"name": {
|
|
||||||
"multiple": false,
|
|
||||||
"required": true,
|
|
||||||
"types": [
|
|
||||||
{
|
|
||||||
"type": "identifier",
|
|
||||||
"named": true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"tag": {
|
"tag": {
|
||||||
"multiple": false,
|
"multiple": false,
|
||||||
"required": true,
|
"required": true,
|
||||||
@@ -698,22 +767,22 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"children": {
|
||||||
|
"multiple": false,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "identifier",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "partialdef_group",
|
"type": "partialdef_group",
|
||||||
"named": true,
|
"named": true,
|
||||||
"fields": {
|
"fields": {
|
||||||
"name": {
|
|
||||||
"multiple": false,
|
|
||||||
"required": true,
|
|
||||||
"types": [
|
|
||||||
{
|
|
||||||
"type": "push_partial",
|
|
||||||
"named": true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"tag": {
|
"tag": {
|
||||||
"multiple": true,
|
"multiple": true,
|
||||||
"required": true,
|
"required": true,
|
||||||
@@ -737,6 +806,10 @@
|
|||||||
"type": "pop_partial",
|
"type": "pop_partial",
|
||||||
"named": true
|
"named": true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "push_partial",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "template",
|
"type": "template",
|
||||||
"named": true
|
"named": true
|
||||||
@@ -1031,16 +1104,6 @@
|
|||||||
"type": "verbatim_group",
|
"type": "verbatim_group",
|
||||||
"named": true,
|
"named": true,
|
||||||
"fields": {
|
"fields": {
|
||||||
"name": {
|
|
||||||
"multiple": false,
|
|
||||||
"required": true,
|
|
||||||
"types": [
|
|
||||||
{
|
|
||||||
"type": "push_verbatim",
|
|
||||||
"named": true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"tag": {
|
"tag": {
|
||||||
"multiple": true,
|
"multiple": true,
|
||||||
"required": true,
|
"required": true,
|
||||||
@@ -1064,6 +1127,10 @@
|
|||||||
"type": "pop_verbatim",
|
"type": "pop_verbatim",
|
||||||
"named": true
|
"named": true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "push_verbatim",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "verbatim_content",
|
"type": "verbatim_content",
|
||||||
"named": true
|
"named": true
|
||||||
@@ -1071,20 +1138,46 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "width_ratio",
|
||||||
|
"named": true,
|
||||||
|
"fields": {
|
||||||
|
"tag": {
|
||||||
|
"multiple": false,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "widthratio",
|
||||||
|
"named": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"variable": {
|
||||||
|
"multiple": false,
|
||||||
|
"required": false,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "identifier",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"children": {
|
||||||
|
"multiple": true,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "filtered_value",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "with_group",
|
"type": "with_group",
|
||||||
"named": true,
|
"named": true,
|
||||||
"fields": {
|
"fields": {
|
||||||
"name": {
|
|
||||||
"multiple": true,
|
|
||||||
"required": true,
|
|
||||||
"types": [
|
|
||||||
{
|
|
||||||
"type": "identifier",
|
|
||||||
"named": true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"tag": {
|
"tag": {
|
||||||
"multiple": true,
|
"multiple": true,
|
||||||
"required": true,
|
"required": true,
|
||||||
@@ -1099,18 +1192,10 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"variables": {
|
"variable": {
|
||||||
"multiple": true,
|
"multiple": true,
|
||||||
"required": true,
|
"required": true,
|
||||||
"types": [
|
"types": [
|
||||||
{
|
|
||||||
"type": "=",
|
|
||||||
"named": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "filtered_value",
|
|
||||||
"named": true
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "identifier",
|
"type": "identifier",
|
||||||
"named": true
|
"named": true
|
||||||
@@ -1119,9 +1204,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"children": {
|
"children": {
|
||||||
"multiple": false,
|
"multiple": true,
|
||||||
"required": false,
|
"required": true,
|
||||||
"types": [
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "filtered_value",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "template",
|
"type": "template",
|
||||||
"named": true
|
"named": true
|
||||||
@@ -1389,6 +1478,10 @@
|
|||||||
"type": "force_escape",
|
"type": "force_escape",
|
||||||
"named": false
|
"named": false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "from",
|
||||||
|
"named": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "get_digit:",
|
"type": "get_digit:",
|
||||||
"named": false
|
"named": false
|
||||||
@@ -1465,6 +1558,10 @@
|
|||||||
"type": "ljust:",
|
"type": "ljust:",
|
||||||
"named": false
|
"named": false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "load",
|
||||||
|
"named": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "lorem",
|
"type": "lorem",
|
||||||
"named": false
|
"named": false
|
||||||
@@ -1713,6 +1810,10 @@
|
|||||||
"type": "w",
|
"type": "w",
|
||||||
"named": false
|
"named": false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "widthratio",
|
||||||
|
"named": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "with",
|
"type": "with",
|
||||||
"named": false
|
"named": false
|
||||||
|
|||||||
+9904
-10646
File diff suppressed because it is too large
Load Diff
@@ -44,7 +44,7 @@ Cycle With As
|
|||||||
(value
|
(value
|
||||||
(literal
|
(literal
|
||||||
(string))))
|
(string))))
|
||||||
name: (identifier))
|
variable: (identifier))
|
||||||
(content))
|
(content))
|
||||||
|
|
||||||
==================
|
==================
|
||||||
@@ -69,7 +69,7 @@ Cycle With As And Silent
|
|||||||
(value
|
(value
|
||||||
(literal
|
(literal
|
||||||
(string))))
|
(string))))
|
||||||
name: (identifier))
|
variable: (identifier))
|
||||||
(content))
|
(content))
|
||||||
|
|
||||||
==================
|
==================
|
||||||
|
|||||||
+43
-40
@@ -13,19 +13,20 @@ For Basic
|
|||||||
(template
|
(template
|
||||||
(content)
|
(content)
|
||||||
(for_group
|
(for_group
|
||||||
variables: (identifier)
|
(for_scope
|
||||||
(filtered_value
|
variable: (identifier)
|
||||||
(value
|
(filtered_value
|
||||||
(variable_attribute
|
(value
|
||||||
(identifier))))
|
(variable_attribute
|
||||||
(template
|
(identifier))))
|
||||||
(content)
|
(template
|
||||||
(template_variable
|
(content)
|
||||||
(filtered_value
|
(template_variable
|
||||||
(value
|
(filtered_value
|
||||||
(variable_attribute
|
(value
|
||||||
(identifier)))))
|
(variable_attribute
|
||||||
(content)))
|
(identifier)))))
|
||||||
|
(content))))
|
||||||
(content))
|
(content))
|
||||||
|
|
||||||
==================
|
==================
|
||||||
@@ -43,20 +44,21 @@ For With Multiple Variables
|
|||||||
(template
|
(template
|
||||||
(content)
|
(content)
|
||||||
(for_group
|
(for_group
|
||||||
variables: (identifier)
|
(for_scope
|
||||||
variables: (identifier)
|
variable: (identifier)
|
||||||
(filtered_value
|
variable: (identifier)
|
||||||
(value
|
(filtered_value
|
||||||
(variable_attribute
|
(value
|
||||||
(identifier))))
|
(variable_attribute
|
||||||
(template
|
(identifier))))
|
||||||
(content)
|
(template
|
||||||
(template_variable
|
(content)
|
||||||
(filtered_value
|
(template_variable
|
||||||
(value
|
(filtered_value
|
||||||
(variable_attribute
|
(value
|
||||||
(identifier)))))
|
(variable_attribute
|
||||||
(content)))
|
(identifier)))))
|
||||||
|
(content))))
|
||||||
(content))
|
(content))
|
||||||
|
|
||||||
==================
|
==================
|
||||||
@@ -76,19 +78,20 @@ For With Empty
|
|||||||
(template
|
(template
|
||||||
(content)
|
(content)
|
||||||
(for_group
|
(for_group
|
||||||
variables: (identifier)
|
(for_scope
|
||||||
(filtered_value
|
variable: (identifier)
|
||||||
(value
|
(filtered_value
|
||||||
(variable_attribute
|
(value
|
||||||
(identifier))))
|
(variable_attribute
|
||||||
(template
|
(identifier))))
|
||||||
(content)
|
(template
|
||||||
(template_variable
|
(content)
|
||||||
(filtered_value
|
(template_variable
|
||||||
(value
|
(filtered_value
|
||||||
(variable_attribute
|
(value
|
||||||
(identifier)))))
|
(variable_attribute
|
||||||
(content))
|
(identifier)))))
|
||||||
|
(content)))
|
||||||
(template
|
(template
|
||||||
(content)))
|
(content)))
|
||||||
(content))
|
(content))
|
||||||
|
|||||||
@@ -9,5 +9,5 @@ Partial Basic
|
|||||||
(template
|
(template
|
||||||
(content)
|
(content)
|
||||||
(partial
|
(partial
|
||||||
name: (identifier))
|
(identifier))
|
||||||
(content))
|
(content))
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ Partialdef Basic
|
|||||||
(template
|
(template
|
||||||
(content)
|
(content)
|
||||||
(partialdef_group
|
(partialdef_group
|
||||||
name: (push_partial)
|
(push_partial)
|
||||||
(template
|
(template
|
||||||
(content))
|
(content))
|
||||||
(pop_partial))
|
(pop_partial))
|
||||||
@@ -34,7 +34,7 @@ Partialdef Inline
|
|||||||
(template
|
(template
|
||||||
(content)
|
(content)
|
||||||
(partialdef_group
|
(partialdef_group
|
||||||
name: (push_partial)
|
(push_partial)
|
||||||
(template
|
(template
|
||||||
(content))
|
(content))
|
||||||
(pop_partial))
|
(pop_partial))
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ Verbatim Basic
|
|||||||
(template
|
(template
|
||||||
(content)
|
(content)
|
||||||
(verbatim_group
|
(verbatim_group
|
||||||
name: (push_verbatim)
|
(push_verbatim)
|
||||||
(verbatim_content)
|
(verbatim_content)
|
||||||
(pop_verbatim))
|
(pop_verbatim))
|
||||||
(content))
|
(content))
|
||||||
@@ -25,7 +25,7 @@ Verbatim Empty
|
|||||||
(template
|
(template
|
||||||
(content)
|
(content)
|
||||||
(verbatim_group
|
(verbatim_group
|
||||||
name: (push_verbatim)
|
(push_verbatim)
|
||||||
(pop_verbatim))
|
(pop_verbatim))
|
||||||
(content))
|
(content))
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ Verbatim Ignores Tags
|
|||||||
(template
|
(template
|
||||||
(content)
|
(content)
|
||||||
(verbatim_group
|
(verbatim_group
|
||||||
name: (push_verbatim)
|
(push_verbatim)
|
||||||
(verbatim_content)
|
(verbatim_content)
|
||||||
(pop_verbatim))
|
(pop_verbatim))
|
||||||
(content))
|
(content))
|
||||||
@@ -59,7 +59,7 @@ Verbatim With Name
|
|||||||
(template
|
(template
|
||||||
(content)
|
(content)
|
||||||
(verbatim_group
|
(verbatim_group
|
||||||
name: (push_verbatim)
|
(push_verbatim)
|
||||||
(verbatim_content)
|
(verbatim_content)
|
||||||
(pop_verbatim))
|
(pop_verbatim))
|
||||||
(content))
|
(content))
|
||||||
@@ -77,7 +77,7 @@ Avoid template rendering via the {% verbatim %}{% endverbatim %} block.
|
|||||||
(template
|
(template
|
||||||
(content)
|
(content)
|
||||||
(verbatim_group
|
(verbatim_group
|
||||||
name: (push_verbatim)
|
(push_verbatim)
|
||||||
(verbatim_content)
|
(verbatim_content)
|
||||||
(pop_verbatim))
|
(pop_verbatim))
|
||||||
(content))
|
(content))
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ With Basic
|
|||||||
(template
|
(template
|
||||||
(content)
|
(content)
|
||||||
(with_group
|
(with_group
|
||||||
name: (identifier)
|
variable: (identifier)
|
||||||
variables: (filtered_value
|
(filtered_value
|
||||||
(value
|
(value
|
||||||
(variable_attribute
|
(variable_attribute
|
||||||
(identifier)
|
(identifier)
|
||||||
@@ -40,13 +40,13 @@ With Multiple Variables
|
|||||||
(template
|
(template
|
||||||
(content)
|
(content)
|
||||||
(with_group
|
(with_group
|
||||||
name: (identifier)
|
variable: (identifier)
|
||||||
variables: (filtered_value
|
(filtered_value
|
||||||
(value
|
(value
|
||||||
(literal
|
(literal
|
||||||
(number))))
|
(number))))
|
||||||
name: (identifier)
|
variable: (identifier)
|
||||||
variables: (filtered_value
|
(filtered_value
|
||||||
(value
|
(value
|
||||||
(literal
|
(literal
|
||||||
(number))))
|
(number))))
|
||||||
|
|||||||
@@ -1,27 +1,32 @@
|
|||||||
|
{% load greet from custom.tags %}
|
||||||
|
{% partialdef url %}
|
||||||
|
<li>{% greet %} {{ user }}</li>
|
||||||
|
{% endpartialdef %}
|
||||||
<body>
|
<body>
|
||||||
{# hello this is an example file #}
|
{# hello this is an example file #}
|
||||||
<header>
|
<header>
|
||||||
<h1>{{ page.title|title }}</h1>
|
<h1>{{ page.title|title }}</h1>
|
||||||
<nav>
|
<nav>
|
||||||
{% if page.links|length > 0 %}
|
{% if page.links|length > 0 %}
|
||||||
<ul>
|
<ul>
|
||||||
{% for label, link in page.links %}
|
{% for label, link in page.links %}
|
||||||
<li>
|
<li>
|
||||||
{% url 'nav-pages' link as href %}
|
{% url 'nav-pages' link as href %}
|
||||||
<a href="{{href}}">{{label}}</a>
|
<a href="{{href}}">{{label}}</a>
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
<h1>EMPTY</h1>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
{% for foot in page.footer %}
|
{% for user in page.footer %}
|
||||||
|
{% partial url %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</footer>
|
</footer>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
+11
-5
@@ -8,7 +8,10 @@
|
|||||||
"scope": "source.django",
|
"scope": "source.django",
|
||||||
"file-types": ["html", "txt", "md"],
|
"file-types": ["html", "txt", "md"],
|
||||||
"injection-regex": "^django$",
|
"injection-regex": "^django$",
|
||||||
"class-name": "TreeSitterDjango"
|
"class-name": "TreeSitterDjango",
|
||||||
|
"highlights": "queries/highlights.scm",
|
||||||
|
"locals": "queries/locals.scm",
|
||||||
|
"injections": "queries/injections.scm"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"bindings": {
|
"bindings": {
|
||||||
@@ -17,10 +20,13 @@
|
|||||||
"metadata": {
|
"metadata": {
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"description": "DJango grammar for tree-sitter",
|
"description": "DJango grammar for tree-sitter",
|
||||||
"authors": [{
|
"license": "MIT",
|
||||||
"name": "Daniel Hanson",
|
"authors": [
|
||||||
"url": "https://github.com/danhanson"
|
{
|
||||||
}],
|
"name": "Daniel Hanson",
|
||||||
|
"url": "https://github.com/danhanson"
|
||||||
|
}
|
||||||
|
],
|
||||||
"links": {
|
"links": {
|
||||||
"repository": "https://github.com/danhanson/tree-sitter-django"
|
"repository": "https://github.com/danhanson/tree-sitter-django"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user