aboutsummaryrefslogtreecommitdiffstats
path: root/queries/hack
diff options
context:
space:
mode:
authorStephan Seitz <stephan.seitz@fau.de>2021-11-23 01:20:25 +0100
committerStephan Seitz <stephan.seitz@fau.de>2022-01-17 10:53:35 +0100
commitd53de75cfd40e12af8ec14e3d1c05dfa8daf8721 (patch)
tree3c9510ba40352a283e5dc109eea1db8a4b49a570 /queries/hack
parentparsers: add hack parser (diff)
downloadnvim-treesitter-d53de75cfd40e12af8ec14e3d1c05dfa8daf8721.tar
nvim-treesitter-d53de75cfd40e12af8ec14e3d1c05dfa8daf8721.tar.gz
nvim-treesitter-d53de75cfd40e12af8ec14e3d1c05dfa8daf8721.tar.bz2
nvim-treesitter-d53de75cfd40e12af8ec14e3d1c05dfa8daf8721.tar.lz
nvim-treesitter-d53de75cfd40e12af8ec14e3d1c05dfa8daf8721.tar.xz
nvim-treesitter-d53de75cfd40e12af8ec14e3d1c05dfa8daf8721.tar.zst
nvim-treesitter-d53de75cfd40e12af8ec14e3d1c05dfa8daf8721.zip
highlights(hack): add some basic highlights
Fixes #2041
Diffstat (limited to 'queries/hack')
-rw-r--r--queries/hack/highlights.scm162
1 files changed, 162 insertions, 0 deletions
diff --git a/queries/hack/highlights.scm b/queries/hack/highlights.scm
new file mode 100644
index 000000000..29139aaff
--- /dev/null
+++ b/queries/hack/highlights.scm
@@ -0,0 +1,162 @@
+(comment) @comment
+
+[
+ "function"
+] @keyword.function
+
+[
+ "async"
+ "await"
+ "type"
+ "interface"
+ "class"
+] @keyword
+
+[
+ "new"
+ "print"
+ "echo"
+ "newtype"
+ "clone"
+] @keyword.operator
+
+[
+ "return"
+] @keyword.return
+
+[
+ "shape"
+ "tupe"
+ (array_type)
+ "bool"
+ "float"
+ "int"
+ "string"
+ "arraykey"
+ "void"
+ "nonnull"
+ (null)
+ "mixed"
+ "dynamic"
+ "noreturn"
+] @type
+
+(type_specifier
+ (qualified_identifier) @type)
+
+[
+ "="
+ "??="
+ ".="
+ "|="
+ "^="
+ "&="
+ "<<="
+ ">>="
+ "+="
+ "-="
+ "*="
+ "/="
+ "%="
+ "**="
+
+ "==>"
+ "|>"
+ "??"
+ "||"
+ "&&"
+ "|"
+ "^"
+ "&"
+ "=="
+ "!="
+ "==="
+ "!=="
+ "<"
+ ">"
+ "<="
+ ">="
+ "<=>"
+ "<<"
+ ">>"
+ "+"
+ "-"
+ "."
+ "*"
+ "/"
+ "%"
+ "**"
+
+ "++"
+ "--"
+ "!"
+
+ "?:"
+
+ "="
+ "??="
+ ".="
+ "|="
+ "^="
+ "&="
+ "<<="
+ ">>="
+ "+="
+ "-="
+ "*="
+ "/="
+ "%="
+ "**="
+
+ ;; type modifiers
+ "@"
+ "?"
+ "~"
+] @operator
+
+(integer) @number
+(float) @float
+
+(parameter
+ (variable) @parameter)
+
+(call_expression
+ function: (qualified_identifier) @function)
+
+(function_declaration
+ name: (identifier) @function)
+
+(type_arguments
+ [ "<" ">" ] @punctuation.bracket)
+[ "(" ")" "[" "]" "{" "}" "<<" ">>"] @punctuation.bracket
+
+[ "." ";" "::" ":" "," ] @punctuation.delimiter
+
+(ternary_expression
+ ["?" ":"] @conditional)
+
+[
+ "if"
+ "else"
+ "elseif"
+ "switch"
+ "case"
+] @conditional
+
+[
+ "try"
+ "catch"
+ "finally"
+] @exception
+
+[
+ "for"
+ "while"
+ "do"
+ "continue"
+ "break"
+] @repeat
+
+(string) @string
+
+(ERROR) @error