Skip to content

Commit 8e1c947

Browse files
authored
feat: Add Haxe support (#380)
1 parent 080382b commit 8e1c947

File tree

6 files changed

+110
-0
lines changed

6 files changed

+110
-0
lines changed

.github/workflows/update-grammars.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ jobs:
111111
- actionscript
112112
- ninja
113113
- svelte
114+
- haxe
114115
steps:
115116
- uses: actions/checkout@v4
116117
with:

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,3 +582,9 @@
582582
update = none
583583
ignore = dirty
584584
branch = master
585+
[submodule "repos/haxe"]
586+
path = repos/haxe
587+
url = https://github.com/vantreeseba/tree-sitter-haxe
588+
update = none
589+
ignore = dirty
590+
branch = main

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Changelog
22

33
## Unreleased
4+
- Add `Haxe` support
45

56
## 0.12.112 - 2024-02-15
67

queries/haxe/highlights.scm

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
(identifier !type) @variable
2+
(comment) @comment
3+
4+
; Preprocessor Statement
5+
; --------
6+
(preprocessor_statement) @tag
7+
; (metadata name: (identifier) @type) @tag
8+
9+
; MetaData
10+
; --------
11+
(metadata) @tag
12+
(metadata name: (identifier) @type) @tag
13+
14+
; Generic/Type Params
15+
; --------------
16+
(type_params
17+
"<" @punctuation.bracket
18+
(type_param (identifier) @type)
19+
">" @punctuation.bracket
20+
)
21+
22+
; Declarations
23+
; ------------
24+
(import_statement name: [
25+
(identifier) @type
26+
; (_ (identifier) @type)
27+
; (_(_ (identifier) @type))
28+
; (_(_(_ (identifier) @type)))
29+
; (_(_(_(_ (identifier) @type))))
30+
; (_(_(_(_(_ (identifier) @type)))))
31+
])
32+
(package_statement name: (identifier) @type)
33+
34+
(class_declaration name: (identifier) @type.definition)
35+
(class_declaration super_class_name: (identifier) @type.definition)
36+
(class_declaration interface_name: (identifier) @type.definition)
37+
(interface_declaration name: (identifier) @type.definition)
38+
(interface_declaration interface_name: (identifier) @type.definition)
39+
(typedef_declaration name: (identifier) @type.definition)
40+
41+
(function_declaration name: (identifier) @function)
42+
(function_arg name: (identifier) @variable.parameter)
43+
44+
; Expressions
45+
; -----------
46+
; (call_expression name: (identifier) @variable.parameter)
47+
48+
; TODO: Figure out how to determined when "nested member call" is last ident.
49+
; apparently this is a known issue https://github.com/tree-sitter/tree-sitter/issues/880
50+
(call_expression object: [
51+
(identifier) @function
52+
(_ (identifier) @method .)
53+
(_(_ (identifier) @method .))
54+
(_(_(_ (identifier) @method .)))
55+
(_(_(_(_ (identifier) @method .))))
56+
(_(_(_(_(_ (identifier) @method .)))))
57+
])
58+
59+
; Literals
60+
; --------
61+
[(keyword) (null)] @keyword
62+
; (type) @type
63+
(type (identifier) !built_in) @type
64+
(type built_in: (identifier)) @type.builtin
65+
[(integer) (float)] @number
66+
(string) @string
67+
(bool) @constant
68+
(operator) @operator
69+
(escape_sequence) @punctuation
70+
71+
; Interpolation
72+
; -------------
73+
(interpolation "$" @punctuation.special)
74+
(interpolation
75+
"${" @punctuation.special
76+
"}" @punctuation.special
77+
) @embedded
78+
79+
80+
; Tokens
81+
; ------
82+
83+
(":") @punctuation.special
84+
(pair [":" "=>"] @punctuation.special)
85+
86+
[
87+
"("
88+
")"
89+
"["
90+
"]"
91+
"{"
92+
"}"
93+
] @punctuation.bracket
94+
;
95+
[
96+
; ";"
97+
; "?."
98+
; "."
99+
","
100+
] @punctuation.delimiter

repos/haxe

Submodule haxe added at 6f6e798

tree-sitter-langs.el

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ See `tree-sitter-langs-repos'."
145145
(groovy-mode . groovy)
146146
(jenkinsfile-mode . groovy)
147147
(haskell-mode . haskell)
148+
(haxe-mode . haxe)
148149
(hcl-mode . hcl)
149150
(terraform-mode . hcl)
150151
(heex-mode . heex)

0 commit comments

Comments
 (0)