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: class Text_Highlighter_JAVASCRIPT extends Text_Highlighter
35: {
36: var $_language = 'javascript';
37:
38: 39: 40: 41: 42: 43:
44: function __construct($options=array())
45: {
46:
47: $this->_options = $options;
48: $this->_regs = array (
49: -1 => '/((?i)\\{)|((?i)\\()|((?i)\\[)|((?i)\\/\\*)|((?i)")|((?i)\')|((?i)\\/\\/)|((?i)[a-z_]\\w*)|((?i)0x\\d*|\\d*\\.?\\d+)/',
50: 0 => '/((?i)\\{)|((?i)\\()|((?i)\\[)|((?i)\\/\\*)|((?i)")|((?i)\')|((?i)\\/\\/)|((?i)[a-z_]\\w*)|((?i)0x\\d*|\\d*\\.?\\d+)/',
51: 1 => '/((?i)\\{)|((?i)\\()|((?i)\\[)|((?i)\\/\\*)|((?i)")|((?i)\')|((?i)\\/\\/)|((?i)[a-z_]\\w*)|((?i)0x\\d*|\\d*\\.?\\d+)/',
52: 2 => '/((?i)\\{)|((?i)\\()|((?i)\\[)|((?i)\\/\\*)|((?i)")|((?i)\')|((?i)\\/\\/)|((?i)[a-z_]\\w*)|((?i)0x\\d*|\\d*\\.?\\d+)/',
53: 3 => '/((?i)((https?|ftp):\\/\\/[\\w\\?\\.\\-\\&=\\/%+]+)|(^|[\\s,!?])www\\.\\w+\\.\\w+[\\w\\?\\.\\&=\\/%+]*)|((?i)\\w+[\\.\\w\\-]+@(\\w+[\\.\\w\\-])+)|((?i)\\b(note|fixme):)|((?i)\\$\\w+:.+\\$)/',
54: 4 => '/((?i)\\\\\\\\|\\\\"|\\\\\'|\\\\`|\\\\t|\\\\n|\\\\r)/',
55: 5 => '/((?i)\\\\\\\\|\\\\"|\\\\\'|\\\\`)/',
56: 6 => '/((?i)((https?|ftp):\\/\\/[\\w\\?\\.\\-\\&=\\/%+]+)|(^|[\\s,!?])www\\.\\w+\\.\\w+[\\w\\?\\.\\&=\\/%+]*)|((?i)\\w+[\\.\\w\\-]+@(\\w+[\\.\\w\\-])+)|((?i)\\b(note|fixme):)|((?i)\\$\\w+:.+\\$)/',
57: );
58: $this->_counts = array (
59: -1 =>
60: array (
61: 0 => 0,
62: 1 => 0,
63: 2 => 0,
64: 3 => 0,
65: 4 => 0,
66: 5 => 0,
67: 6 => 0,
68: 7 => 0,
69: 8 => 0,
70: ),
71: 0 =>
72: array (
73: 0 => 0,
74: 1 => 0,
75: 2 => 0,
76: 3 => 0,
77: 4 => 0,
78: 5 => 0,
79: 6 => 0,
80: 7 => 0,
81: 8 => 0,
82: ),
83: 1 =>
84: array (
85: 0 => 0,
86: 1 => 0,
87: 2 => 0,
88: 3 => 0,
89: 4 => 0,
90: 5 => 0,
91: 6 => 0,
92: 7 => 0,
93: 8 => 0,
94: ),
95: 2 =>
96: array (
97: 0 => 0,
98: 1 => 0,
99: 2 => 0,
100: 3 => 0,
101: 4 => 0,
102: 5 => 0,
103: 6 => 0,
104: 7 => 0,
105: 8 => 0,
106: ),
107: 3 =>
108: array (
109: 0 => 3,
110: 1 => 1,
111: 2 => 1,
112: 3 => 0,
113: ),
114: 4 =>
115: array (
116: 0 => 0,
117: ),
118: 5 =>
119: array (
120: 0 => 0,
121: ),
122: 6 =>
123: array (
124: 0 => 3,
125: 1 => 1,
126: 2 => 1,
127: 3 => 0,
128: ),
129: );
130: $this->_delim = array (
131: -1 =>
132: array (
133: 0 => 'brackets',
134: 1 => 'brackets',
135: 2 => 'brackets',
136: 3 => 'comment',
137: 4 => 'quotes',
138: 5 => 'quotes',
139: 6 => 'comment',
140: 7 => '',
141: 8 => '',
142: ),
143: 0 =>
144: array (
145: 0 => 'brackets',
146: 1 => 'brackets',
147: 2 => 'brackets',
148: 3 => 'comment',
149: 4 => 'quotes',
150: 5 => 'quotes',
151: 6 => 'comment',
152: 7 => '',
153: 8 => '',
154: ),
155: 1 =>
156: array (
157: 0 => 'brackets',
158: 1 => 'brackets',
159: 2 => 'brackets',
160: 3 => 'comment',
161: 4 => 'quotes',
162: 5 => 'quotes',
163: 6 => 'comment',
164: 7 => '',
165: 8 => '',
166: ),
167: 2 =>
168: array (
169: 0 => 'brackets',
170: 1 => 'brackets',
171: 2 => 'brackets',
172: 3 => 'comment',
173: 4 => 'quotes',
174: 5 => 'quotes',
175: 6 => 'comment',
176: 7 => '',
177: 8 => '',
178: ),
179: 3 =>
180: array (
181: 0 => '',
182: 1 => '',
183: 2 => '',
184: 3 => '',
185: ),
186: 4 =>
187: array (
188: 0 => '',
189: ),
190: 5 =>
191: array (
192: 0 => '',
193: ),
194: 6 =>
195: array (
196: 0 => '',
197: 1 => '',
198: 2 => '',
199: 3 => '',
200: ),
201: );
202: $this->_inner = array (
203: -1 =>
204: array (
205: 0 => 'code',
206: 1 => 'code',
207: 2 => 'code',
208: 3 => 'comment',
209: 4 => 'string',
210: 5 => 'string',
211: 6 => 'comment',
212: 7 => 'identifier',
213: 8 => 'number',
214: ),
215: 0 =>
216: array (
217: 0 => 'code',
218: 1 => 'code',
219: 2 => 'code',
220: 3 => 'comment',
221: 4 => 'string',
222: 5 => 'string',
223: 6 => 'comment',
224: 7 => 'identifier',
225: 8 => 'number',
226: ),
227: 1 =>
228: array (
229: 0 => 'code',
230: 1 => 'code',
231: 2 => 'code',
232: 3 => 'comment',
233: 4 => 'string',
234: 5 => 'string',
235: 6 => 'comment',
236: 7 => 'identifier',
237: 8 => 'number',
238: ),
239: 2 =>
240: array (
241: 0 => 'code',
242: 1 => 'code',
243: 2 => 'code',
244: 3 => 'comment',
245: 4 => 'string',
246: 5 => 'string',
247: 6 => 'comment',
248: 7 => 'identifier',
249: 8 => 'number',
250: ),
251: 3 =>
252: array (
253: 0 => 'url',
254: 1 => 'url',
255: 2 => 'inlinedoc',
256: 3 => 'inlinedoc',
257: ),
258: 4 =>
259: array (
260: 0 => 'special',
261: ),
262: 5 =>
263: array (
264: 0 => 'special',
265: ),
266: 6 =>
267: array (
268: 0 => 'url',
269: 1 => 'url',
270: 2 => 'inlinedoc',
271: 3 => 'inlinedoc',
272: ),
273: );
274: $this->_end = array (
275: 0 => '/(?i)\\}/',
276: 1 => '/(?i)\\)/',
277: 2 => '/(?i)\\]/',
278: 3 => '/(?i)\\*\\//',
279: 4 => '/(?i)"/',
280: 5 => '/(?i)\'/',
281: 6 => '/(?mi)$/',
282: );
283: $this->_states = array (
284: -1 =>
285: array (
286: 0 => 0,
287: 1 => 1,
288: 2 => 2,
289: 3 => 3,
290: 4 => 4,
291: 5 => 5,
292: 6 => 6,
293: 7 => -1,
294: 8 => -1,
295: ),
296: 0 =>
297: array (
298: 0 => 0,
299: 1 => 1,
300: 2 => 2,
301: 3 => 3,
302: 4 => 4,
303: 5 => 5,
304: 6 => 6,
305: 7 => -1,
306: 8 => -1,
307: ),
308: 1 =>
309: array (
310: 0 => 0,
311: 1 => 1,
312: 2 => 2,
313: 3 => 3,
314: 4 => 4,
315: 5 => 5,
316: 6 => 6,
317: 7 => -1,
318: 8 => -1,
319: ),
320: 2 =>
321: array (
322: 0 => 0,
323: 1 => 1,
324: 2 => 2,
325: 3 => 3,
326: 4 => 4,
327: 5 => 5,
328: 6 => 6,
329: 7 => -1,
330: 8 => -1,
331: ),
332: 3 =>
333: array (
334: 0 => -1,
335: 1 => -1,
336: 2 => -1,
337: 3 => -1,
338: ),
339: 4 =>
340: array (
341: 0 => -1,
342: ),
343: 5 =>
344: array (
345: 0 => -1,
346: ),
347: 6 =>
348: array (
349: 0 => -1,
350: 1 => -1,
351: 2 => -1,
352: 3 => -1,
353: ),
354: );
355: $this->_keywords = array (
356: -1 =>
357: array (
358: 0 => -1,
359: 1 => -1,
360: 2 => -1,
361: 3 => -1,
362: 4 => -1,
363: 5 => -1,
364: 6 => -1,
365: 7 =>
366: array (
367: 'builtin' => '/^(String|Array|RegExp|Function|Math|Number|Date|Image|window|document|navigator|onAbort|onBlur|onChange|onClick|onDblClick|onDragDrop|onError|onFocus|onKeyDown|onKeyPress|onKeyUp|onLoad|onMouseDown|onMouseOver|onMouseOut|onMouseMove|onMouseUp|onMove|onReset|onResize|onSelect|onSubmit|onUnload)$/',
368: 'reserved' => '/^(break|continue|do|while|export|for|in|if|else|import|return|label|switch|case|var|with|delete|new|this|typeof|void|abstract|boolean|byte|catch|char|class|const|debugger|default|double|enum|extends|false|final|finally|float|function|implements|goto|instanceof|int|interface|long|native|null|package|private|protected|public|short|static|super|synchronized|throw|throws|transient|true|try|volatile)$/',
369: ),
370: 8 =>
371: array (
372: ),
373: ),
374: 0 =>
375: array (
376: 0 => -1,
377: 1 => -1,
378: 2 => -1,
379: 3 => -1,
380: 4 => -1,
381: 5 => -1,
382: 6 => -1,
383: 7 =>
384: array (
385: 'builtin' => '/^(String|Array|RegExp|Function|Math|Number|Date|Image|window|document|navigator|onAbort|onBlur|onChange|onClick|onDblClick|onDragDrop|onError|onFocus|onKeyDown|onKeyPress|onKeyUp|onLoad|onMouseDown|onMouseOver|onMouseOut|onMouseMove|onMouseUp|onMove|onReset|onResize|onSelect|onSubmit|onUnload)$/',
386: 'reserved' => '/^(break|continue|do|while|export|for|in|if|else|import|return|label|switch|case|var|with|delete|new|this|typeof|void|abstract|boolean|byte|catch|char|class|const|debugger|default|double|enum|extends|false|final|finally|float|function|implements|goto|instanceof|int|interface|long|native|null|package|private|protected|public|short|static|super|synchronized|throw|throws|transient|true|try|volatile)$/',
387: ),
388: 8 =>
389: array (
390: ),
391: ),
392: 1 =>
393: array (
394: 0 => -1,
395: 1 => -1,
396: 2 => -1,
397: 3 => -1,
398: 4 => -1,
399: 5 => -1,
400: 6 => -1,
401: 7 =>
402: array (
403: 'builtin' => '/^(String|Array|RegExp|Function|Math|Number|Date|Image|window|document|navigator|onAbort|onBlur|onChange|onClick|onDblClick|onDragDrop|onError|onFocus|onKeyDown|onKeyPress|onKeyUp|onLoad|onMouseDown|onMouseOver|onMouseOut|onMouseMove|onMouseUp|onMove|onReset|onResize|onSelect|onSubmit|onUnload)$/',
404: 'reserved' => '/^(break|continue|do|while|export|for|in|if|else|import|return|label|switch|case|var|with|delete|new|this|typeof|void|abstract|boolean|byte|catch|char|class|const|debugger|default|double|enum|extends|false|final|finally|float|function|implements|goto|instanceof|int|interface|long|native|null|package|private|protected|public|short|static|super|synchronized|throw|throws|transient|true|try|volatile)$/',
405: ),
406: 8 =>
407: array (
408: ),
409: ),
410: 2 =>
411: array (
412: 0 => -1,
413: 1 => -1,
414: 2 => -1,
415: 3 => -1,
416: 4 => -1,
417: 5 => -1,
418: 6 => -1,
419: 7 =>
420: array (
421: 'builtin' => '/^(String|Array|RegExp|Function|Math|Number|Date|Image|window|document|navigator|onAbort|onBlur|onChange|onClick|onDblClick|onDragDrop|onError|onFocus|onKeyDown|onKeyPress|onKeyUp|onLoad|onMouseDown|onMouseOver|onMouseOut|onMouseMove|onMouseUp|onMove|onReset|onResize|onSelect|onSubmit|onUnload)$/',
422: 'reserved' => '/^(break|continue|do|while|export|for|in|if|else|import|return|label|switch|case|var|with|delete|new|this|typeof|void|abstract|boolean|byte|catch|char|class|const|debugger|default|double|enum|extends|false|final|finally|float|function|implements|goto|instanceof|int|interface|long|native|null|package|private|protected|public|short|static|super|synchronized|throw|throws|transient|true|try|volatile)$/',
423: ),
424: 8 =>
425: array (
426: ),
427: ),
428: 3 =>
429: array (
430: 0 =>
431: array (
432: ),
433: 1 =>
434: array (
435: ),
436: 2 =>
437: array (
438: ),
439: 3 =>
440: array (
441: ),
442: ),
443: 4 =>
444: array (
445: 0 =>
446: array (
447: ),
448: ),
449: 5 =>
450: array (
451: 0 =>
452: array (
453: ),
454: ),
455: 6 =>
456: array (
457: 0 =>
458: array (
459: ),
460: 1 =>
461: array (
462: ),
463: 2 =>
464: array (
465: ),
466: 3 =>
467: array (
468: ),
469: ),
470: );
471: $this->_parts = array (
472: 0 =>
473: array (
474: 0 => NULL,
475: 1 => NULL,
476: 2 => NULL,
477: 3 => NULL,
478: 4 => NULL,
479: 5 => NULL,
480: 6 => NULL,
481: 7 => NULL,
482: 8 => NULL,
483: ),
484: 1 =>
485: array (
486: 0 => NULL,
487: 1 => NULL,
488: 2 => NULL,
489: 3 => NULL,
490: 4 => NULL,
491: 5 => NULL,
492: 6 => NULL,
493: 7 => NULL,
494: 8 => NULL,
495: ),
496: 2 =>
497: array (
498: 0 => NULL,
499: 1 => NULL,
500: 2 => NULL,
501: 3 => NULL,
502: 4 => NULL,
503: 5 => NULL,
504: 6 => NULL,
505: 7 => NULL,
506: 8 => NULL,
507: ),
508: 3 =>
509: array (
510: 0 => NULL,
511: 1 => NULL,
512: 2 => NULL,
513: 3 => NULL,
514: ),
515: 4 =>
516: array (
517: 0 => NULL,
518: ),
519: 5 =>
520: array (
521: 0 => NULL,
522: ),
523: 6 =>
524: array (
525: 0 => NULL,
526: 1 => NULL,
527: 2 => NULL,
528: 3 => NULL,
529: ),
530: );
531: $this->_subst = array (
532: -1 =>
533: array (
534: 0 => false,
535: 1 => false,
536: 2 => false,
537: 3 => false,
538: 4 => false,
539: 5 => false,
540: 6 => false,
541: 7 => false,
542: 8 => false,
543: ),
544: 0 =>
545: array (
546: 0 => false,
547: 1 => false,
548: 2 => false,
549: 3 => false,
550: 4 => false,
551: 5 => false,
552: 6 => false,
553: 7 => false,
554: 8 => false,
555: ),
556: 1 =>
557: array (
558: 0 => false,
559: 1 => false,
560: 2 => false,
561: 3 => false,
562: 4 => false,
563: 5 => false,
564: 6 => false,
565: 7 => false,
566: 8 => false,
567: ),
568: 2 =>
569: array (
570: 0 => false,
571: 1 => false,
572: 2 => false,
573: 3 => false,
574: 4 => false,
575: 5 => false,
576: 6 => false,
577: 7 => false,
578: 8 => false,
579: ),
580: 3 =>
581: array (
582: 0 => false,
583: 1 => false,
584: 2 => false,
585: 3 => false,
586: ),
587: 4 =>
588: array (
589: 0 => false,
590: ),
591: 5 =>
592: array (
593: 0 => false,
594: ),
595: 6 =>
596: array (
597: 0 => false,
598: 1 => false,
599: 2 => false,
600: 3 => false,
601: ),
602: );
603: $this->_conditions = array (
604: );
605: $this->_kwmap = array (
606: 'builtin' => 'builtin',
607: 'reserved' => 'reserved',
608: );
609: $this->_defClass = 'code';
610: $this->_checkDefines();
611: }
612:
613: }