Debian Codegraph @

data/syntax/carto-css.xml

raw
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE language [
3 <!ENTITY regexpr_identifier "([\w_-]+)">
4 <!ENTITY regexpr_variable "(@&regexpr_identifier;)">
5 <!ENTITY anychar_operator ":,!/*-+=&gt;&lt;()&#x0025;">
6 <!ENTITY regexpr_number "(\-?((\d+(\.\d+)?)|(\.\d+))&#x0025;?)">
7 <!ENTITY regexpr_color "((#[\dabcdefABCDEF]{3}|#[\dabcdefABCDEF]{6})(?=(\W|$)))">
8 ]>
9 <!-- Syntax highlighting definition for CartoCSS MSS, see https://github.com/mapbox/carto
10 CartoCSS defines two file formats: MML (Map Markup Language) and MSS (Map Stylesheet).
11 This file provides syntax highlighting for MSS. MSS is similar in syntax to CSS,
12 but completly different in its semantics. -->
13 <language name="CartoCSS MSS"
14 version="6"
15 kateversion="5.0"
16 section="Markup"
17 extensions="*.mss"
18 author="Lukas Sommer"
19 license="CC0 Public Domain Dedication, version 1.0, as published by Creative Commons">
20
21
22 <highlighting>
23
24 <list name="list_colornames">
25 <!-- This list is based on https://github.com/mapbox/carto/blob/35773a5f519b1ded0d88b14d53ac875cd610bb8c/build/vim-carto/syntax/carto.vim#L53
26 and https://github.com/mapbox/carto/blob/35773a5f519b1ded0d88b14d53ac875cd610bb8c/build/carto.tmbundle/Syntaxes/carto.tmLanguage#L279
27 -->
28 <item>aliceblue</item>
29 <item>antiquewhite</item>
30 <item>aqua</item>
31 <item>aquamarine</item>
32 <item>azure</item>
33 <item>beige</item>
34 <item>bisque</item>
35 <item>black</item>
36 <item>blanchedalmond</item>
37 <item>blue</item>
38 <item>blueviolet</item>
39 <item>brown</item>
40 <item>burlywood</item>
41 <item>cadetblue</item>
42 <item>chartreuse</item>
43 <item>chocolate</item>
44 <item>coral</item>
45 <item>cornflowerblue</item>
46 <item>cornsilk</item>
47 <item>crimson</item>
48 <item>cyan</item>
49 <item>darkblue</item>
50 <item>darkcyan</item>
51 <item>darkgoldenrod</item>
52 <item>darkgray</item>
53 <item>darkgreen</item>
54 <item>darkgrey</item>
55 <item>darkkhaki</item>
56 <item>darkmagenta</item>
57 <item>darkolivegreen</item>
58 <item>darkorange</item>
59 <item>darkorchid</item>
60 <item>darkred</item>
61 <item>darksalmon</item>
62 <item>darkseagreen</item>
63 <item>darkslateblue</item>
64 <item>darkslategrey</item>
65 <item>darkturquoise</item>
66 <item>darkviolet</item>
67 <item>deeppink</item>
68 <item>deepskyblue</item>
69 <item>dimgray</item>
70 <item>dimgrey</item>
71 <item>dodgerblue</item>
72 <item>firebrick</item>
73 <item>floralwhite</item>
74 <item>forestgreen</item>
75 <item>fuchsia</item>
76 <item>gainsboro</item>
77 <item>ghostwhite</item>
78 <item>gold</item>
79 <item>goldenrod</item>
80 <item>gray</item>
81 <item>grey</item>
82 <item>green</item>
83 <item>greenyellow</item>
84 <item>honeydew</item>
85 <item>hotpink</item>
86 <item>indianred</item>
87 <item>indigo</item>
88 <item>ivory</item>
89 <item>khaki</item>
90 <item>lavender</item>
91 <item>lavenderblush</item>
92 <item>lawngreen</item>
93 <item>lemonchiffon</item>
94 <item>lightblue</item>
95 <item>lightcoral</item>
96 <item>lightcyan</item>
97 <item>lightgoldenrodyellow</item>
98 <item>lightgray</item>
99 <item>lightgreen</item>
100 <item>lightgrey</item>
101 <item>lightpink</item>
102 <item>lightsalmon</item>
103 <item>lightseagreen</item>
104 <item>lightskyblue</item>
105 <item>lightslategray</item>
106 <item>lightslategrey</item>
107 <item>lightsteelblue</item>
108 <item>lightyellow</item>
109 <item>lime</item>
110 <item>limegreen</item>
111 <item>linen</item>
112 <item>magenta</item>
113 <item>maroon</item>
114 <item>mediumaquamarine</item>
115 <item>mediumblue</item>
116 <item>mediumorchid</item>
117 <item>mediumpurple</item>
118 <item>mediumseagreen</item>
119 <item>mediumslateblue</item>
120 <item>mediumspringgreen</item>
121 <item>mediumturquoise</item>
122 <item>mediumvioletred</item>
123 <item>midnightblue</item>
124 <item>mintcream</item>
125 <item>mistyrose</item>
126 <item>moccasin</item>
127 <item>navajowhite</item>
128 <item>navy</item>
129 <item>oldlace</item>
130 <item>olive</item>
131 <item>olivedrab</item>
132 <item>orange</item>
133 <item>orangered</item>
134 <item>orchid</item>
135 <item>palegoldenrod</item>
136 <item>palegreen</item>
137 <item>paleturquoise</item>
138 <item>palevioletred</item>
139 <item>papayawhip</item>
140 <item>peachpuff</item>
141 <item>peru</item>
142 <item>pink</item>
143 <item>plum</item>
144 <item>powderblue</item>
145 <item>purple</item>
146 <item>red</item>
147 <item>rosybrown</item>
148 <item>royalblue</item>
149 <item>saddlebrown</item>
150 <item>salmon</item>
151 <item>sandybrown</item>
152 <item>seagreen</item>
153 <item>seashell</item>
154 <item>sienna</item>
155 <item>silver</item>
156 <item>skyblue</item>
157 <item>slateblue</item>
158 <item>slategray</item>
159 <item>slategrey</item>
160 <item>snow</item>
161 <item>springgreen</item>
162 <item>steelblue</item>
163 <item>tan</item>
164 <item>teal</item>
165 <item>thistle</item>
166 <item>tomato</item>
167 <item>turquoise</item>
168 <item>violet</item>
169 <item>wheat</item>
170 <item>white</item>
171 <item>whitesmoke</item>
172 <item>yellow</item>
173 <item>yellowgreen</item>
174 <item>transparent</item>
175 </list>
176
177 <contexts>
178
179 <context attribute="Mapnik Symbolizer Parameter" lineEndContext="#stay" name="context_default">
180 <DetectSpaces/>
181 <Detect2Chars attribute="Comment" context="context_comment_multiline" char="/" char1="*" lookAhead="true" beginRegion="region_comment"/>
182 <Detect2Chars attribute="Comment" context="context_comment_singleline" char="/" char1="/" lookAhead="true"/>
183 <DetectChar attribute="Operator" char="{" beginRegion="region_braces"/>
184 <DetectChar attribute="Operator" char="}" endRegion="region_braces"/>
185 <DetectChar attribute="Operator" char="[" context="context_filter_attribute"/> <!-- This rule must be _before_ the “Operator” rule to make sure it is working. -->
186 <RegExpr attribute="Attachment" String="::&regexpr_identifier;"/> <!-- This rule must be _before_ the “Operator” rule to make sure it is working. -->
187 <DetectChar attribute="Operator" char=":" context="context_expression"/>
188 <RegExpr attribute="CartoCSS Variable" String="&regexpr_variable;"/>
189 <RegExpr attribute="Named instances" String="&regexpr_identifier;/"/>
190 <RegExpr attribute="Layer ID" String="#&regexpr_identifier;"/>
191 <RegExpr attribute="Class" String="\.&regexpr_identifier;"/>
192 </context>
193
194 <context attribute="Keyword" lineEndContext="#stay" name="context_expression">
195 <DetectSpaces/>
196 <RangeDetect char="[" char1="]" attribute="Data Field"/> <!-- This rule must be _before_ the “Operator” rule to make sure it is working. -->
197 <RegExpr attribute="Number" String="&regexpr_number;"/> <!-- This rule must be _before_ the “Operator” rule to make sure it is working. -->
198 <AnyChar attribute="Operator" String="&anychar_operator;[]"/>
199 <RegExpr attribute="CartoCSS Variable" String="&regexpr_variable;"/>
200 <RegExpr attribute="Function" String="&regexpr_identifier;(?=\()"/>
201 <RegExpr attribute="Color" String="&regexpr_color;"/>
202 <keyword attribute="Color" context="#stay" String="list_colornames"/>
203 <!-- The strings that might appear hear (both single-quoted and double-quoted strings)
204 are either normal strings or expression strings: If they are the only content
205 (like in “test: "mystring";”) than they are expression strings. If there is other
206 content (like in “test: "mystring" + [myfield];” or “test: [myfield] + "mystring";”),
207 than they are normal strings. This is however difficult to detect, therefore we default
208 simply to expression strings.-->
209 <DetectChar attribute="Expression String" char="&quot;" context="context_expressionstring_doublequote"/>
210 <DetectChar attribute="Expression String" char="'" context="context_expressionstring_singlequote"/>
211 <!-- An expression ends with a semicolon “;”. However, the
212 CartoCSS parser allows to omit the semicolon at the end
213 of a block of curly braces “{}”. Therefore, we also
214 have to detect the closing curly braces “}” here: -->
215 <DetectChar attribute="Operator" char=";" context="#pop"/>
216 <DetectChar attribute="Operator" char="}" endRegion="region_braces" context="#pop"/>
217 </context>
218
219 <context attribute="Data Field" lineEndContext="#stay" name="context_filter_attribute">
220 <DetectSpaces/>
221 <RegExpr attribute="CartoCSS Variable" String="&regexpr_variable;"/>
222 <AnyChar attribute="Operator" String="&anychar_operator;" context="context_filter_rule"/>
223 <WordDetect String="zoom" insensitive="true" attribute="Keyword"/>
224 <DetectChar attribute="Data Field" char="&quot;" context="context_filter_attribute_doublequote"/>
225 <DetectChar attribute="Data Field" char="'" context="context_filter_attribute_singlequote"/>
226 <DetectChar attribute="Operator" char="]" context="#pop"/>
227 </context>
228
229 <context attribute="Data Field" lineEndContext="#pop" name="context_filter_attribute_doublequote">
230 <DetectChar char="&quot;" context="#pop"/>
231 </context>
232
233 <context attribute="Data Field" lineEndContext="#pop" name="context_filter_attribute_singlequote">
234 <DetectChar char="'" context="#pop"/>
235 </context>
236
237 <context attribute="Keyword" lineEndContext="#stay" name="context_filter_rule">
238 <DetectSpaces/>
239 <RegExpr attribute="Number" String="&regexpr_number;"/> <!-- This rule must be _before_ the “Operator” rule to make sure it is working. -->
240 <AnyChar attribute="Operator" String="&anychar_operator;"/>
241 <RegExpr attribute="CartoCSS Variable" String="&regexpr_variable;"/>
242 <WordDetect String="zoom" insensitive="true" attribute="Keyword"/>
243 <RegExpr attribute="Function" String="&regexpr_identifier;(?=\()"/>
244 <RegExpr attribute="Color" String="&regexpr_color;"/>
245 <keyword attribute="Color" context="#stay" String="list_colornames"/>
246 <DetectChar attribute="Normal String" char="&quot;" context="context_normalstring_doublequote"/>
247 <DetectChar attribute="Normal String" char="'" context="context_normalstring_singlequote"/>
248 <DetectChar attribute="Operator" char="]" context="#pop#pop"/>
249 </context>
250
251 <context attribute="Comment" lineEndContext="#stay" name="context_comment_multiline">
252 <Detect2Chars attribute="Comment" context="#pop" char="*" char1="/" endRegion="region_comment"/>
253 <IncludeRules context="##Comments"/>
254 </context>
255
256 <context attribute="Comment" lineEndContext="#pop" name="context_comment_singleline">
257 <IncludeRules context="##Comments"/>
258 </context>
259
260 <context attribute="Expression String" lineEndContext="#pop" name="context_expressionstring_doublequote">
261 <DetectChar attribute="Expression String" char="&quot;" context="#pop"/>
262 <RangeDetect char="[" char1="]" attribute="Data Field"/>
263 <RegExpr attribute="Mapnik Render-Time Variable" String="&regexpr_variable;"/>
264 <DetectChar attribute="Normal String" char="'" context="context_normalstring_singlequote"/>
265 </context>
266
267 <context attribute="Expression String" lineEndContext="#pop" name="context_expressionstring_singlequote">
268 <DetectChar attribute="Expression String" char="'" context="#pop"/>
269 <RangeDetect char="[" char1="]" attribute="Data Field"/>
270 <RegExpr attribute="Mapnik Render-Time Variable" String="&regexpr_variable;"/>
271 <DetectChar attribute="Normal String" char="&quot;" context="context_normalstring_doublequote"/>
272 </context>
273
274 <context attribute="Normal String" lineEndContext="#pop" name="context_include_escape_characters">
275 <!-- Helper context. Can be included in other contexts to detect escape characters. -->
276 <RegExpr attribute="Escape Sequenze" String="(\\[abfnrtv&quot;'\\])|(\\u[0-9a-fA-F]{4})|(\\U[0-9a-fA-F]{8})"/>
277 <RegExpr attribute="Error" String="\\[uU]"/>
278 </context>
279
280 <context attribute="Normal String" lineEndContext="#pop" name="context_normalstring_doublequote">
281 <DetectChar attribute="Normal String" char="&quot;" context="#pop"/>
282 <IncludeRules context="context_include_escape_characters"/>
283 </context>
284
285 <context attribute="Normal String" lineEndContext="#pop" name="context_normalstring_singlequote">
286 <DetectChar attribute="Normal String" char="'" context="#pop"/>
287 <IncludeRules context="context_include_escape_characters"/>
288 </context>
289
290 </contexts>
291
292 <itemDatas>
293 <itemData name="Class" defStyleNum="dsNormal" spellChecking="false"/>
294 <itemData name="Layer ID" defStyleNum="dsNormal" spellChecking="false"/>
295 <itemData name="Attachment" defStyleNum="dsControlFlow" spellChecking="false"/>
296 <itemData name="Named instances" defStyleNum="dsDataType" spellChecking="false"/>
297 <itemData name="Mapnik Symbolizer Parameter" defStyleNum="dsNormal" spellChecking="false"/>
298 <itemData name="Operator" defStyleNum="dsOperator" spellChecking="false"/>
299 <itemData name="Keyword" defStyleNum="dsKeyword" spellChecking="false"/>
300 <itemData name="Function" defStyleNum="dsFunction" spellChecking="false"/>
301 <itemData name="Number" defStyleNum="dsFloat" spellChecking="false"/>
302 <itemData name="Color" defStyleNum="dsConstant" spellChecking="false"/>
303 <itemData name="Expression String" defStyleNum="dsSpecialString" spellChecking="false"/>
304 <!-- “Mapnik Render-Time Variable” work completly different from “CartoCSS Variable” and
305 has therefore a completly different color. -->
306 <itemData name="Mapnik Render-Time Variable" defStyleNum="dsSpecialChar" spellChecking="false"/>
307 <itemData name="Normal String" defStyleNum="dsString" spellChecking="false"/>
308 <itemData name="Escape Sequenze" defStyleNum="dsSpecialChar" spellChecking="false"/>
309 <itemData name="Data Field" defStyleNum="dsVariable" spellChecking="false"/>
310 <!-- “CartoCSS Variable”, inspite of its name, uses “dsPreprocessor” as default color.
311 This is appropriate because it actually behaves rather like a preprocessor: It is even
312 possible to define strings, and if escape sequences like “\n” are treated as such
313 is decided later, depending on the position of the actual usage of the variable. -->
314 <itemData name="CartoCSS Variable" defStyleNum="dsPreprocessor" spellChecking="false"/>
315 <itemData name="Comment" defStyleNum="dsComment" spellChecking="true" />
316 <itemData name="Error" defStyleNum="dsError" spellChecking="false"/>
317 </itemDatas>
318
319 </highlighting>
320
321 <general>
322 <comments>
323 <comment name="singleLine" start="//" position="afterwhitespace"/>
324 <comment name="multiLine" start="/*" end="*/" region="region_comment"/>
325 </comments>
326 <keywords casesensitive="true" weakDeliminator="-"/>
327 </general>
328 </language>
329 <!-- kate: replace-tabs off; -->