| 1 |
<?xml version="1.0" encoding="UTF-8"?> |
| 2 |
<!DOCTYPE language [ |
| 3 |
<!ENTITY hex "[0-9a-fA-F]"> |
| 4 |
<!ENTITY int "(?:[0-9](?:_?[0-9]++)*+)"> |
| 5 |
<!ENTITY hex_int "(?:[0-9A-Fa-f](?:_?[0-9A-Fa-f]++)*+)"> |
| 6 |
<!ENTITY exp_float "(?:[eE][+-]?∫)"> |
| 7 |
<!ENTITY exp_hexfloat "(?:[pP][-+]?∫)"> |
| 8 |
]> |
| 9 |
|
| 10 |
<!-- |
| 11 |
This file is part of KDE's Kate project |
| 12 |
|
| 13 |
GO.XML supports syntax highlighting for the Go programming language |
| 14 |
under Kate. Go is a compiled, garbage-collected, concurrent programming |
| 15 |
language developed by Google Inc. |
| 16 |
|
| 17 |
Copyright (C) 2010, Miquel Sabaté <[email protected]> |
| 18 |
|
| 19 |
This program, including associated files, is free software. You may |
| 20 |
distribute it and/or modify it under the terms of the GNU General Public |
| 21 |
License as published by the Free Software Foundation; either Version 2 of |
| 22 |
the license, or (at your option) any later version. |
| 23 |
|
| 24 |
This program is distributed in the hope that it will be useful, but |
| 25 |
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 26 |
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 27 |
for more details. |
| 28 |
|
| 29 |
You should have received a copy of the GNU General Public License along |
| 30 |
with this program; if not, write to the Free Software Foundation, Inc., |
| 31 |
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 32 |
--> |
| 33 |
|
| 34 |
<language name="Go" version="10" kateversion="5.79" section="Sources" indenter="cstyle" extensions="*.go" author="Miquel Sabaté ([email protected])" license="GPLv2+"> |
| 35 |
<!-- https://go.dev/ref/spec --> |
| 36 |
<highlighting> |
| 37 |
|
| 38 |
<!-- https://go.dev/ref/spec#Keywords --> |
| 39 |
<list name="keywords"> |
| 40 |
<item>chan</item> |
| 41 |
<item>const</item> |
| 42 |
<item>func</item> |
| 43 |
<item>import</item> |
| 44 |
<item>interface</item> |
| 45 |
<item>map</item> |
| 46 |
<item>package</item> |
| 47 |
<item>range</item> |
| 48 |
<item>struct</item> |
| 49 |
<item>type</item> |
| 50 |
<item>var</item> |
| 51 |
</list> |
| 52 |
<list name="controlflow"> |
| 53 |
<item>break</item> |
| 54 |
<item>case</item> |
| 55 |
<item>continue</item> |
| 56 |
<item>default</item> |
| 57 |
<item>defer</item> |
| 58 |
<item>else</item> |
| 59 |
<item>fallthrough</item> |
| 60 |
<item>for</item> |
| 61 |
<item>go</item> |
| 62 |
<item>goto</item> |
| 63 |
<item>if</item> |
| 64 |
<item>return</item> |
| 65 |
<item>select</item> |
| 66 |
<item>switch</item> |
| 67 |
</list> |
| 68 |
|
| 69 |
<!-- https://go.dev/ref/spec#Types --> |
| 70 |
<list name="types"> |
| 71 |
<item>bool</item> |
| 72 |
<item>byte</item> |
| 73 |
<item>complex64</item> |
| 74 |
<item>complex128</item> |
| 75 |
<item>error</item> |
| 76 |
<item>float32</item> |
| 77 |
<item>float64</item> |
| 78 |
<item>int</item> |
| 79 |
<item>int8</item> |
| 80 |
<item>int16</item> |
| 81 |
<item>int32</item> |
| 82 |
<item>int64</item> |
| 83 |
<item>rune</item> |
| 84 |
<item>string</item> |
| 85 |
<item>uint</item> |
| 86 |
<item>uintptr</item> |
| 87 |
<item>uint8</item> |
| 88 |
<item>uint16</item> |
| 89 |
<item>uint32</item> |
| 90 |
<item>uint64</item> |
| 91 |
<!-- Go 1.18 --> |
| 92 |
<item>any</item> |
| 93 |
<item>comparable</item> |
| 94 |
</list> |
| 95 |
|
| 96 |
<list name="builtin"> |
| 97 |
<item>append</item> |
| 98 |
<item>cap</item> |
| 99 |
<item>close</item> |
| 100 |
<item>complex</item> |
| 101 |
<item>copy</item> |
| 102 |
<item>delete</item> |
| 103 |
<item>imag</item> |
| 104 |
<item>len</item> |
| 105 |
<item>make</item> |
| 106 |
<item>new</item> |
| 107 |
<item>panic</item> |
| 108 |
<item>print</item> |
| 109 |
<item>println</item> |
| 110 |
<item>real</item> |
| 111 |
<item>recover</item> |
| 112 |
</list> |
| 113 |
|
| 114 |
<list name="predeclared"> |
| 115 |
<item>false</item> |
| 116 |
<item>nil</item> |
| 117 |
<item>true</item> |
| 118 |
<item>iota</item> |
| 119 |
</list> |
| 120 |
|
| 121 |
<contexts> |
| 122 |
<context name="normal" attribute="Normal Text" lineEndContext="#stay"> |
| 123 |
<DetectSpaces /> |
| 124 |
<keyword attribute="Keyword" context="#stay" String="keywords" /> |
| 125 |
<keyword attribute="Control Flow" context="#stay" String="controlflow" /> |
| 126 |
<keyword attribute="Predeclared Identifier" context="#stay" String="predeclared" /> |
| 127 |
<keyword attribute="Data Type" context="#stay" String="types" /> |
| 128 |
<keyword attribute="Builtin Function" context="#stay" String="builtin" /> |
| 129 |
<DetectIdentifier /> |
| 130 |
<DetectChar attribute="Symbol" context="#stay" char="{" beginRegion="Brace1" /> |
| 131 |
<DetectChar attribute="Symbol" context="#stay" char="}" endRegion="Brace1" /> |
| 132 |
<Detect2Chars attribute="Comment" context="Commentar 1" char="/" char1="/" /> |
| 133 |
<Detect2Chars attribute="Comment" context="Commentar 2" char="/" char1="*" beginRegion="Comment" /> |
| 134 |
<RegExpr context="Number" String="\.?[0-9]" lookAhead="true" /> |
| 135 |
<AnyChar attribute="Symbol" context="#stay" String=":!%&()+,-/.*<=>?[]|~^;"/> |
| 136 |
<DetectChar attribute="String" context="String" char=""" /> |
| 137 |
<DetectChar attribute="Char" context="Char" char="'" /> |
| 138 |
<DetectChar attribute="String" context="Multiline String" char="`"/> |
| 139 |
</context> |
| 140 |
|
| 141 |
<context attribute="Comment" lineEndContext="#pop" name="Commentar 1"> |
| 142 |
<DetectSpaces /> |
| 143 |
<IncludeRules context="##Comments" /> |
| 144 |
<DetectIdentifier /> |
| 145 |
</context> |
| 146 |
|
| 147 |
<context attribute="Comment" lineEndContext="#stay" name="Commentar 2"> |
| 148 |
<DetectSpaces /> |
| 149 |
<Detect2Chars attribute="Comment" context="#pop" char="*" char1="/" endRegion="Comment"/> |
| 150 |
<IncludeRules context="##Comments" /> |
| 151 |
<DetectIdentifier /> |
| 152 |
</context> |
| 153 |
|
| 154 |
<!-- https://go.dev/ref/spec#Integer_literals --> |
| 155 |
<!-- https://go.dev/ref/spec#Floating-point_literals --> |
| 156 |
<context attribute="Normal Text" lineEndContext="#pop" name="Number"> |
| 157 |
<WordDetect attribute="Decimal" context="NumberSuffix" String="0" weakDeliminator="."/> |
| 158 |
<RegExpr attribute="Float" context="NumberSuffix" String="\.∫&exp_float;?|0[xX](?:\.&hex_int;&exp_hexfloat;?|_?&hex_int;(?:&exp_hexfloat;|\.&hex_int;?&exp_hexfloat;?))|∫(?:&exp_float;|\.∫?&exp_float;?)" /> |
| 159 |
<DetectChar context="#pop!IntStartsWith0" char="0" lookAhead="1"/> |
| 160 |
<RegExpr attribute="Decimal" context="NumberSuffix" String="∫" /> |
| 161 |
</context> |
| 162 |
<context name="IntStartsWith0" attribute="Normal Text" lineEndContext="#pop"> |
| 163 |
<RegExpr attribute="Hex" context="NumberSuffix" String="0[xX](?:_?[0-9A-Fa-f]++)*+" /> |
| 164 |
<RegExpr attribute="Binary" context="NumberSuffix" String="0[Bb](?:_?[01]++)*+" /> |
| 165 |
<RegExpr attribute="Octal" context="NumberSuffix" String="0[Oo]?(?:_?[0-7]++)*+" /> |
| 166 |
<DetectChar attribute="Decimal" context="NumberSuffix" char="0"/> |
| 167 |
</context> |
| 168 |
|
| 169 |
<context name="NumberSuffix" attribute="Error" lineEndContext="#pop#pop" fallthroughContext="NumericSuffixError"> |
| 170 |
<DetectChar attribute="Suffix" context="NumericSuffixError" char="i" /> |
| 171 |
<DetectChar attribute="Error" context="#stay" char="_" /> |
| 172 |
</context> |
| 173 |
<context name="NumericSuffixError" attribute="Error" lineEndContext="#pop#pop#pop" fallthroughContext="#pop#pop#pop"> |
| 174 |
<RegExpr attribute="Error" context="#pop#pop#pop" String="[._0-9A-Za-z]+" /> |
| 175 |
</context> |
| 176 |
|
| 177 |
<!-- https://go.dev/ref/spec#String_literals --> |
| 178 |
<context attribute="String" lineEndContext="#pop" name="String"> |
| 179 |
<DetectChar attribute="String" context="#pop" char=""" /> |
| 180 |
<IncludeRules context="FindEscape" /> |
| 181 |
</context> |
| 182 |
|
| 183 |
<context attribute="String" lineEndContext="#pop" name="FindEscape"> |
| 184 |
<DetectChar context="EscapedChar" char="\" lookAhead="1"/> |
| 185 |
</context> |
| 186 |
<context attribute="String" lineEndContext="#pop" name="EscapedChar"> |
| 187 |
<RegExpr attribute="String Char" context="#pop" String="\\[abfnrtv\\'"]|\\x&hex;{2}|\\u&hex;{4}|\\U&hex;{8}|\\[0-3][0-7]{2}" /> |
| 188 |
<RegExpr attribute="Error" context="#pop" String="\\[xuU]&hex;*|\\[0-7]{1,3}|\\" /> |
| 189 |
</context> |
| 190 |
|
| 191 |
<context attribute="String" lineEndContext="#stay" name="Multiline String"> |
| 192 |
<DetectChar attribute="String" context="#pop" char="`"/> |
| 193 |
</context> |
| 194 |
|
| 195 |
<context attribute="Char" lineEndContext="#pop" name="Char"> |
| 196 |
<DetectChar attribute="Char" context="#pop" char="'" /> |
| 197 |
<IncludeRules context="FindEscape" /> |
| 198 |
</context> |
| 199 |
|
| 200 |
</contexts> |
| 201 |
|
| 202 |
<itemDatas> |
| 203 |
<itemData name="Normal Text" defStyleNum="dsNormal" spellChecking="false"/> |
| 204 |
<itemData name="Keyword" defStyleNum="dsKeyword" spellChecking="false"/> |
| 205 |
<itemData name="Control Flow" defStyleNum="dsControlFlow" spellChecking="false"/> |
| 206 |
<itemData name="Predeclared Identifier" defStyleNum="dsOthers" spellChecking="false" /> |
| 207 |
<itemData name="Builtin Function" defStyleNum="dsBuiltIn" spellChecking="false" /> |
| 208 |
<itemData name="Data Type" defStyleNum="dsDataType" spellChecking="false"/> |
| 209 |
<itemData name="String Char" defStyleNum="dsChar" spellChecking="false"/> |
| 210 |
<itemData name="String" defStyleNum="dsString" /> |
| 211 |
<itemData name="Comment" defStyleNum="dsComment" /> |
| 212 |
<itemData name="Decimal" defStyleNum="dsDecVal" spellChecking="false"/> |
| 213 |
<itemData name="Binary" defStyleNum="dsBaseN" spellChecking="false"/> |
| 214 |
<itemData name="Octal" defStyleNum="dsBaseN" spellChecking="false"/> |
| 215 |
<itemData name="Hex" defStyleNum="dsBaseN" spellChecking="false"/> |
| 216 |
<itemData name="Float" defStyleNum="dsFloat" spellChecking="false"/> |
| 217 |
<itemData name="Suffix" defStyleNum="dsBuiltIn" spellChecking="false"/> |
| 218 |
<itemData name="Char" defStyleNum="dsChar" spellChecking="false"/> |
| 219 |
<itemData name="Symbol" defStyleNum="dsOperator" spellChecking="false"/> |
| 220 |
<itemData name="Error" defStyleNum="dsError" spellChecking="false"/> |
| 221 |
</itemDatas> |
| 222 |
</highlighting> |
| 223 |
<general> |
| 224 |
<comments> |
| 225 |
<comment name="singleLine" start="//" position="afterwhitespace" /> |
| 226 |
<comment name="multiLine" start="/*" end="*/" region="Comment"/> |
| 227 |
</comments> |
| 228 |
<keywords casesensitive="1" additionalDeliminator="'"" /> |
| 229 |
</general> |
| 230 |
</language> |
| 231 |
<!-- kate: replace-tabs on; tab-width 2; indent-width 2; --> |