summaryrefslogtreecommitdiffstats
path: root/kate/data/gcode.xml
blob: 029ec0446e849bd73edeb12e27b46b8094193bef (plain)
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd">
<!--
		
		G-code syntax highlighting for KatePart
		
		Copy this file to :  ~/.tde/share/apps/katepart/syntax/
		
		Copyright © 2016 by Fernand Veilleux (fernveilleux@gmail.com)
		All rights reserved.
		
		This library is free software; you can redistribute it and/or
		modify it under the terms of the GNU Library General Public
		License as published by the Free Software Foundation; either
		version 2 of the License, or (at your option) any later version.
		
		This library 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
		Library General Public License for more details.
		
		You should have received a copy of the GNU Library General Public
		License along with this library; if not, write to the
		Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
		Boston, MA  02110-1301, USA.
		
		-->
<language name="G-Code"
					version="1.00-1"
					kateversion="3.8"
					section="Other"
					extensions="*.ngc"
					mimetype="text/ngc"
					author="Fernand Veilleux (fernveilleux@gmail.com)"
					license="LGPL">
	
	<highlighting>
		<list name="operators">
			<item>and</item>
			<item>or</item>
			<item>xor</item>
			<item>eq</item>
			<item>ne</item>
			<item>gt</item>
			<item>ge</item>
			<item>lt</item>
			<item>le</item>
			<item>mod</item>
		</list>
		
		<list name="functions">
			<item>atan</item>
			<item>abs</item>
			<item>acos</item>
			<item>asin</item>
			<item>cos</item>
			<item>exp</item>
			<item>exists</item>
			<item>fix</item>
			<item>fup</item>
			<item>ln</item>
			<item>round</item>
			<item>sin</item>
			<item>sqrt</item>
			<item>tan</item>
		</list>
		
		<list name="o_sub">
			<item>sub</item>
			<item>endsub</item>
			<item>call</item>
			<item>return</item>
		</list>
		
		<list name="keyword">
			<item>do</item>
			<item>while</item>
			<item>endwhile</item>
			<item>repeat</item>
			<item>endrepeat</item>
			<item>break</item>
			<item>continue</item>
			<item>if</item>
			<item>elseif</item>
			<item>else</item>
			<item>endif</item>
		</list>
		
		<contexts>
			<context name="Alert" attribute="Alert" lineEndContext="#pop">
				<RegExpr String="^[\s\t]*[nN][\s\t]*[\d]{1,5}" attribute="Line Number"/>
				<DetectSpaces attribute="Normal Text"/>
				<DetectChar char="%" attribute="M-word"/>
				<DetectChar char="[" attribute="Brackets"/>
				<DetectChar char="]" attribute="Brackets"/>
				<DetectChar char="(" lookAhead="1" context="parenthese"/>
				<DetectChar char="#" lookAhead="1" context="hash1"/>
				<RegExpr String="[.][\d\s\t]*[.]" lookAhead="1" context="alert"/>
				<RegExpr String="[.][\d\s\t]*" attribute="Number"/>
				<RegExpr String="[\d][\d\s\t]*[.][\d\s\t]*[.]" lookAhead="1" context="alert"/>
				<RegExpr String="[\d][\d\s\t]*[.]?[\d\s\t]*" attribute="Number"/>
				<RegExpr String="[+\-*/=]" attribute="Operator"/>
				<RegExpr String=";.*$" attribute="Comment"/>
				<keyword String="functions" attribute="Function"/>
				<keyword String="operators" attribute="Operator"/>
				<keyword String="o_sub" attribute="Sub-program"/>
				<keyword String="keyword" attribute="Keyword"/>
				<RegExpr String="[oO][\s\t]*&lt;[\s\t]*&gt;" lookAhead="1" context="alert"/>
				<RegExpr String="[oO][\s\t]*([\d]+|&lt;[^>]*&gt;)" attribute="O-word"/>
				<RegExpr String="[abcu-z][\s\t]*[+\-\d#\[.]" insensitive="1" lookAhead="1" context="coords"/>
				<RegExpr String="[abcu-z].*$" insensitive="1" attribute="Alert"/>
				<RegExpr String="[deh-lpqr@^][\s\t]*[+\-\d#\[.]" insensitive="1" lookAhead="1" context="opts"/>
				<RegExpr String="[deh-lpqr@^].*$" insensitive="1" attribute="Alert"/>
				<RegExpr String="[gG][\s\t]*[\d]+[\s\t]*[.]?[\s\t]*[\d]*" attribute="G-word"/>
				<RegExpr String="[gG][\s\t]*[\[#]" lookAhead="1" context="gword"/>
				<RegExpr String="[tsTS][\s\t]*[+\d#\[]" lookAhead="1" context="tools"/>
				<RegExpr String="[fF][\s\t]*[+\d#\[.]" lookAhead="1" context="feed"/>
				<RegExpr String="[mM][\s\t]*[1][\s\t]*[\d][\s\t]*[\d]" attribute="M-word (user)"/>
				<RegExpr String="[mM][\s\t]*([\d][\s\t]*[\d]?|[+#\[])" lookAhead="1" context="mword"/>
				<RegExpr String=".*$" attribute="Alert"/>
			</context>
			
			<context name="feed" attribute="Alert" lineEndContext="#pop">
				<RegExpr String="[fF]" attribute="Tool" context="#pop"/>
			</context>
			
			<context name="tools" attribute="Alert" lineEndContext="#pop">
				<RegExpr String="[tsTS]" attribute="Tool" context="#pop"/>
			</context>
			
			<context name="gword" attribute="Alert" lineEndContext="#pop">
				<RegExpr String="[gG]" attribute="G-word" context="#pop"/>
			</context>
			
			<context name="mword" attribute="Alert" lineEndContext="#pop">
				<RegExpr String="[mM]" attribute="M-word" context="#pop"/>
			</context>
			
			<context name="coords" attribute="Alert" lineEndContext="#pop">
				<RegExpr String="[abcu-z]" insensitive="1" attribute="Coordinate" context="#pop"/>
			</context>
			
			<context name="opts" attribute="Alert" lineEndContext="#pop">
				<RegExpr String="[deh-lpqr@^]" insensitive="1" attribute="G-options" context="#pop"/>
			</context>
			
			<context name="parenthese" attribute="Alert" lineEndContext="#pop">
				<RegExpr String="\([\s\t]*(PRINT|DEBUG|MSG|AXIS|(PROBE(CLOSE|OPEN))|(LOG(OPEN|CLOSE|APPEND|[\s]|[\,])))[^\)]*\)"
								 insensitive="1" attribute="Message" context="#pop"/>
				<RegExpr String="\([^\)]*\)" attribute="Comment" context="#pop"/>
			</context>
			
			<context name="hash1" attribute="Alert" lineEndContext="#pop">
				<RegExpr String="#[\s\t]*&lt;[\s\t]*&gt;" context="alert"/>
				<RegExpr String="#[0\s\t]*(5000)" attribute="Param (global)" context="#pop"/>
				<RegExpr String="#[0\s\t]*[1-4][0-9]{3}" attribute="Param (global)" context="#pop"/>
				<RegExpr String="#[0\s\t]*[1-9][\d]{2}" attribute="Param (global)" context="#pop"/>
				<RegExpr String="#[0\s\t]*[4-9][\d]{1}" attribute="Param (global)" context="#pop"/>
				<RegExpr String="#[0\s\t]*[3][1-9]" attribute="Param (global)" context="#pop"/>
				<RegExpr String="#[0\s\t]*(30)" attribute="Param (local)" context="#pop"/>
				<RegExpr String="#[0\s\t]*[12][0-9]{1}" attribute="Param (local)" context="#pop"/>
				<RegExpr String="#[0\s\t]*[1-9]{1}" attribute="Param (local)" context="#pop"/>
				<RegExpr String="#[\s\t]*&lt;[\s\t]*_[^>]*&gt;" attribute="Param (global)" context="#pop"/>
				<RegExpr String="#[\s\t]*&lt;[^>]*&gt;" attribute="Param (local)" context="#pop"/>
				<RegExpr String="[#][\s\t]*[#][\s\t]*[#]+" lookAhead="1" context="alert"/>
				<RegExpr String="#[\s\t]*#[\s\t]*[&lt;\[]" lookAhead="1" context="hash2"/>
				<RegExpr String="#[\s\t]*#" attribute="Param (local)" context="#pop"/>
				<RegExpr String="#[\s\t]*\[" lookAhead="1" context="hash2"/>
			</context>
			
			<context name="hash2" attribute= "Alert" lineEndContext="#pop">        
				<RegExpr String="#" attribute="Param (local)" context="#pop#pop"/>
			</context>
			
			<context name="alert" attribute="Alert" lineEndContext="#pop">
			</context>      
		</contexts>
		
		<itemDatas>
			<itemData name="Normal Text" defStyleNum="dsNormal"/>
			<itemData name="Brackets" defStyleNum="dsNormal"/>
			<itemData name="Comment" defStyleNum="dsComment"/>
			<itemData name="Coordinate" defStyleNum="dsNormal" color="#A57800" bold="1" italic="0"/>
			<itemData name="Function" defStyleNum="dsFunction" color="#800080" bold="1" italic="1"/>
			<itemData name="G-options" defStyleNum="dsNormal" color="#800080"  bold="1" italic="0"/>
			<itemData name="G-word" defStyleNum="dsNormal" selColor="#FFFFFF"  bold="1" italic="0"/>
			<itemData name="Keyword" defStyleNum="dsNormal" bold="1" italic="1"/>
			<itemData name="Line Number" defStyleNum="dsComment"/>
			<itemData name="Message" defStyleNum="dsNormal" italic="1" />
			<itemData name="M-word" defStyleNum="dsNormal" color="#A07400" bold="0" italic="0" />
			<itemData name="M-word (user)" defStyleNum="dsNormal" color="#A07400" bold="1" italic="1"/>
			<itemData name="Number" defStyleNum="dsDecVal" color="#A64C00" bold="1" italic="0"/>
			<itemData name="Operator" defStyleNum="dsOperator" color="#000080" bold="1" italic="0"/>
			<itemData name="O-word" defStyleNum="dsControlFlow" color="#BB7B40" bold="0" italic="0"/>
			<itemData name="Param (global)" defStyleNum="dsVariable" color="#149E05" bold="0" italic="0"/>
			<itemData name="Param (local)" defStyleNum="dsVariable" color="#0950AB" bold="0" italic="0"/>
			<itemData name="Sub-program" defStyleNum="dsKeyword" color="#700070" bold="0" italic="0"/>
			<itemData name="Tool" defStyleNum="dsNormal" color="#0000D6" bold="1" italic="0"/>
			<itemData name="Alert" defStyleNum="dsError"/>
		</itemDatas>
	</highlighting>
	
	<general>
		<folding indentationsensitive="1"/>
		<comments>
			<comment name="singleLine" start=";"/>
		</comments>
		<keywords casesensitive="0"/>
	</general>
</language>