Warning, /frameworks/syntax-highlighting/data/syntax/gcode.xml is written in an unsupported language. File is not indexed.
0001 <?xml version="1.0" encoding="UTF-8"?>
0002 <!DOCTYPE language
0003 [
0004 <!--
0005 single . as number
0006 1.2. is not a number (two .)
0007 spaces are ignored (1 2 . 3 4 is a valid number)
0008 -->
0009 <!ENTITY number "&cmd_number;|[.]\s*(\d[\s\d]*+)?(?![.])">
0010 <!ENTITY cmd_number "\d[\s\d]*+([.][\s\d]*+)?(?![.])">
0011 <!ENTITY int "\d[\s\d]*+(?![.])">
0012 ]>
0013 <!--
0014
0015 G-code syntax highlighting for KatePart
0016
0017 Copy this file to : ~/.kde/share/apps/katepart/syntax/
0018
0019 Copyright © 2016 by Fernand Veilleux (fernveilleux@gmail.com)
0020
0021 This library is free software; you can redistribute it and/or
0022 modify it under the terms of the GNU Library General Public
0023 License as published by the Free Software Foundation; either
0024 version 2 of the License, or (at your option) any later version.
0025
0026 This library is distributed in the hope that it will be useful,
0027 but WITHOUT ANY WARRANTY; without even the implied warranty of
0028 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0029 Library General Public License for more details.
0030
0031 You should have received a copy of the GNU Library General Public
0032 License along with this library; if not, write to the
0033 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0034 Boston, MA 02110-1301, USA.
0035
0036 -->
0037 <language name="G-Code"
0038 version="12"
0039 kateversion="5.0"
0040 section="3D"
0041 extensions="*.ngc;*.gcode"
0042 mimetype="text/ngc"
0043 author="Fernand Veilleux (fernveilleux@gmail.com)"
0044 license="LGPLv2+">
0045
0046 <!-- https://reprap.org/wiki/G-code -->
0047 <!-- http://wiki.linuxcnc.org/cgi-bin/wiki.pl?Example_G-Code_Programs -->
0048 <!-- https://docs.duet3d.com/en/User_manual/Reference/Gcode_meta_commands -->
0049
0050 <highlighting>
0051 <list name="operators">
0052 <item>and</item>
0053 <item>or</item>
0054 <item>xor</item>
0055 <item>eq</item>
0056 <item>ne</item>
0057 <item>gt</item>
0058 <item>ge</item>
0059 <item>lt</item>
0060 <item>le</item>
0061 <item>mod</item>
0062 </list>
0063
0064 <list name="functions">
0065 <item>abs</item>
0066 <item>acos</item>
0067 <item>asin</item>
0068 <item>atan</item>
0069 <item>atan2</item>
0070 <item>cos</item>
0071 <item>datetime</item>
0072 <item>degrees</item>
0073 <item>exists</item>
0074 <item>exp</item>
0075 <item>fix</item>
0076 <item>floor</item>
0077 <item>fup</item>
0078 <item>isnan</item>
0079 <item>ln</item>
0080 <item>max</item>
0081 <item>min</item>
0082 <item>mod</item>
0083 <item>radians</item>
0084 <item>random</item>
0085 <item>round</item>
0086 <item>sin</item>
0087 <item>sqrt</item>
0088 <item>tan</item>
0089 </list>
0090
0091 <list name="o_sub">
0092 <item>sub</item>
0093 <item>endsub</item>
0094 <item>call</item>
0095 <item>return</item>
0096 </list>
0097
0098 <list name="keyword">
0099 <item>do</item>
0100 <item>while</item>
0101 <item>endwhile</item>
0102 <item>repeat</item>
0103 <item>endrepeat</item>
0104 <item>break</item>
0105 <item>continue</item>
0106 <item>if</item>
0107 <item>elseif</item>
0108 <item>else</item>
0109 <item>endif</item>
0110 <!-- meta command -->
0111 <item>abort</item>
0112 <item>echo</item>
0113 <item>var</item>
0114 <item>global</item>
0115 <item>set</item>
0116 </list>
0117
0118 <list name="named constants">
0119 <item>false</item>
0120 <item>iterations</item>
0121 <item>line</item>
0122 <item>null</item>
0123 <item>pi</item>
0124 <item>result</item>
0125 <item>true</item>
0126 </list>
0127
0128 <contexts>
0129 <context name="Alert" attribute="Alert" lineEndContext="#pop" fallthrough="true" fallthroughContext="alert">
0130 <RegExpr String="^\s*[nN]\s*∫" attribute="Line Number" column="0"/>
0131 <DetectSpaces attribute="Normal Text"/>
0132 <DetectChar char="%" attribute="M-word"/>
0133 <AnyChar String="[]" attribute="Brackets"/>
0134 <DetectChar char="(" lookAhead="1" context="parenthese"/>
0135 <DetectChar char="#" lookAhead="1" context="hash1"/>
0136 <AnyChar String="+-*/=:" attribute="Operator"/>
0137 <DetectChar char=""" attribute="String" context="string"/>
0138 <DetectChar char="{" attribute="Operator" context="expression"/>
0139 <DetectChar char=";" attribute="Comment" context="comment"/>
0140 <RegExpr String="&number;" attribute="Number"/>
0141 <RegExpr String="[abcu-z](?=[\s+\-\d#\[.{;]|$)" insensitive="1" attribute="Coordinate"/>
0142 <RegExpr String="[gG]\s*(&cmd_number;|(?=[\[#]))" attribute="G-word"/>
0143 <RegExpr String="[deh-lpqr@^](?=[\s+\-\d#\[."{;]|$)" insensitive="1" attribute="G-options"/>
0144 <!-- exclude M1nn commands -->
0145 <RegExpr String="[mM]\s*((?!1\s*\d\s*\d\s*(?=[^\d.]|$))&cmd_number;|[+#\[])" attribute="M-word"/>
0146 <RegExpr String="[fF](?=\s*[+\d#\[."{])|[tsTS](?=\s*[+\d#\["{])" attribute="Tool"/>
0147 <RegExpr String="[mM]&cmd_number;" attribute="M-word (user)"/>
0148 <RegExpr String="[oO](\s*(&number;|<\s*+[^>]+>|$|(?=;))|\s+|(?=;))" attribute="O-word"/>
0149 <keyword String="functions" attribute="Function"/>
0150 <keyword String="operators" attribute="Operator"/>
0151 <keyword String="o_sub" attribute="Sub-program"/>
0152 <keyword String="keyword" attribute="Keyword" context="meta_command"/>
0153 </context>
0154
0155 <context name="parenthese" attribute="Alert" lineEndContext="#pop">
0156 <RegExpr String="\(\s*(PRINT|DEBUG|MSG|AXIS|(PROBE(CLOSE|OPEN))|(LOG(OPEN|CLOSE|APPEND|[\s,])))[^\)]*\)"
0157 insensitive="1" attribute="Message" context="#pop"/>
0158 <RangeDetect char="(" char1=")" attribute="Comment" context="#pop"/>
0159 <DetectChar char="(" attribute="Alert" context="#pop!alert"/>
0160 </context>
0161
0162 <context name="hash1" attribute="Alert" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!alert">
0163 <RegExpr String="#\s*(∫|<\s*_[^>]*>)" attribute="Param (global)" context="#pop"/>
0164 <RegExpr String="#(?=\s*+(\[|#\s*[<\[]))|#\s*+(#(?!\s*#)|<\s*+[^>]+>)" attribute="Param (local)" context="#pop"/>
0165 </context>
0166
0167 <context name="string" attribute="String" lineEndContext="#pop">
0168 <Detect2Chars char=""" char1=""" lookAhead="1" context="quot1"/>
0169 <DetectChar char=""" attribute="String" context="#pop"/>
0170 <DetectChar char="'" attribute="Special String Char"/>
0171 <RegExpr String="[^'"]+" attribute="String"/>
0172 </context>
0173 <context name="quot1" attribute="String" lineEndContext="#pop">
0174 <DetectChar char=""" attribute="Special String Char" context="quot2"/>
0175 </context>
0176 <context name="quot2" attribute="String" lineEndContext="#pop">
0177 <DetectChar char=""" attribute="String" context="#pop#pop"/>
0178 </context>
0179
0180 <context name="expression" attribute="Normal Text" lineEndContext="#pop">
0181 <keyword String="functions" attribute="Function"/>
0182 <DetectIdentifier attribute="Normal Text"/>
0183 <DetectSpaces attribute="Normal Text"/>
0184 <DetectChar char="}" attribute="Operator" context="#pop"/>
0185 <IncludeRules context="expression_common"/>
0186 </context>
0187
0188 <context name="expression_common" attribute="Normal Text" lineEndContext="#pop">
0189 <AnyChar String="+-*/=:!#<>&|^,?" attribute="Operator"/>
0190 <AnyChar String="[]" attribute="Brackets"/>
0191 <DetectChar char=""" attribute="String" context="string"/>
0192 <DetectChar char="{" attribute="Operator" context="expression"/>
0193 <DetectChar char=";" attribute="Comment" context="comment"/>
0194 <RegExpr String="&cmd_number;|[.]\s*∫" attribute="Number"/>
0195 <Int attribute="Alert"/>
0196 </context>
0197
0198 <context name="meta_command" attribute="Normal Text" lineEndContext="#pop">
0199 <DetectSpaces attribute="Normal Text"/>
0200 <keyword String="named constants" attribute="Constant"/>
0201 <keyword String="functions" attribute="Function"/>
0202 <keyword String="operators" attribute="Operator"/>
0203 <DetectIdentifier attribute="Normal Text"/>
0204 <DetectChar char="#" lookAhead="1" context="hash1"/>
0205 <DetectChar char="(" lookAhead="1" context="parenthese"/>
0206 <IncludeRules context="expression_common"/>
0207 </context>
0208
0209 <context name="alert" attribute="Alert" lineEndContext="#pop">
0210 <RegExpr String="[^;(]+" attribute="Alert"/>
0211 <DetectChar char=";" attribute="Comment" context="comment"/>
0212 <DetectChar char="(" lookAhead="1" context="parenthese"/>
0213 </context>
0214
0215 <context name="comment" attribute="Comment" lineEndContext="#pop">
0216 <DetectSpaces/>
0217 <IncludeRules context="##Comments"/>
0218 <DetectIdentifier/>
0219 </context>
0220 </contexts>
0221
0222 <itemDatas>
0223 <itemData name="Normal Text" defStyleNum="dsNormal" spellChecking="0"/>
0224 <itemData name="Brackets" defStyleNum="dsNormal" spellChecking="0"/>
0225 <itemData name="Comment" defStyleNum="dsComment"/>
0226 <itemData name="Coordinate" defStyleNum="dsNormal" color="#A57800" bold="1" italic="0" spellChecking="0"/>
0227 <itemData name="Function" defStyleNum="dsFunction" color="#800080" bold="1" italic="1" spellChecking="0"/>
0228 <itemData name="G-options" defStyleNum="dsNormal" color="#800080" bold="1" italic="0" spellChecking="0"/>
0229 <itemData name="G-word" defStyleNum="dsNormal" selColor="#FFFFFF" bold="1" italic="0" spellChecking="0"/>
0230 <itemData name="Keyword" defStyleNum="dsNormal" bold="1" italic="1" spellChecking="0"/>
0231 <itemData name="Line Number" defStyleNum="dsComment" spellChecking="0"/>
0232 <itemData name="Message" defStyleNum="dsNormal" italic="1"/>
0233 <itemData name="M-word" defStyleNum="dsNormal" color="#A07400" bold="0" italic="0" spellChecking="0"/>
0234 <itemData name="M-word (user)" defStyleNum="dsNormal" color="#A07400" bold="1" italic="1" spellChecking="0"/>
0235 <itemData name="String" defStyleNum="dsString"/>
0236 <itemData name="Special String Char" defStyleNum="dsSpecialChar" spellChecking="false"/>
0237 <itemData name="Number" defStyleNum="dsDecVal" color="#A64C00" bold="1" italic="0" spellChecking="0"/>
0238 <itemData name="Operator" defStyleNum="dsOperator" color="#000080" bold="1" italic="0" spellChecking="0"/>
0239 <itemData name="O-word" defStyleNum="dsControlFlow" color="#BB7B40" bold="0" italic="0" spellChecking="0"/>
0240 <itemData name="Param (global)" defStyleNum="dsVariable" color="#149E05" bold="0" italic="0" spellChecking="0"/>
0241 <itemData name="Param (local)" defStyleNum="dsVariable" color="#0950AB" bold="0" italic="0" spellChecking="0"/>
0242 <itemData name="Sub-program" defStyleNum="dsKeyword" color="#700070" bold="0" italic="0" spellChecking="0"/>
0243 <itemData name="Tool" defStyleNum="dsNormal" color="#0000D6" bold="1" italic="0" spellChecking="0"/>
0244 <itemData name="Alert" defStyleNum="dsError" spellChecking="0"/>
0245 <itemData name="Constant" defStyleNum="dsConstant" spellChecking="0"/>
0246 </itemDatas>
0247 </highlighting>
0248
0249 <general>
0250 <folding indentationsensitive="1"/>
0251 <comments>
0252 <comment name="singleLine" start=";"/>
0253 </comments>
0254 <keywords casesensitive="0"/>
0255 </general>
0256 </language>
0257 <!-- kate: replace-tabs on; indent-width 2; tab-width 2; -->