1 <?xml version="1.0"?>
\r
2 <!DOCTYPE MODE SYSTEM "xmode.dtd">
\r
3 <!-- Ruby mode by Ian Maclean (Ruby edit mode v0.6.2) -->
\r
4 <!-- tweakage by Chris Morris - clabs.org -->
\r
5 <!-- further tweakage by Christophe Grandsire -->
\r
6 <!-- further tweakage by Robert McKinnon 2004 -->
\r
7 <!-- Major overhaul by Karl von Laudermann -->
\r
8 <!-- recommended mode catalog entry:
\r
9 <MODE NAME="ruby" FILE="ruby.xml" FILE_NAME_GLOB="*.{rb,rbw}" FIRST_LINE_GLOB="#!*/*ruby*" /> -->
\r
12 <PROPERTY NAME="indentOpenBrackets" VALUE=""/>
\r
13 <PROPERTY NAME="indentCloseBrackets" VALUE="}"/>
\r
14 <PROPERTY NAME="lineUpClosingBracket" VALUE="true"/>
\r
15 <PROPERTY NAME="commentStart" VALUE="=begin"/>
\r
16 <PROPERTY NAME="commentEnd" VALUE="=end"/>
\r
17 <PROPERTY NAME="lineComment" VALUE="#"/>
\r
18 <PROPERTY NAME="indentNextLines" VALUE="\s*((if\s+.*|elsif\s+.*|else\s*|do(\s*|\s+.*)|case\s+.*|when\s+.*|while\s+.*|for\s+.*|until\s+.*|loop\s+.*|def\s+.*|class\s+.*|module\s+.*|begin.*|unless\s+.*)*)"/>
\r
20 <RULES ESCAPE="\" IGNORE_CASE="FALSE" HIGHLIGHT_DIGITS="TRUE" DIGIT_RE="(0b[01]([01_]*[01])?)|(0x[\p{XDigit}]([\p{XDigit}_]*[\p{XDigit}])?)|(0([0-7_]*[0-7])?)|(0d[0-9]([0-9_]*[0-9])?)|([1-9]([0-9_]*[0-9])?)|([0-9]([0-9_]*[0-9])?[Ee]([0-9]([0-9_]*[0-9])?)?)">
\r
21 <!-- ^ Binary literal | ^ Hex literal | ^ Octal literal | ^ "0d" Style Dec lit | ^ Normal Dec literal | ^ Float literal w/out dec point, with exp. -->
\r
23 <!-- Ruby comment (Inline Documentation ) -->
\r
24 <SPAN TYPE="COMMENT2">
\r
25 <BEGIN>=begin</BEGIN>
\r
29 <!-- Class and instance vars -->
\r
30 <MARK_FOLLOWING TYPE="KEYWORD4">@</MARK_FOLLOWING>
\r
32 <!-- Perl-style regexps - from perl.xml -->
\r
33 <SEQ_REGEXP TYPE="MARKUP" HASH_CHAR="/" AT_WORD_START="TRUE"
\r
34 >/[^\p{Blank}]*?/</SEQ_REGEXP>
\r
36 <!-- String literals -->
\r
38 <SPAN TYPE="LITERAL1" DELEGATE="doubleQuoteLiteral">
\r
43 <SPAN TYPE="LITERAL1">
\r
48 <!-- %Q(Hello world) %(Hello world)-->
\r
49 <SPAN_REGEXP HASH_CHAR="%" TYPE="LITERAL1" DELEGATE="doubleQuoteLiteral">
\r
50 <BEGIN>%Q?\(</BEGIN>
\r
54 <!-- %q(Hello world) -->
\r
55 <SPAN TYPE="LITERAL1">
\r
60 <!-- %Q{Hello world} %{Hello world} -->
\r
61 <SPAN_REGEXP HASH_CHAR="%" TYPE="LITERAL1" DELEGATE="doubleQuoteLiteral">
\r
62 <BEGIN>%Q?\{</BEGIN>
\r
66 <!-- %q{Hello world} -->
\r
67 <SPAN TYPE="LITERAL1">
\r
72 <!-- %Q[Hello world] %[Hello world] -->
\r
73 <SPAN_REGEXP HASH_CHAR="%" TYPE="LITERAL1" DELEGATE="doubleQuoteLiteral">
\r
74 <BEGIN>%Q?\[</BEGIN>
\r
78 <!-- %q[Hello world] -->
\r
79 <SPAN TYPE="LITERAL1">
\r
84 <!-- %Q<Hello world> %<Hello world> -->
\r
85 <SPAN_REGEXP HASH_CHAR="%" TYPE="LITERAL1" DELEGATE="doubleQuoteLiteral">
\r
86 <BEGIN>%Q?<</BEGIN>
\r
90 <!-- %q<Hello world> -->
\r
91 <SPAN TYPE="LITERAL1">
\r
92 <BEGIN>%q<</BEGIN>
\r
96 <!-- I made the next three forms as three instead of two, because the
\r
97 first two actually support whitespace as a delimiter, and the third
\r
99 <!-- %Q$Hello world$ -->
\r
100 <SPAN_REGEXP HASH_CHAR="%Q" TYPE="LITERAL1" DELEGATE="doubleQuoteLiteral">
\r
101 <BEGIN>%Q([^\p{Alnum}])</BEGIN>
\r
105 <!-- %q$Hello world$ -->
\r
106 <SPAN_REGEXP HASH_CHAR="%q" TYPE="LITERAL1">
\r
107 <BEGIN>%q([^\p{Alnum}])</BEGIN>
\r
111 <!-- %$Hello world$ -->
\r
112 <SPAN_REGEXP HASH_CHAR="%" TYPE="LITERAL1" DELEGATE="doubleQuoteLiteral">
\r
113 <BEGIN>%([^\p{Alnum}\p{Space}])</BEGIN>
\r
117 <!-- %W(Array of strings) -->
\r
118 <SPAN TYPE="LITERAL1" DELEGATE="doubleQuoteLiteral">
\r
123 <!-- %w(Array of strings) -->
\r
124 <SPAN TYPE="LITERAL1">
\r
129 <!-- %W{Array of strings} -->
\r
130 <SPAN TYPE="LITERAL1" DELEGATE="doubleQuoteLiteral">
\r
135 <!-- %w{Array of strings} -->
\r
136 <SPAN TYPE="LITERAL1">
\r
141 <!-- %W[Array of strings] -->
\r
142 <SPAN TYPE="LITERAL1" DELEGATE="doubleQuoteLiteral">
\r
147 <!-- %w[Array of strings] -->
\r
148 <SPAN TYPE="LITERAL1">
\r
153 <!-- %W<Array of strings> -->
\r
154 <SPAN TYPE="LITERAL1" DELEGATE="doubleQuoteLiteral">
\r
155 <BEGIN>%W<</BEGIN>
\r
159 <!-- %w<Array of strings> -->
\r
160 <SPAN TYPE="LITERAL1">
\r
161 <BEGIN>%w<</BEGIN>
\r
165 <!-- %W$Array of strings$ -->
\r
166 <SPAN_REGEXP HASH_CHAR="%W" TYPE="LITERAL1" DELEGATE="doubleQuoteLiteral">
\r
167 <BEGIN>%W([^\p{Alnum}\p{Space}])</BEGIN>
\r
171 <!-- %w@Array of strings@ -->
\r
172 <SPAN_REGEXP HASH_CHAR="%w" TYPE="LITERAL1">
\r
173 <BEGIN>%w([^\p{Alnum}\p{Space}])</BEGIN>
\r
177 <!-- Here documents <<"FOO" <<-"FOO" -->
\r
178 <!-- Unfortunately, in a SPAN_REGEXP element only the <BEGIN> tag takes
\r
179 a regex, not the <END> tag. So an instance of FOO anywhere in the here
\r
180 document will terminate highlighting; I couldn't make it smarter. -->
\r
181 <SPAN_REGEXP HASH_CHAR="<<" TYPE="LITERAL1" DELEGATE="doubleQuoteLiteral">
\r
182 <BEGIN><<-?"([\p{Graph}]+)"</BEGIN>
\r
186 <!-- Here documents <<'FOO' <<-'FOO' -->
\r
187 <!-- Unfortunately, in a SPAN_REGEXP element only the <BEGIN> tag takes
\r
188 a regex, not the <END> tag. So an instance of FOO anywhere in the here
\r
189 document will terminate highlighting; I couldn't make it smarter. -->
\r
190 <SPAN_REGEXP HASH_CHAR="<<" TYPE="LITERAL1">
\r
191 <BEGIN><<-?'([\p{Graph}]+)'</BEGIN>
\r
195 <!-- Here documents <<FOO <<-FOO -->
\r
196 <!-- Unfortunately, in a SPAN_REGEXP element only the <BEGIN> tag takes
\r
197 a regex, not the <END> tag. So an instance of FOO anywhere in the here
\r
198 document will terminate highlighting; I couldn't make it smarter. -->
\r
199 <SPAN_REGEXP HASH_CHAR="<<" TYPE="LITERAL1" DELEGATE="doubleQuoteLiteral">
\r
200 <BEGIN><<-?([A-Za-z_]+)</BEGIN>
\r
204 <!-- Shell command strings -->
\r
206 <!-- `echo foo` -->
\r
207 <SPAN TYPE="LITERAL2" DELEGATE="BackquoteLiteral">
\r
212 <!-- %x(echo foo) -->
\r
213 <SPAN TYPE="LITERAL2" DELEGATE="BackquoteLiteral">
\r
218 <!-- %x{echo foo} -->
\r
219 <SPAN TYPE="LITERAL2" DELEGATE="BackquoteLiteral">
\r
224 <!-- %x[echo foo] -->
\r
225 <SPAN TYPE="LITERAL2" DELEGATE="BackquoteLiteral">
\r
230 <!-- %x<echo foo> -->
\r
231 <SPAN TYPE="LITERAL2" DELEGATE="BackquoteLiteral">
\r
232 <BEGIN>%x<</BEGIN>
\r
236 <!-- %x$echo foo$ -->
\r
237 <SPAN_REGEXP HASH_CHAR="%x" TYPE="LITERAL2" DELEGATE="BackquoteLiteral">
\r
238 <BEGIN>%x([^\p{Alnum}\p{Space}])</BEGIN>
\r
242 <!-- Regular expressions -->
\r
244 <!-- /regexp?/i -->
\r
245 <!-- This doesn't really work well, because it can't distinguish a regexp
\r
246 from multiple instances of the "/" division operator on the same line. -->
\r
247 <!-- <SEQ_REGEXP HASH_CHAR="/" AT_WORD_START="TRUE"
\r
248 TYPE="LITERAL3">/[^/]+/[iomx]*</SEQ_REGEXP> -->
\r
250 <!-- %r(regexp?) -->
\r
251 <SPAN TYPE="LITERAL3" DELEGATE="RegexpLiteral">
\r
256 <!-- %r{regexp?} -->
\r
257 <SPAN TYPE="LITERAL3" DELEGATE="RegexpLiteral">
\r
262 <!-- %r[regexp?] -->
\r
263 <SPAN TYPE="LITERAL3" DELEGATE="RegexpLiteral">
\r
268 <!-- %r<regexp?> -->
\r
269 <SPAN TYPE="LITERAL3" DELEGATE="RegexpLiteral">
\r
270 <BEGIN>%r<</BEGIN>
\r
274 <!-- %r$regexp?$ -->
\r
275 <SPAN_REGEXP HASH_CHAR="%r" TYPE="LITERAL3" DELEGATE="RegexpLiteral">
\r
276 <BEGIN>%r([^\p{Alnum}\p{Space}])</BEGIN>
\r
280 <!-- (/regexp/) -->
\r
281 <SPAN DELEGATE="RegexpLiteral" MATCH_TYPE="OPERATOR" TYPE="LITERAL3">
\r
286 <!-- Nested code block -->
\r
287 <!-- I included this just because it can appear in a "/" delimited
\r
288 regular expression, handling of which is commented out above. So this
\r
289 would otherwise be colored as a comment. -->
\r
290 <SPAN TYPE="OPERATOR" DELEGATE="MAIN">
\r
295 <!-- Std Comment -->
\r
296 <EOL_SPAN TYPE="COMMENT1">#</EOL_SPAN>
\r
298 <!-- Predefined global variables -->
\r
299 <SEQ_REGEXP HASH_CHAR="$-" TYPE="KEYWORD3" AT_WORD_START="TRUE">\$-[0adFiIKlpvw](?![\p{Alnum}_])</SEQ_REGEXP>
\r
301 <SEQ_REGEXP HASH_CHAR="$" TYPE="KEYWORD3" AT_WORD_START="TRUE">\$[0-9!@&\+`'=~/\\,\.;<>_\*"\$\?\:F](?![\p{Alnum}_])</SEQ_REGEXP>
\r
303 <!-- Because of the ? char, this can't be done as a KEYWORD element -->
\r
304 <SEQ TYPE="KEYWORD1" AT_WORD_START="TRUE">defined?</SEQ>
\r
306 <!-- Highlight "include" but not "include?" -->
\r
307 <SEQ_REGEXP HASH_CHAR="include" TYPE="KEYWORD2" AT_WORD_START="TRUE">include(?![\p{Alnum}_\?])</SEQ_REGEXP>
\r
309 <!-- Not Operators but like the syntax highlight to match operators -->
\r
310 <SEQ TYPE="OPERATOR">{</SEQ>
\r
311 <SEQ TYPE="OPERATOR">}</SEQ>
\r
312 <SEQ TYPE="OPERATOR">(</SEQ>
\r
313 <SEQ TYPE="OPERATOR">)</SEQ>
\r
315 <!-- Arithmetic operators -->
\r
316 <SEQ TYPE="OPERATOR">::</SEQ>
\r
317 <SEQ TYPE="OPERATOR">===</SEQ>
\r
318 <SEQ TYPE="OPERATOR">=</SEQ>
\r
319 <SEQ TYPE="OPERATOR">>></SEQ>
\r
320 <SEQ TYPE="OPERATOR"><<</SEQ>
\r
321 <SEQ TYPE="OPERATOR"><=</SEQ>
\r
322 <SEQ TYPE="OPERATOR">+</SEQ>
\r
323 <SEQ TYPE="OPERATOR">-</SEQ>
\r
324 <SEQ TYPE="OPERATOR">/</SEQ>
\r
326 <SEQ TYPE="OPERATOR">**</SEQ>
\r
327 <SEQ TYPE="OPERATOR">*</SEQ>
\r
329 <SEQ TYPE="OPERATOR">%</SEQ>
\r
331 <!-- Logical Operators -->
\r
332 <SEQ TYPE="OPERATOR">&</SEQ>
\r
333 <SEQ TYPE="OPERATOR">|</SEQ>
\r
334 <SEQ TYPE="OPERATOR">!</SEQ>
\r
335 <SEQ TYPE="OPERATOR">></SEQ>
\r
336 <SEQ TYPE="OPERATOR"><</SEQ>
\r
337 <SEQ TYPE="OPERATOR">^</SEQ>
\r
338 <SEQ TYPE="OPERATOR">~</SEQ>
\r
340 <!-- Range operators -->
\r
341 <SEQ TYPE="OPERATOR">...</SEQ>
\r
342 <SEQ TYPE="OPERATOR">..</SEQ>
\r
344 <SEQ TYPE="OPERATOR">]</SEQ>
\r
345 <SEQ TYPE="OPERATOR">[</SEQ>
\r
346 <SEQ TYPE="OPERATOR">?</SEQ>
\r
349 <SEQ_REGEXP AT_WORD_START="TRUE" HASH_CHAR=":" TYPE="LABEL">:[\p{Alpha}_][\p{Alnum}_]*</SEQ_REGEXP>
\r
351 <SEQ TYPE="OPERATOR">:</SEQ>
\r
354 <KEYWORD1>BEGIN</KEYWORD1>
\r
355 <KEYWORD1>END</KEYWORD1>
\r
356 <KEYWORD1>alias</KEYWORD1>
\r
357 <KEYWORD1>begin</KEYWORD1>
\r
358 <KEYWORD1>break</KEYWORD1>
\r
359 <KEYWORD1>case</KEYWORD1>
\r
360 <KEYWORD1>class</KEYWORD1>
\r
361 <KEYWORD1>def</KEYWORD1>
\r
362 <KEYWORD1>do</KEYWORD1>
\r
363 <KEYWORD1>else</KEYWORD1>
\r
364 <KEYWORD1>elsif</KEYWORD1>
\r
365 <KEYWORD1>end</KEYWORD1>
\r
366 <KEYWORD1>ensure</KEYWORD1>
\r
367 <KEYWORD1>for</KEYWORD1>
\r
368 <KEYWORD1>if</KEYWORD1>
\r
369 <KEYWORD1>in</KEYWORD1>
\r
370 <KEYWORD1>module</KEYWORD1>
\r
371 <KEYWORD1>next</KEYWORD1>
\r
372 <KEYWORD1>redo</KEYWORD1>
\r
373 <KEYWORD1>rescue</KEYWORD1>
\r
374 <KEYWORD1>retry</KEYWORD1>
\r
375 <KEYWORD1>return</KEYWORD1>
\r
376 <KEYWORD1>then</KEYWORD1>
\r
377 <KEYWORD1>undef</KEYWORD1>
\r
378 <KEYWORD1>unless</KEYWORD1>
\r
379 <KEYWORD1>until</KEYWORD1>
\r
380 <KEYWORD1>when</KEYWORD1>
\r
381 <KEYWORD1>while</KEYWORD1>
\r
382 <KEYWORD1>yield</KEYWORD1>
\r
384 <KEYWORD2>load</KEYWORD2>
\r
385 <KEYWORD2>require</KEYWORD2>
\r
387 <OPERATOR>and</OPERATOR>
\r
388 <OPERATOR>not</OPERATOR>
\r
389 <OPERATOR>or</OPERATOR>
\r
391 <KEYWORD3>false</KEYWORD3>
\r
392 <KEYWORD3>nil</KEYWORD3>
\r
393 <KEYWORD3>self</KEYWORD3>
\r
394 <KEYWORD3>super</KEYWORD3>
\r
395 <KEYWORD3>true</KEYWORD3>
\r
397 <KEYWORD3>$defout</KEYWORD3>
\r
398 <KEYWORD3>$deferr</KEYWORD3>
\r
399 <KEYWORD3>$stderr</KEYWORD3>
\r
400 <KEYWORD3>$stdin</KEYWORD3>
\r
401 <KEYWORD3>$stdout</KEYWORD3>
\r
402 <KEYWORD3>$DEBUG</KEYWORD3>
\r
403 <KEYWORD3>$FILENAME</KEYWORD3>
\r
404 <KEYWORD3>$LOAD_PATH</KEYWORD3>
\r
405 <KEYWORD3>$SAFE</KEYWORD3>
\r
406 <KEYWORD3>$VERBOSE</KEYWORD3>
\r
407 <KEYWORD3>__FILE__</KEYWORD3>
\r
408 <KEYWORD3>__LINE__</KEYWORD3>
\r
409 <KEYWORD3>ARGF</KEYWORD3>
\r
410 <KEYWORD3>ARGV</KEYWORD3>
\r
411 <KEYWORD3>ENV</KEYWORD3>
\r
412 <KEYWORD3>DATA</KEYWORD3>
\r
413 <KEYWORD3>FALSE</KEYWORD3>
\r
414 <KEYWORD3>NIL</KEYWORD3>
\r
415 <KEYWORD3>RUBY_PLATFORM</KEYWORD3>
\r
416 <KEYWORD3>RUBY_RELEASE_DATE</KEYWORD3>
\r
417 <KEYWORD3>RUBY_VERSION</KEYWORD3>
\r
418 <KEYWORD3>STDERR</KEYWORD3>
\r
419 <KEYWORD3>STDIN</KEYWORD3>
\r
420 <KEYWORD3>STDOUT</KEYWORD3>
\r
421 <KEYWORD3>SCRIPT_LINES__</KEYWORD3>
\r
422 <KEYWORD3>TOPLEVEL_BINDING</KEYWORD3>
\r
423 <KEYWORD3>TRUE</KEYWORD3>
\r
427 <!-- Delegate contents of #{} expression in double quotes to MAIN so that
\r
428 it will be syntax highlighted as well -->
\r
429 <RULES DEFAULT="LITERAL1" SET="doubleQuoteLiteral">
\r
430 <SPAN DELEGATE="MAIN" TYPE="OPERATOR">
\r
434 <MARK_FOLLOWING TYPE="KEYWORD4">#@@</MARK_FOLLOWING>
\r
435 <MARK_FOLLOWING TYPE="KEYWORD4">#@</MARK_FOLLOWING>
\r
436 <MARK_FOLLOWING TYPE="NULL">#$</MARK_FOLLOWING>
\r
439 <!-- Delegate contents of #{} expression in backquotes to MAIN so that
\r
440 it will be syntax highlighted as well -->
\r
441 <RULES DEFAULT="LITERAL2" SET="BackquoteLiteral">
\r
442 <SPAN DELEGATE="MAIN" TYPE="OPERATOR">
\r
446 <MARK_FOLLOWING TYPE="KEYWORD4">#@@</MARK_FOLLOWING>
\r
447 <MARK_FOLLOWING TYPE="KEYWORD4">#@</MARK_FOLLOWING>
\r
448 <MARK_FOLLOWING TYPE="NULL">#$</MARK_FOLLOWING>
\r
451 <!-- Delegate contents of #{} expression in a regexp to MAIN so that
\r
452 it will be syntax highlighted as well -->
\r
453 <RULES DEFAULT="LITERAL3" SET="RegexpLiteral">
\r
454 <SPAN DELEGATE="MAIN" TYPE="OPERATOR">
\r
458 <MARK_FOLLOWING TYPE="KEYWORD4">#@@</MARK_FOLLOWING>
\r
459 <MARK_FOLLOWING TYPE="KEYWORD4">#@</MARK_FOLLOWING>
\r
460 <MARK_FOLLOWING TYPE="NULL">#$</MARK_FOLLOWING>
\r