1: <?php
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: class Text_Highlighter_RUBY extends Text_Highlighter
44: {
45: var $_language = 'ruby';
46:
47: 48: 49: 50: 51: 52:
53: function __construct($options=array())
54: {
55:
56: $this->_options = $options;
57: $this->_regs = array (
58: -1 => '/((?mi)^__END__$)|((?i)")|((?i)%[Qx]([!"#\\$%&\'+\\-*.\\/:;=?@^`|~{<\\[(]))|((?i)\')|((?i)%[wq]([!"#\\$%&\'+\\-*.\\/:;=?@^`|~{<\\[(]))|((?i)\\$(\\W|\\w+))|((?ii)@@?[_a-z][\\d_a-z]*)|((?i)\\()|((?i)\\[)|((?i)[a-z_]\\w*)|((?i)((\\d+|((\\d*\\.\\d+)|(\\d+\\.\\d*)))[eE][+-]?\\d+))|((?i)(\\d*\\.\\d+)|(\\d+\\.\\d*))|((?i)0[xX][\\da-f]+l?)|((?i)\\d+l?|\\b0l?\\b)|((?i)0[0-7]+l?)|((?mi)^=begin$)|((?i)#)|((?i)\\s*\\/)/',
59: 0 => '//',
60: 1 => '/((?i)\\\\.)/',
61: 2 => '/((?i)\\\\.)/',
62: 3 => '/((?i)\\\\.)/',
63: 4 => '/((?i)\\\\.)/',
64: 5 => '/((?mi)^__END__$)|((?i)")|((?i)%[Qx]([!"#\\$%&\'+\\-*.\\/:;=?@^`|~{<\\[(]))|((?i)\')|((?i)%[wq]([!"#\\$%&\'+\\-*.\\/:;=?@^`|~{<\\[(]))|((?i)\\$(\\W|\\w+))|((?ii)@@?[_a-z][\\d_a-z]*)|((?i)\\()|((?i)\\[)|((?i)[a-z_]\\w*)|((?i)((\\d+|((\\d*\\.\\d+)|(\\d+\\.\\d*)))[eE][+-]?\\d+))|((?i)(\\d*\\.\\d+)|(\\d+\\.\\d*))|((?i)0[xX][\\da-f]+l?)|((?i)\\d+l?|\\b0l?\\b)|((?i)0[0-7]+l?)|((?mi)^=begin$)|((?i)#)|((?i)\\s*\\/)/',
65: 6 => '/((?mi)^__END__$)|((?i)")|((?i)%[Qx]([!"#\\$%&\'+\\-*.\\/:;=?@^`|~{<\\[(]))|((?i)\')|((?i)%[wq]([!"#\\$%&\'+\\-*.\\/:;=?@^`|~{<\\[(]))|((?i)\\$(\\W|\\w+))|((?ii)@@?[_a-z][\\d_a-z]*)|((?i)\\()|((?i)\\[)|((?i)[a-z_]\\w*)|((?i)((\\d+|((\\d*\\.\\d+)|(\\d+\\.\\d*)))[eE][+-]?\\d+))|((?i)(\\d*\\.\\d+)|(\\d+\\.\\d*))|((?i)0[xX][\\da-f]+l?)|((?i)\\d+l?|\\b0l?\\b)|((?i)0[0-7]+l?)|((?mi)^=begin$)|((?i)#)|((?i)\\s*\\/)/',
66: 7 => '/((?i)\\$\\w+\\s*:.+\\$)/',
67: 8 => '/((?i)\\$\\w+\\s*:.+\\$)/',
68: 9 => '/((?i)\\\\.)/',
69: );
70: $this->_counts = array (
71: -1 =>
72: array (
73: 0 => 0,
74: 1 => 0,
75: 2 => 1,
76: 3 => 0,
77: 4 => 1,
78: 5 => 1,
79: 6 => 0,
80: 7 => 0,
81: 8 => 0,
82: 9 => 0,
83: 10 => 5,
84: 11 => 2,
85: 12 => 0,
86: 13 => 0,
87: 14 => 0,
88: 15 => 0,
89: 16 => 0,
90: 17 => 0,
91: ),
92: 0 =>
93: array (
94: ),
95: 1 =>
96: array (
97: 0 => 0,
98: ),
99: 2 =>
100: array (
101: 0 => 0,
102: ),
103: 3 =>
104: array (
105: 0 => 0,
106: ),
107: 4 =>
108: array (
109: 0 => 0,
110: ),
111: 5 =>
112: array (
113: 0 => 0,
114: 1 => 0,
115: 2 => 1,
116: 3 => 0,
117: 4 => 1,
118: 5 => 1,
119: 6 => 0,
120: 7 => 0,
121: 8 => 0,
122: 9 => 0,
123: 10 => 5,
124: 11 => 2,
125: 12 => 0,
126: 13 => 0,
127: 14 => 0,
128: 15 => 0,
129: 16 => 0,
130: 17 => 0,
131: ),
132: 6 =>
133: array (
134: 0 => 0,
135: 1 => 0,
136: 2 => 1,
137: 3 => 0,
138: 4 => 1,
139: 5 => 1,
140: 6 => 0,
141: 7 => 0,
142: 8 => 0,
143: 9 => 0,
144: 10 => 5,
145: 11 => 2,
146: 12 => 0,
147: 13 => 0,
148: 14 => 0,
149: 15 => 0,
150: 16 => 0,
151: 17 => 0,
152: ),
153: 7 =>
154: array (
155: 0 => 0,
156: ),
157: 8 =>
158: array (
159: 0 => 0,
160: ),
161: 9 =>
162: array (
163: 0 => 0,
164: ),
165: );
166: $this->_delim = array (
167: -1 =>
168: array (
169: 0 => 'reserved',
170: 1 => 'quotes',
171: 2 => 'quotes',
172: 3 => 'quotes',
173: 4 => 'quotes',
174: 5 => '',
175: 6 => '',
176: 7 => 'brackets',
177: 8 => 'brackets',
178: 9 => '',
179: 10 => '',
180: 11 => '',
181: 12 => '',
182: 13 => '',
183: 14 => '',
184: 15 => 'comment',
185: 16 => 'comment',
186: 17 => 'quotes',
187: ),
188: 0 =>
189: array (
190: ),
191: 1 =>
192: array (
193: 0 => '',
194: ),
195: 2 =>
196: array (
197: 0 => '',
198: ),
199: 3 =>
200: array (
201: 0 => '',
202: ),
203: 4 =>
204: array (
205: 0 => '',
206: ),
207: 5 =>
208: array (
209: 0 => 'reserved',
210: 1 => 'quotes',
211: 2 => 'quotes',
212: 3 => 'quotes',
213: 4 => 'quotes',
214: 5 => '',
215: 6 => '',
216: 7 => 'brackets',
217: 8 => 'brackets',
218: 9 => '',
219: 10 => '',
220: 11 => '',
221: 12 => '',
222: 13 => '',
223: 14 => '',
224: 15 => 'comment',
225: 16 => 'comment',
226: 17 => 'quotes',
227: ),
228: 6 =>
229: array (
230: 0 => 'reserved',
231: 1 => 'quotes',
232: 2 => 'quotes',
233: 3 => 'quotes',
234: 4 => 'quotes',
235: 5 => '',
236: 6 => '',
237: 7 => 'brackets',
238: 8 => 'brackets',
239: 9 => '',
240: 10 => '',
241: 11 => '',
242: 12 => '',
243: 13 => '',
244: 14 => '',
245: 15 => 'comment',
246: 16 => 'comment',
247: 17 => 'quotes',
248: ),
249: 7 =>
250: array (
251: 0 => '',
252: ),
253: 8 =>
254: array (
255: 0 => '',
256: ),
257: 9 =>
258: array (
259: 0 => '',
260: ),
261: );
262: $this->_inner = array (
263: -1 =>
264: array (
265: 0 => 'comment',
266: 1 => 'string',
267: 2 => 'string',
268: 3 => 'string',
269: 4 => 'string',
270: 5 => 'var',
271: 6 => 'var',
272: 7 => 'code',
273: 8 => 'code',
274: 9 => 'identifier',
275: 10 => 'number',
276: 11 => 'number',
277: 12 => 'number',
278: 13 => 'number',
279: 14 => 'number',
280: 15 => 'comment',
281: 16 => 'comment',
282: 17 => 'string',
283: ),
284: 0 =>
285: array (
286: ),
287: 1 =>
288: array (
289: 0 => 'special',
290: ),
291: 2 =>
292: array (
293: 0 => 'special',
294: ),
295: 3 =>
296: array (
297: 0 => 'special',
298: ),
299: 4 =>
300: array (
301: 0 => 'special',
302: ),
303: 5 =>
304: array (
305: 0 => 'comment',
306: 1 => 'string',
307: 2 => 'string',
308: 3 => 'string',
309: 4 => 'string',
310: 5 => 'var',
311: 6 => 'var',
312: 7 => 'code',
313: 8 => 'code',
314: 9 => 'identifier',
315: 10 => 'number',
316: 11 => 'number',
317: 12 => 'number',
318: 13 => 'number',
319: 14 => 'number',
320: 15 => 'comment',
321: 16 => 'comment',
322: 17 => 'string',
323: ),
324: 6 =>
325: array (
326: 0 => 'comment',
327: 1 => 'string',
328: 2 => 'string',
329: 3 => 'string',
330: 4 => 'string',
331: 5 => 'var',
332: 6 => 'var',
333: 7 => 'code',
334: 8 => 'code',
335: 9 => 'identifier',
336: 10 => 'number',
337: 11 => 'number',
338: 12 => 'number',
339: 13 => 'number',
340: 14 => 'number',
341: 15 => 'comment',
342: 16 => 'comment',
343: 17 => 'string',
344: ),
345: 7 =>
346: array (
347: 0 => 'inlinedoc',
348: ),
349: 8 =>
350: array (
351: 0 => 'inlinedoc',
352: ),
353: 9 =>
354: array (
355: 0 => 'special',
356: ),
357: );
358: $this->_end = array (
359: 0 => '/(?i)$/',
360: 1 => '/(?i)"/',
361: 2 => '/(?i)%b1%/',
362: 3 => '/(?i)\'/',
363: 4 => '/(?i)%b1%/',
364: 5 => '/(?i)\\)/',
365: 6 => '/(?i)\\]/',
366: 7 => '/(?mi)^=end$/',
367: 8 => '/(?mi)$/',
368: 9 => '/(?i)\\/[iomx]*/',
369: );
370: $this->_states = array (
371: -1 =>
372: array (
373: 0 => 0,
374: 1 => 1,
375: 2 => 2,
376: 3 => 3,
377: 4 => 4,
378: 5 => -1,
379: 6 => -1,
380: 7 => 5,
381: 8 => 6,
382: 9 => -1,
383: 10 => -1,
384: 11 => -1,
385: 12 => -1,
386: 13 => -1,
387: 14 => -1,
388: 15 => 7,
389: 16 => 8,
390: 17 => 9,
391: ),
392: 0 =>
393: array (
394: ),
395: 1 =>
396: array (
397: 0 => -1,
398: ),
399: 2 =>
400: array (
401: 0 => -1,
402: ),
403: 3 =>
404: array (
405: 0 => -1,
406: ),
407: 4 =>
408: array (
409: 0 => -1,
410: ),
411: 5 =>
412: array (
413: 0 => 0,
414: 1 => 1,
415: 2 => 2,
416: 3 => 3,
417: 4 => 4,
418: 5 => -1,
419: 6 => -1,
420: 7 => 5,
421: 8 => 6,
422: 9 => -1,
423: 10 => -1,
424: 11 => -1,
425: 12 => -1,
426: 13 => -1,
427: 14 => -1,
428: 15 => 7,
429: 16 => 8,
430: 17 => 9,
431: ),
432: 6 =>
433: array (
434: 0 => 0,
435: 1 => 1,
436: 2 => 2,
437: 3 => 3,
438: 4 => 4,
439: 5 => -1,
440: 6 => -1,
441: 7 => 5,
442: 8 => 6,
443: 9 => -1,
444: 10 => -1,
445: 11 => -1,
446: 12 => -1,
447: 13 => -1,
448: 14 => -1,
449: 15 => 7,
450: 16 => 8,
451: 17 => 9,
452: ),
453: 7 =>
454: array (
455: 0 => -1,
456: ),
457: 8 =>
458: array (
459: 0 => -1,
460: ),
461: 9 =>
462: array (
463: 0 => -1,
464: ),
465: );
466: $this->_keywords = array (
467: -1 =>
468: array (
469: 0 => -1,
470: 1 => -1,
471: 2 => -1,
472: 3 => -1,
473: 4 => -1,
474: 5 =>
475: array (
476: ),
477: 6 =>
478: array (
479: ),
480: 7 => -1,
481: 8 => -1,
482: 9 =>
483: array (
484: 'reserved' => '/^(__FILE__|require|and|def|end|in|or|self|unless|__LINE__|begin|defined?|ensure|module|redo|super|until|BEGIN|break|do|false|next|rescue|then|when|END|case|else|for|nil|retry|true|while|alias|module_function|private|public|protected|attr_reader|attr_writer|attr_accessor|class|elsif|if|not|return|undef|yield)$/',
485: ),
486: 10 =>
487: array (
488: ),
489: 11 =>
490: array (
491: ),
492: 12 =>
493: array (
494: ),
495: 13 =>
496: array (
497: ),
498: 14 =>
499: array (
500: ),
501: 15 => -1,
502: 16 => -1,
503: 17 => -1,
504: ),
505: 0 =>
506: array (
507: ),
508: 1 =>
509: array (
510: 0 =>
511: array (
512: ),
513: ),
514: 2 =>
515: array (
516: 0 =>
517: array (
518: ),
519: ),
520: 3 =>
521: array (
522: 0 =>
523: array (
524: ),
525: ),
526: 4 =>
527: array (
528: 0 =>
529: array (
530: ),
531: ),
532: 5 =>
533: array (
534: 0 => -1,
535: 1 => -1,
536: 2 => -1,
537: 3 => -1,
538: 4 => -1,
539: 5 =>
540: array (
541: ),
542: 6 =>
543: array (
544: ),
545: 7 => -1,
546: 8 => -1,
547: 9 =>
548: array (
549: 'reserved' => '/^(__FILE__|require|and|def|end|in|or|self|unless|__LINE__|begin|defined?|ensure|module|redo|super|until|BEGIN|break|do|false|next|rescue|then|when|END|case|else|for|nil|retry|true|while|alias|module_function|private|public|protected|attr_reader|attr_writer|attr_accessor|class|elsif|if|not|return|undef|yield)$/',
550: ),
551: 10 =>
552: array (
553: ),
554: 11 =>
555: array (
556: ),
557: 12 =>
558: array (
559: ),
560: 13 =>
561: array (
562: ),
563: 14 =>
564: array (
565: ),
566: 15 => -1,
567: 16 => -1,
568: 17 => -1,
569: ),
570: 6 =>
571: array (
572: 0 => -1,
573: 1 => -1,
574: 2 => -1,
575: 3 => -1,
576: 4 => -1,
577: 5 =>
578: array (
579: ),
580: 6 =>
581: array (
582: ),
583: 7 => -1,
584: 8 => -1,
585: 9 =>
586: array (
587: 'reserved' => '/^(__FILE__|require|and|def|end|in|or|self|unless|__LINE__|begin|defined?|ensure|module|redo|super|until|BEGIN|break|do|false|next|rescue|then|when|END|case|else|for|nil|retry|true|while|alias|module_function|private|public|protected|attr_reader|attr_writer|attr_accessor|class|elsif|if|not|return|undef|yield)$/',
588: ),
589: 10 =>
590: array (
591: ),
592: 11 =>
593: array (
594: ),
595: 12 =>
596: array (
597: ),
598: 13 =>
599: array (
600: ),
601: 14 =>
602: array (
603: ),
604: 15 => -1,
605: 16 => -1,
606: 17 => -1,
607: ),
608: 7 =>
609: array (
610: 0 =>
611: array (
612: ),
613: ),
614: 8 =>
615: array (
616: 0 =>
617: array (
618: ),
619: ),
620: 9 =>
621: array (
622: 0 =>
623: array (
624: ),
625: ),
626: );
627: $this->_parts = array (
628: 0 =>
629: array (
630: ),
631: 1 =>
632: array (
633: 0 => NULL,
634: ),
635: 2 =>
636: array (
637: 0 => NULL,
638: ),
639: 3 =>
640: array (
641: 0 => NULL,
642: ),
643: 4 =>
644: array (
645: 0 => NULL,
646: ),
647: 5 =>
648: array (
649: 0 => NULL,
650: 1 => NULL,
651: 2 => NULL,
652: 3 => NULL,
653: 4 => NULL,
654: 5 => NULL,
655: 6 => NULL,
656: 7 => NULL,
657: 8 => NULL,
658: 9 => NULL,
659: 10 => NULL,
660: 11 => NULL,
661: 12 => NULL,
662: 13 => NULL,
663: 14 => NULL,
664: 15 => NULL,
665: 16 => NULL,
666: 17 => NULL,
667: ),
668: 6 =>
669: array (
670: 0 => NULL,
671: 1 => NULL,
672: 2 => NULL,
673: 3 => NULL,
674: 4 => NULL,
675: 5 => NULL,
676: 6 => NULL,
677: 7 => NULL,
678: 8 => NULL,
679: 9 => NULL,
680: 10 => NULL,
681: 11 => NULL,
682: 12 => NULL,
683: 13 => NULL,
684: 14 => NULL,
685: 15 => NULL,
686: 16 => NULL,
687: 17 => NULL,
688: ),
689: 7 =>
690: array (
691: 0 => NULL,
692: ),
693: 8 =>
694: array (
695: 0 => NULL,
696: ),
697: 9 =>
698: array (
699: 0 => NULL,
700: ),
701: );
702: $this->_subst = array (
703: -1 =>
704: array (
705: 0 => false,
706: 1 => false,
707: 2 => true,
708: 3 => false,
709: 4 => true,
710: 5 => false,
711: 6 => false,
712: 7 => false,
713: 8 => false,
714: 9 => false,
715: 10 => false,
716: 11 => false,
717: 12 => false,
718: 13 => false,
719: 14 => false,
720: 15 => false,
721: 16 => false,
722: 17 => false,
723: ),
724: 0 =>
725: array (
726: ),
727: 1 =>
728: array (
729: 0 => false,
730: ),
731: 2 =>
732: array (
733: 0 => false,
734: ),
735: 3 =>
736: array (
737: 0 => false,
738: ),
739: 4 =>
740: array (
741: 0 => false,
742: ),
743: 5 =>
744: array (
745: 0 => false,
746: 1 => false,
747: 2 => true,
748: 3 => false,
749: 4 => true,
750: 5 => false,
751: 6 => false,
752: 7 => false,
753: 8 => false,
754: 9 => false,
755: 10 => false,
756: 11 => false,
757: 12 => false,
758: 13 => false,
759: 14 => false,
760: 15 => false,
761: 16 => false,
762: 17 => false,
763: ),
764: 6 =>
765: array (
766: 0 => false,
767: 1 => false,
768: 2 => true,
769: 3 => false,
770: 4 => true,
771: 5 => false,
772: 6 => false,
773: 7 => false,
774: 8 => false,
775: 9 => false,
776: 10 => false,
777: 11 => false,
778: 12 => false,
779: 13 => false,
780: 14 => false,
781: 15 => false,
782: 16 => false,
783: 17 => false,
784: ),
785: 7 =>
786: array (
787: 0 => false,
788: ),
789: 8 =>
790: array (
791: 0 => false,
792: ),
793: 9 =>
794: array (
795: 0 => false,
796: ),
797: );
798: $this->_conditions = array (
799: );
800: $this->_kwmap = array (
801: 'reserved' => 'reserved',
802: );
803: $this->_defClass = 'code';
804: $this->_checkDefines();
805: }
806:
807: }