Debian Codegraph @

runtime/queries/openscad/highlights.scm

raw symbols SCIP
1 ; Includes
2 (identifier) @variable
3
4 "include" @keyword.control.import
5
6 (include_path) @string.special.path
7
8 ; Functions
9
10 (function_item
11 (identifier) @function
12 )
13 (function_item
14 parameters: (parameters (parameter (assignment value: (_) @constant)))
15 )
16 (function_call name: (identifier) @function)
17 (function_call
18 arguments: (arguments (assignment name: _ @variable.parameter))
19 )
20 ; for the puroposes of distintion since modules are "coloured" impure functions, we will treat them as methods
21 (module_item (identifier) @function.method)
22 (module_item
23 parameters: (parameters (parameter (assignment value: (_) @constant)))
24 )
25 (module_call name: (identifier) @function.method)
26 (module_call
27 arguments: (arguments (assignment name: _ @variable.parameter))
28 )
29
30 ; assertion statements/expression arguments behave similar to function calls
31 (assert_expression
32 arguments: (arguments (assignment name: _ @variable.parameter))
33 )
34 (assert_statement
35 arguments: (arguments (assignment name: _ @variable.parameter))
36 )
37
38 (echo_expression
39 arguments: (arguments (assignment name: _ @variable.parameter))
40 )
41 (echo_expression "echo" @function.builtin)
42
43 ; Variables
44 (parameter
45 [_ @variable.parameter (assignment name: _ @variable.parameter)]
46 )
47 (special_variable) @variable.builtin
48 (undef) @constant.builtin
49
50 ; Types/Properties/
51 (dot_index_expression index: (_) @variable.other.member)
52
53 ; Keywords
54 [
55 "module"
56 "function"
57 "let"
58 "assign"
59 "use"
60 "each"
61 (assert_statement "assert")
62 (assert_expression "assert")
63 ] @keyword
64
65 ; Operators
66 [
67 "||"
68 "&&"
69 "=="
70 "!="
71 "<"
72 ">"
73 "<="
74 ">="
75 "+"
76 "-"
77 "*"
78 "/"
79 "%"
80 "^"
81 "!"
82 ":"
83 "="
84 ] @operator
85
86 ; Builtin modules
87 (module_call
88 name: (identifier) @function.builtin
89 (#any-of? @function.builtin
90 "circle"
91 "color"
92 "cube"
93 "cylinder"
94 "difference"
95 "hull"
96 "intersection"
97 "linear_extrude"
98 "minkowski"
99 "mirror"
100 "multmatrix"
101 "offset"
102 "polygon"
103 "polyhedron"
104 "projection"
105 "resize"
106 "rotate"
107 "rotate_extrude"
108 "scale"
109 "sphere"
110 "square"
111 "surface"
112 "text"
113 "translate"
114 "union"
115 "echo"
116 )
117 )
118 (
119 (identifier) @identifier
120 (#eq? @identifier "PI")
121 ) @constant.builtin
122
123 ; Conditionals
124 [
125 "if"
126 "else"
127 ] @keyword.control.conditional
128 (ternary_expression
129 ["?" ":"] @keyword.control.conditional
130 )
131
132 ; Repeats
133 [
134 "for"
135 "intersection_for"
136 ] @keyword.control.repeat
137
138 ; Literals
139 (integer) @constant.numeric.integer
140 (float) @constant.numeric.float
141 (string) @string
142 (escape_sequence) @constant.character.escape
143 (boolean) @constant.builtin.boolean
144
145 ; Misc
146 (modifier
147 [
148 "*"
149 "!"
150 "#"
151 "%"
152 ] @keyword.storage.modifier
153 )
154 ["{" "}"] @punctuation.bracket
155 ["(" ")"] @punctuation.bracket
156 ["[" "]"] @punctuation.bracket
157 [
158 ";"
159 ","
160 "."
161 ] @punctuation.delimiter
162
163 ; Comments
164 [(line_comment) (block_comment)] @comment