-
Notifications
You must be signed in to change notification settings - Fork 3
/
scad.lang
163 lines (155 loc) · 6.28 KB
/
scad.lang
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<?xml version="1.0" encoding="UTF-8"?>
<!--
OpenSCAD syntax highlighting file
Place this file in ~/.local/share/gtksourceview-3.0/language-specs/
(for Ubuntu, change as appropriate for your distribution)
Author: Bruno Girin
Copyright (C) 2013-2014 Bruno Girin <[email protected]>
This file is part of Gedit OpenSCAD extension.
Gedit OpenSCAD extension is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Gedit OpenSCAD extension is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with Gedit OpenSCAD extension.
If not, see <https://www.gnu.org/licenses/lgpl.html>.
-->
<language id="scad" _name="OpenSCAD" version="2.0" _section="Sources">
<metadata>
<property name="mimetypes">application/x-scad;text/x-scad</property>
<property name="globs">*.scad</property>
</metadata>
<styles>
<style id="keyword" _name="Keyword" map-to="def:keyword"/>
<style id="builtin" _name="Built-in function" map-to="def:builtin" />
<style id="primitive" _name="2D or 3D primitive" map-to="def:builtin" />
<style id="transform" _name="2D or 3D transform" map-to="def:builtin" />
<style id="csg" _name="CSG modelling" map-to="def:builtin" />
<style id="boolean" _name="Boolean" map-to="def:boolean" />
<style id="operator" _name="Operator" map-to="def:operator" />
<style id="include" _name="Include operator"
map-to="def:preprocessor" />
<style id="included-file" _name="Included File" map-to="def:string"/>
</styles>
<definitions>
<context id="keyword" style-ref="keyword">
<keyword>if</keyword>
<keyword>else</keyword>
<keyword>for</keyword>
<keyword>intersection_for</keyword>
<keyword>module</keyword>
<keyword>function</keyword>
<keyword>import</keyword>
</context>
<context id="builtin" style-ref="builtin">
<keyword>echo</keyword>
<keyword>assign</keyword>
<!-- Mathematical functions -->
<keyword>abs</keyword>
<keyword>acos</keyword>
<keyword>asin</keyword>
<keyword>atan</keyword>
<keyword>atan2</keyword>
<keyword>ceil</keyword>
<keyword>cos</keyword>
<keyword>exp</keyword>
<keyword>floor</keyword>
<keyword>ln</keyword>
<keyword>len</keyword>
<keyword>log</keyword>
<keyword>lookup</keyword>
<keyword>max</keyword>
<keyword>min</keyword>
<keyword>pow</keyword>
<keyword>rands</keyword>
<keyword>round</keyword>
<keyword>sign</keyword>
<keyword>sin</keyword>
<keyword>sqrt</keyword>
<keyword>tan</keyword>
<!-- String functions -->
<keyword>str</keyword>
</context>
<context id="primitive" style-ref="primitive">
<keyword>cube</keyword>
<keyword>sphere</keyword>
<keyword>cylinder</keyword>
<keyword>polyhedron</keyword>
<keyword>square</keyword>
<keyword>circle</keyword>
<keyword>polygon</keyword>
<keyword>import_dxf</keyword>
</context>
<context id="transform" style-ref="transform">
<keyword>scale</keyword>
<keyword>rotate</keyword>
<keyword>translate</keyword>
<keyword>mirror</keyword>
<keyword>multmatrix</keyword>
<keyword>color</keyword>
<keyword>minkowski</keyword>
<keyword>hull</keyword>
<keyword>linear_extrude</keyword>
<keyword>rotate_extrude</keyword>
</context>
<context id="csg" style-ref="csg">
<keyword>union</keyword>
<keyword>difference</keyword>
<keyword>intersection</keyword>
<keyword>render</keyword>
</context>
<context id="boolean" style-ref="boolean">
<keyword>true</keyword>
<keyword>false</keyword>
</context>
<context id="include" style-ref="include">
<match>^(include|use) (<.*>)</match>
<include>
<context id="included-file" sub-pattern="2"
style-ref="included-file" />
</include>
</context>
<context id="operator" style-ref="operator">
<!-- Mathematical operators -->
<keyword> *\+ *</keyword>
<keyword> *\- *</keyword>
<keyword> *\* *</keyword>
<keyword> *\/ *</keyword>
<keyword> *\% *</keyword>
<!-- Comparison operators -->
<keyword> *== *</keyword>
<keyword> *\!= *</keyword>
<keyword> *<= *</keyword>
<keyword> *>= *</keyword>
<keyword> *< *</keyword>
<keyword> *> *</keyword>
<!-- Assignment operator -->
<keyword> *= *</keyword>
<!-- Boolean operators -->
<keyword> *&& *</keyword>
<keyword> *\|\| *</keyword>
<keyword> *\! *</keyword>
</context>
<context id="scad">
<include>
<context ref="def:c-like-comment" />
<context ref="def:c-like-comment-multiline" />
<context ref="def:string" />
<context ref="keyword" />
<context ref="builtin" />
<context ref="primitive" />
<context ref="transform" />
<context ref="csg" />
<context ref="boolean" />
<context ref="include" />
<context ref="def:decimal" />
<context ref="def:float" />
<context ref="operator" />
</include>
</context>
</definitions>
</language>