summaryrefslogtreecommitdiff
path: root/queries
diff options
context:
space:
mode:
authorgbprod <contact@gb-prod.fr>2022-09-19 17:18:19 +0200
committerChristian Clason <christian.clason@uni-due.de>2022-10-03 10:06:41 +0200
commitd8a695a1ac493096e6f7a0916a962b979d290039 (patch)
tree43210c6ac939a38f6e5399cdaf14e285cca099df /queries
parent7ce47ddf52766aed192e8b83eda1bea20f043d24 (diff)
Introduce twig parser
This commit introduce parser, highlights and injections for the [twig syntax](https://twig.symfony.com)
Diffstat (limited to 'queries')
-rw-r--r--queries/twig/highlights.scm60
-rw-r--r--queries/twig/injections.scm2
2 files changed, 62 insertions, 0 deletions
diff --git a/queries/twig/highlights.scm b/queries/twig/highlights.scm
new file mode 100644
index 00000000..32ddc24a
--- /dev/null
+++ b/queries/twig/highlights.scm
@@ -0,0 +1,60 @@
+(comment) @comment
+
+(filter_identifier) @function.call
+(function_identifier) @function.call
+(test) @function.builtin
+(variable) @variable
+(string) @string
+(interpolated_string) @string
+(operator) @operator
+(number) @number
+(boolean) @boolean
+(null) @constant.builtin
+(keyword) @keyword
+(attribute) @attribute
+(tag) @tag
+(conditional) @conditional
+(repeat) @repeat
+(method) @method
+(parameter) @parameter
+
+[
+ "{{"
+ "}}"
+ "{{-"
+ "-}}"
+ "{{~"
+ "~}}"
+ "{%"
+ "%}"
+ "{%-"
+ "-%}"
+ "{%~"
+ "~%}"
+] @tag.delimiter
+
+[
+ ","
+ "."
+ "?"
+ ":"
+ "="
+] @punctuation.delimiter
+
+(interpolated_string [
+ "#{"
+ "}"
+] @punctuation.delimiter)
+
+[
+ "("
+ ")"
+ "["
+ "]"
+ "{"
+] @punctuation.bracket
+
+(hash [
+ "}"
+] @punctuation.bracket)
+
diff --git a/queries/twig/injections.scm b/queries/twig/injections.scm
new file mode 100644
index 00000000..97f84c16
--- /dev/null
+++ b/queries/twig/injections.scm
@@ -0,0 +1,2 @@
+(content) @html
+