Skip to content

Commit 9546ac9

Browse files
authored
feat: Add GLSL support (#218)
* feat: Add GLSL support * Update CHANGELOG.md * Require build * put one next line
1 parent 0a9fe27 commit 9546ac9

File tree

6 files changed

+131
-1
lines changed

6 files changed

+131
-1
lines changed

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,3 +448,9 @@
448448
branch = master
449449
update = none
450450
ignore = dirty
451+
[submodule "repos/glsl"]
452+
path = repos/glsl
453+
url = https://github.com/theHamsta/tree-sitter-glsl
454+
branch = master
455+
update = none
456+
ignore = dirty

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 `GLSL` support
45

56
## 0.12.61 - 2023-10-10
67
- Add `Solidity` support

queries/glsl/highlights.scm

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
"break" @keyword
2+
"case" @keyword
3+
"const" @keyword
4+
"continue" @keyword
5+
"default" @keyword
6+
"do" @keyword
7+
"else" @keyword
8+
"enum" @keyword
9+
"extern" @keyword
10+
"for" @keyword
11+
"if" @keyword
12+
"inline" @keyword
13+
"return" @keyword
14+
"sizeof" @keyword
15+
"static" @keyword
16+
"struct" @keyword
17+
"switch" @keyword
18+
"typedef" @keyword
19+
"union" @keyword
20+
"volatile" @keyword
21+
"while" @keyword
22+
23+
"#define" @keyword
24+
"#elif" @keyword
25+
"#else" @keyword
26+
"#endif" @keyword
27+
"#if" @keyword
28+
"#ifdef" @keyword
29+
"#ifndef" @keyword
30+
"#include" @keyword
31+
(preproc_directive) @keyword
32+
33+
"--" @operator
34+
"-" @operator
35+
"-=" @operator
36+
"->" @operator
37+
"=" @operator
38+
"!=" @operator
39+
"*" @operator
40+
"&" @operator
41+
"&&" @operator
42+
"+" @operator
43+
"++" @operator
44+
"+=" @operator
45+
"<" @operator
46+
"==" @operator
47+
">" @operator
48+
"||" @operator
49+
50+
"." @delimiter
51+
";" @delimiter
52+
53+
(string_literal) @string
54+
(system_lib_string) @string
55+
56+
(null) @constant
57+
(number_literal) @number
58+
(char_literal) @number
59+
60+
(call_expression
61+
function: (identifier) @function)
62+
(call_expression
63+
function: (field_expression
64+
field: (field_identifier) @function))
65+
(function_declarator
66+
declarator: (identifier) @function)
67+
(preproc_function_def
68+
name: (identifier) @function.special)
69+
70+
(field_identifier) @property
71+
(statement_identifier) @label
72+
(type_identifier) @type
73+
(primitive_type) @type
74+
(sized_type_specifier) @type
75+
76+
((identifier) @constant
77+
(#match? @constant "^[A-Z][A-Z\\d_]*$"))
78+
79+
(identifier) @variable
80+
81+
(comment) @comment
82+
; inherits: c
83+
84+
[
85+
"in"
86+
"out"
87+
"inout"
88+
"uniform"
89+
"shared"
90+
"layout"
91+
"attribute"
92+
"varying"
93+
"buffer"
94+
"coherent"
95+
"readonly"
96+
"writeonly"
97+
"precision"
98+
"highp"
99+
"mediump"
100+
"lowp"
101+
"centroid"
102+
"sample"
103+
"patch"
104+
"smooth"
105+
"flat"
106+
"noperspective"
107+
"invariant"
108+
"precise"
109+
] @type.qualifier
110+
111+
"subroutine" @keyword.function
112+
113+
(extension_storage_class) @storageclass
114+
115+
(
116+
(identifier) @variable.builtin
117+
(#match? @variable.builtin "^gl_")
118+
)

repos/glsl

Submodule glsl added at 7491ce4

tree-sitter-langs-build.el

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,10 @@ infrequent (grammar-only changes). It is different from the version of
247247
"List of suffixes for shared libraries that define tree-sitter languages.")
248248

249249
(defconst tree-sitter-langs--langs-with-deps
250-
'(cpp typescript toml)
250+
'( cpp
251+
glsl
252+
typescript
253+
toml)
251254
"Languages that depend on another, thus requiring 'npm install'.")
252255

253256
(defun tree-sitter-langs--bundle-file (&optional ext version os)

tree-sitter-langs.el

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ See `tree-sitter-langs-repos'."
130130
(git-rebase-mode . git-rebase)
131131
(gitattributes-mode . gitattributes)
132132
(gitignore-mode . gitignore)
133+
(glsl-mode . glsl)
133134
(go-mode . go)
134135
(haskell-mode . haskell)
135136
(hcl-mode . hcl)

0 commit comments

Comments
 (0)