Skip to content

Commit

Permalink
Refactor qualified variables
Browse files Browse the repository at this point in the history
This commit applies variable contexts from Ngx to implement fully qualified
identifiers and distinguish global from member variables.
  • Loading branch information
deathaxe committed Jan 2, 2025
1 parent e12dc19 commit 422432d
Show file tree
Hide file tree
Showing 9 changed files with 241 additions and 124 deletions.
2 changes: 1 addition & 1 deletion Syntaxes/C++/syntax_test_scopes.jinja.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ int foo(int i) {
// ^^^^^^^^^^^^^^^^^ string.quoted.double.c
// ^^^^^^^^^^^ meta.embedded.expression.jinja
// ^^ punctuation.section.embedded.begin.jinja
// ^^^^^^^ source.jinja.embedded variable.other.jinja
// ^^^^^^^ source.jinja.embedded variable.other.readwrite.jinja
// ^^ punctuation.section.embedded.end.jinja

{% if true %}
Expand Down
2 changes: 1 addition & 1 deletion Syntaxes/C++/syntax_test_scopes.jinja.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ int foo(int i) {
// ^^^^^^^^^^^^^^^^^ string.quoted.double.c
// ^^^^^^^^^^^ meta.embedded.expression.jinja
// ^^ punctuation.section.embedded.begin.jinja
// ^^^^^^^ source.jinja.embedded variable.other.jinja
// ^^^^^^^ source.jinja.embedded variable.other.readwrite.jinja
// ^^ punctuation.section.embedded.end.jinja

{% if true %}
Expand Down
22 changes: 11 additions & 11 deletions Syntaxes/CSS/syntax_test_scopes.jina.css
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
## ^ punctuation.separator.key-value.css
## ^^^^^^^^^^^ meta.property-value.css meta.embedded.expression.jinja
## ^^ punctuation.section.embedded.begin.jinja
## ^^^^^ variable.other.jinja
## ^^^^^ variable.other.readwrite.jinja
## ^^ punctuation.section.embedded.end.jinja
## ^ punctuation.terminator.rule.css

Expand Down Expand Up @@ -107,19 +107,19 @@
## ^ keyword.control.directive.css punctuation.definition.keyword.css
## ^^^^^ keyword.control.directive.css - punctuation
## ^^ punctuation.section.embedded.begin.jinja
## ^^^^^ variable.other.jinja
## ^^^^^ variable.other.readwrite.jinja
## ^^ punctuation.section.embedded.end.jinja
## ^ punctuation.section.block.begin.css
## ^^ punctuation.section.embedded.begin.jinja
## ^^^ variable.other.jinja
## ^^^ variable.other.readwrite.jinja
## ^^ punctuation.section.embedded.end.jinja
## ^ punctuation.section.block.begin.css
## ^^ punctuation.section.embedded.begin.jinja
## ^^^^ variable.other.jinja
## ^^^^ variable.other.readwrite.jinja
## ^^ punctuation.section.embedded.end.jinja
## ^ punctuation.separator.key-value.css
## ^^ punctuation.section.embedded.begin.jinja
## ^^^^^ variable.other.jinja
## ^^^^^ variable.other.readwrite.jinja
## ^^ punctuation.section.embedded.end.jinja
## ^^ punctuation.section.block.end.css

Expand Down Expand Up @@ -159,34 +159,34 @@
## ^ punctuation.section.group.begin.css
## ^^^^^^^^^ support.type.property-name.css
## ^^ punctuation.section.embedded.begin.jinja
## ^^ variable.other.jinja
## ^^ variable.other.readwrite.jinja
## ^^ punctuation.section.embedded.end.jinja
## ^ punctuation.separator.key-value.css
## ^ meta.number.integer.decimal.css constant.numeric.value.css
## ^^ punctuation.section.embedded.begin.jinja
## ^^^^ variable.other.jinja
## ^^^^ variable.other.readwrite.jinja
## ^^ punctuation.section.embedded.end.jinja
## ^ punctuation.section.group.end.css
## ^ punctuation.section.group.end.css
## ^ punctuation.section.block.begin.css
## ^^ punctuation.definition.comment.begin.jinja
## ^^ punctuation.definition.comment.end.jinja
## ^^ punctuation.section.embedded.begin.jinja
## ^^^^^^^^^^^^ variable.other.jinja
## ^^^^^^^^^^^^ variable.other.readwrite.jinja
## ^^ punctuation.section.embedded.end.jinja
## ^ punctuation.definition.pseudo-class.css
## ^^^^^^^^^^^^^^^ entity.other.pseudo-class.css
## ^^ punctuation.section.embedded.begin.jinja
## ^^^^^ variable.other.jinja
## ^^^^^ variable.other.readwrite.jinja
## ^^ punctuation.section.embedded.end.jinja
## ^ punctuation.section.block.begin.css
## ^^ punctuation.section.embedded.begin.jinja
## ^^^^ variable.other.jinja
## ^^^^ variable.other.readwrite.jinja
## ^^ punctuation.section.embedded.end.jinja
## ^ punctuation.separator.key-value.css
## ^^^^^^^^^^^ support.constant.property-value.css
## ^^ punctuation.section.embedded.begin.jinja
## ^^ variable.other.jinja
## ^^ variable.other.readwrite.jinja
## ^^ punctuation.section.embedded.end.jinja
## ^ punctuation.terminator.rule.css
## ^ punctuation.section.block.end.css
Expand Down
42 changes: 21 additions & 21 deletions Syntaxes/HTML/syntax_test_scopes.jinja.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
## ^^^^^ meta.string.html string.unquoted.html - meta.interpolation
## ^^^^^^^ meta.string.html meta.embedded.expression.jinja - string
## ^^ punctuation.section.embedded.begin.jinja
## ^^^ variable.other.jinja
## ^^^ variable.other.readwrite.jinja
## ^^ punctuation.section.embedded.end.jinja

{% if borders == True %}
Expand Down Expand Up @@ -86,7 +86,7 @@
function foo(i) {return {{temlate}} + i + "string {{var}}";}
## ^^^^^^^^^^^ source.js.embedded.html meta.function.js meta.block.js meta.embedded.expression.jinja
## ^^ punctuation.section.embedded.begin.jinja
## ^^^^^^^ variable.other.jinja
## ^^^^^^^ variable.other.readwrite.jinja
## ^^ punctuation.section.embedded.end.jinja
## ^ keyword.operator.arithmetic.js
## ^ variable.other.readwrite.js
Expand All @@ -95,7 +95,7 @@
## ^ punctuation.definition.string.begin.js
## ^^^^^^^ meta.string.js meta.embedded.expression.jinja - string
## ^^ punctuation.section.embedded.begin.jinja
## ^^^ variable.other.jinja
## ^^^ variable.other.readwrite.jinja
## ^^ punctuation.section.embedded.end.jinja
## ^ meta.string.js string.quoted.double.js punctuation.definition.string.end.js

Expand Down Expand Up @@ -140,14 +140,14 @@
## ^ meta.mapping.key.json string.quoted.double.json punctuation.definition.string.begin.json
## ^^^^^^^ meta.mapping.key.json meta.embedded.expression.jinja
## ^^ punctuation.section.embedded.begin.jinja
## ^^^ variable.other.jinja
## ^^^ variable.other.readwrite.jinja
## ^^ punctuation.section.embedded.end.jinja
## ^ meta.mapping.key.json string.quoted.double.json punctuation.definition.string.end.json
## ^^ meta.mapping.json
## ^ meta.mapping.value.json meta.string.json string.quoted.double.json punctuation.definition.string.begin.json
## ^^^^^^^^^ meta.mapping.value.json meta.string.json - string
## ^^ meta.embedded.expression.jinja punctuation.section.embedded.begin.jinja
## ^^^^^ meta.embedded.expression.jinja variable.other.jinja
## ^^^^^ meta.embedded.expression.jinja variable.other.readwrite.jinja
## ^^ meta.embedded.expression.jinja punctuation.section.embedded.end.jinja
## ^ string.quoted.double.json punctuation.definition.string.end.json
## ^ punctuation.separator.sequence.json
Expand All @@ -156,7 +156,7 @@
## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.mapping.value.json meta.sequence.json
## ^^^^^^^^^ meta.embedded.expression.jinja
## ^^ punctuation.section.embedded.begin.jinja
## ^^^^^ variable.other.jinja
## ^^^^^ variable.other.readwrite.jinja
## ^^ punctuation.section.embedded.end.jinja
## ^ punctuation.separator.sequence.json
## ^ string.quoted.double.json punctuation.definition.string.begin.json
Expand All @@ -178,16 +178,16 @@
## ^^^ entity.name.tag.other.html - meta.interpolation
## ^^^^^^^ entity.name.tag.other.html meta.embedded.expression.jinja
## ^^ punctuation.section.embedded.begin.jinja
## ^^^ variable.other.jinja
## ^^^ variable.other.readwrite.jinja
## ^^ punctuation.section.embedded.end.jinja
## ^^^^^^^^ meta.attribute-with-value.html entity.other.attribute-name.html meta.embedded.expression.jinja
## ^^ punctuation.section.embedded.begin.jinja
## ^^^^ variable.other.jinja
## ^^^^ variable.other.readwrite.jinja
## ^^ punctuation.section.embedded.end.jinja
## ^ meta.attribute-with-value.html punctuation.separator.key-value.html
## ^^^^^^^^^ meta.attribute-with-value.html meta.string.html meta.embedded.expression.jinja
## ^^ punctuation.section.embedded.begin.jinja
## ^^^^^ variable.other.jinja
## ^^^^^ variable.other.readwrite.jinja
## ^^ punctuation.section.embedded.end.jinja
## ^^ punctuation.definition.tag.end.html

Expand All @@ -196,16 +196,16 @@
##^ meta.tag.other.html punctuation.definition.tag.begin.html
## ^^^^^^^ entity.name.tag.other.html meta.embedded.expression.jinja
## ^^ punctuation.section.embedded.begin.jinja
## ^^^ variable.other.jinja
## ^^^ variable.other.readwrite.jinja
## ^^ punctuation.section.embedded.end.jinja
## ^^^^^^^^ meta.attribute-with-value.html entity.other.attribute-name.html meta.embedded.expression.jinja
## ^^ punctuation.section.embedded.begin.jinja
## ^^^^ variable.other.jinja
## ^^^^ variable.other.readwrite.jinja
## ^^ punctuation.section.embedded.end.jinja
## ^ meta.attribute-with-value.html punctuation.separator.key-value.html
## ^^^^^^^^^ meta.attribute-with-value.html meta.string.html meta.embedded.expression.jinja
## ^^ punctuation.section.embedded.begin.jinja
## ^^^^^ variable.other.jinja
## ^^^^^ variable.other.readwrite.jinja
## ^^ punctuation.section.embedded.end.jinja
## ^^ punctuation.definition.tag.end.html

Expand All @@ -220,7 +220,7 @@
## ^^ punctuation.section.embedded.begin.jinja
## ^^^^^^^^^^^^^^ source.jinja.embedded
## ^^ keyword.control.conditional.if.jinja
## ^^^^^^^^^ variable.other.jinja
## ^^^^^^^^^ variable.other.readwrite.jinja
## ^^ punctuation.section.embedded.end.jinja
attr="value"
## ^^^^^^^^^^^^ meta.attribute-with-value.html
Expand All @@ -235,13 +235,13 @@
## ^^^^^^^^^^ entity.other.attribute-name.html meta.embedded.expression.jinja
## ^^ punctuation.section.embedded.begin.jinja
## ^^^^^^ source.jinja.embedded
## ^^^^ variable.other.jinja
## ^^^^ variable.other.readwrite.jinja
## ^^ punctuation.section.embedded.end.jinja
## ^ punctuation.separator.key-value.html
## ^^^^^^^^^^^ meta.string.html meta.embedded.expression.jinja
## ^^ punctuation.section.embedded.begin.jinja
## ^^^^^^^ source.jinja.embedded
## ^^^^^ variable.other.jinja
## ^^^^^ variable.other.readwrite.jinja
## ^^ punctuation.section.embedded.end.jinja

attr-{{ name }}="foo {{ bar ~ "baz #{buuz}!" }}"
Expand All @@ -260,16 +260,16 @@
## ^ - meta.attribute-with-value
## ^^ punctuation.section.embedded.begin.jinja
## ^^^^^^ source.jinja.embedded
## ^^^^ variable.other.jinja
## ^^^^ variable.other.readwrite.jinja
## ^^ punctuation.section.embedded.end.jinja
## ^ punctuation.separator.key-value.html
## ^ punctuation.definition.string.begin.html
## ^^ punctuation.section.embedded.begin.jinja
## ^^^ variable.other.jinja
## ^^^ variable.other.readwrite.jinja
## ^ keyword.operator.concatenation.jinja
## ^ punctuation.definition.string.begin.jinja
## ^ punctuation.section.interpolation.begin.jinja
## ^^^^ variable.other.jinja
## ^^^^ variable.other.readwrite.jinja
## ^ punctuation.section.interpolation.end.jinja
## ^^ string.quoted.double.jinja
## ^ punctuation.definition.string.end.jinja
Expand Down Expand Up @@ -350,7 +350,7 @@
## ^^ constant.character.escape.jinja
## ^^^^^^^ meta.string.html source.css.embedded.html meta.embedded.expression.jinja source.jinja.embedded meta.string.jinja meta.interpolation.jinja
## ^ punctuation.section.interpolation.begin.jinja
## ^^^^^ variable.other.jinja
## ^^^^^ variable.other.readwrite.jinja
## ^ punctuation.section.interpolation.end.jinja
## ^^^ meta.string.html source.css.embedded.html meta.embedded.expression.jinja source.jinja.embedded meta.string.jinja string.quoted.double.jinja
## ^^ constant.character.escape.jinja
Expand All @@ -374,7 +374,7 @@
## ^ string.quoted.double.jinja punctuation.definition.string.begin.jinja
## ^^^^^^ meta.interpolation.jinja
## ^ punctuation.section.interpolation.begin.jinja
## ^^^^ variable.other.jinja
## ^^^^ variable.other.readwrite.jinja
## ^ punctuation.section.interpolation.end.jinja
## ^ string.quoted.double.jinja punctuation.definition.string.end.jinja
## ^^ punctuation.section.embedded.end.jinja
Expand All @@ -387,7 +387,7 @@
## ^ string.quoted.double.jinja punctuation.definition.string.begin.jinja
## ^^^^^^^ meta.interpolation.jinja
## ^ punctuation.section.interpolation.begin.jinja
## ^^^^^ variable.other.jinja
## ^^^^^ variable.other.readwrite.jinja
## ^ punctuation.section.interpolation.end.jinja
## ^ string.quoted.double.jinja punctuation.definition.string.end.jinja
## ^^ punctuation.section.embedded.end.jinja
Expand Down
6 changes: 3 additions & 3 deletions Syntaxes/JSON/syntax_test_scopes.jinja.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
## ^ meta.mapping.key.json string.quoted.double.json punctuation.definition.string.begin.json
## ^^^^^^^ meta.mapping.key.json meta.embedded.expression.jinja
## ^^ punctuation.section.embedded.begin.jinja
## ^^^ variable.other.jinja
## ^^^ variable.other.readwrite.jinja
## ^^ punctuation.section.embedded.end.jinja
## ^ meta.mapping.key.json string.quoted.double.json punctuation.definition.string.end.json
## ^^ meta.mapping.json
## ^ meta.mapping.value.json meta.string.json string.quoted.double.json punctuation.definition.string.begin.json
## ^^^^^^^^^ meta.mapping.value.json meta.string.json - string
## ^^ meta.embedded.expression.jinja punctuation.section.embedded.begin.jinja
## ^^^^^ meta.embedded.expression.jinja variable.other.jinja
## ^^^^^ meta.embedded.expression.jinja variable.other.readwrite.jinja
## ^^ meta.embedded.expression.jinja punctuation.section.embedded.end.jinja
## ^ string.quoted.double.json punctuation.definition.string.end.json
## ^ punctuation.separator.sequence.json
Expand All @@ -40,7 +40,7 @@
## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.mapping.value.json meta.sequence.json
## ^^^^^^^^^ meta.embedded.expression.jinja
## ^^ punctuation.section.embedded.begin.jinja
## ^^^^^ variable.other.jinja
## ^^^^^ variable.other.readwrite.jinja
## ^^ punctuation.section.embedded.end.jinja
## ^ punctuation.separator.sequence.json
## ^ string.quoted.double.json punctuation.definition.string.begin.json
Expand Down
Loading

0 comments on commit 422432d

Please sign in to comment.