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_CSS extends Text_Highlighter
35: {
36: var $_language = 'css';
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)(@[a-z\\d]+))|((?i)(((\\.|#)?[a-z]+[a-z\\d\\-]*(?![a-z\\d\\-]))|(\\*))(?!\\s*:\\s*[\\s\\{]))|((?i):[a-z][a-z\\d\\-]*)|((?i)\\[)|((?i)\\{)/',
50: 0 => '//',
51: 1 => '/((?i)\\d*\\.?\\d+(\\%|em|ex|pc|pt|px|in|mm|cm))|((?i)\\d*\\.?\\d+)|((?i)[a-z][a-z\\d\\-]*)|((?i)#([\\da-f]{6}|[\\da-f]{3})\\b)/',
52: 2 => '/((?i)\')|((?i)")|((?i)[\\w\\-\\:]+)/',
53: 3 => '/((?i)\\/\\*)|((?i)[a-z][a-z\\d\\-]*\\s*:)|((?i)(((\\.|#)?[a-z]+[a-z\\d\\-]*(?![a-z\\d\\-]))|(\\*))(?!\\s*:\\s*[\\s\\{]))|((?i)\\{)/',
54: 4 => '/((?i)\\\\[\\\\(\\\\)\\\\])/',
55: 5 => '/((?i)\\\\\\\\|\\\\"|\\\\\'|\\\\`)/',
56: 6 => '/((?i)\\\\\\\\|\\\\"|\\\\\'|\\\\`|\\\\t|\\\\n|\\\\r)/',
57: );
58: $this->_counts = array (
59: -1 =>
60: array (
61: 0 => 0,
62: 1 => 1,
63: 2 => 4,
64: 3 => 0,
65: 4 => 0,
66: 5 => 0,
67: ),
68: 0 =>
69: array (
70: ),
71: 1 =>
72: array (
73: 0 => 1,
74: 1 => 0,
75: 2 => 0,
76: 3 => 1,
77: ),
78: 2 =>
79: array (
80: 0 => 0,
81: 1 => 0,
82: 2 => 0,
83: ),
84: 3 =>
85: array (
86: 0 => 0,
87: 1 => 0,
88: 2 => 4,
89: 3 => 0,
90: ),
91: 4 =>
92: array (
93: 0 => 0,
94: ),
95: 5 =>
96: array (
97: 0 => 0,
98: ),
99: 6 =>
100: array (
101: 0 => 0,
102: ),
103: );
104: $this->_delim = array (
105: -1 =>
106: array (
107: 0 => 'comment',
108: 1 => '',
109: 2 => '',
110: 3 => '',
111: 4 => 'brackets',
112: 5 => 'brackets',
113: ),
114: 0 =>
115: array (
116: ),
117: 1 =>
118: array (
119: 0 => '',
120: 1 => '',
121: 2 => '',
122: 3 => '',
123: ),
124: 2 =>
125: array (
126: 0 => 'quotes',
127: 1 => 'quotes',
128: 2 => '',
129: ),
130: 3 =>
131: array (
132: 0 => 'comment',
133: 1 => 'reserved',
134: 2 => '',
135: 3 => 'brackets',
136: ),
137: 4 =>
138: array (
139: 0 => '',
140: ),
141: 5 =>
142: array (
143: 0 => '',
144: ),
145: 6 =>
146: array (
147: 0 => '',
148: ),
149: );
150: $this->_inner = array (
151: -1 =>
152: array (
153: 0 => 'comment',
154: 1 => 'var',
155: 2 => 'identifier',
156: 3 => 'special',
157: 4 => 'code',
158: 5 => 'code',
159: ),
160: 0 =>
161: array (
162: ),
163: 1 =>
164: array (
165: 0 => 'number',
166: 1 => 'number',
167: 2 => 'code',
168: 3 => 'var',
169: ),
170: 2 =>
171: array (
172: 0 => 'string',
173: 1 => 'string',
174: 2 => 'var',
175: ),
176: 3 =>
177: array (
178: 0 => 'comment',
179: 1 => 'code',
180: 2 => 'identifier',
181: 3 => 'code',
182: ),
183: 4 =>
184: array (
185: 0 => 'string',
186: ),
187: 5 =>
188: array (
189: 0 => 'special',
190: ),
191: 6 =>
192: array (
193: 0 => 'special',
194: ),
195: );
196: $this->_end = array (
197: 0 => '/(?i)\\*\\//',
198: 1 => '/(?i)(?=;|\\})/',
199: 2 => '/(?i)\\]/',
200: 3 => '/(?i)\\}/',
201: 4 => '/(?i)\\)/',
202: 5 => '/(?i)\'/',
203: 6 => '/(?i)"/',
204: );
205: $this->_states = array (
206: -1 =>
207: array (
208: 0 => 0,
209: 1 => -1,
210: 2 => -1,
211: 3 => -1,
212: 4 => 2,
213: 5 => 3,
214: ),
215: 0 =>
216: array (
217: ),
218: 1 =>
219: array (
220: 0 => -1,
221: 1 => -1,
222: 2 => -1,
223: 3 => -1,
224: ),
225: 2 =>
226: array (
227: 0 => 5,
228: 1 => 6,
229: 2 => -1,
230: ),
231: 3 =>
232: array (
233: 0 => 0,
234: 1 => 1,
235: 2 => -1,
236: 3 => 3,
237: ),
238: 4 =>
239: array (
240: 0 => -1,
241: ),
242: 5 =>
243: array (
244: 0 => -1,
245: ),
246: 6 =>
247: array (
248: 0 => -1,
249: ),
250: );
251: $this->_keywords = array (
252: -1 =>
253: array (
254: 0 => -1,
255: 1 =>
256: array (
257: ),
258: 2 =>
259: array (
260: ),
261: 3 =>
262: array (
263: ),
264: 4 => -1,
265: 5 => -1,
266: ),
267: 0 =>
268: array (
269: ),
270: 1 =>
271: array (
272: 0 =>
273: array (
274: ),
275: 1 =>
276: array (
277: ),
278: 2 =>
279: array (
280: 'propertyValue' => '/^((?i)far-left|left|center-left|center-right|center|far-right|right-side|right|behind|leftwards|rightwards|inherit|scroll|fixed|transparent|none|repeat-x|repeat-y|repeat|no-repeat|collapse|separate|auto|top|bottom|both|open-quote|close-quote|no-open-quote|no-close-quote|crosshair|default|pointer|move|e-resize|ne-resize|nw-resize|n-resize|se-resize|sw-resize|s-resize|text|wait|help|ltr|rtl|inline|block|list-item|run-in|compact|marker|table|inline-table|table-row-group|table-header-group|table-footer-group|table-row|table-column-group|table-column|table-cell|table-caption|below|level|above|higher|lower|show|hide|caption|icon|menu|message-box|small-caption|status-bar|normal|wider|narrower|ultra-condensed|extra-condensed|condensed|semi-condensed|semi-expanded|expanded|extra-expanded|ultra-expanded|italic|oblique|small-caps|bold|bolder|lighter|inside|outside|disc|circle|square|decimal|decimal-leading-zero|lower-roman|upper-roman|lower-greek|lower-alpha|lower-latin|upper-alpha|upper-latin|hebrew|armenian|georgian|cjk-ideographic|hiragana|katakana|hiragana-iroha|katakana-iroha|crop|cross|invert|visible|hidden|always|avoid|x-low|low|medium|high|x-high|mix?|repeat?|static|relative|absolute|portrait|landscape|spell-out|once|digits|continuous|code|x-slow|slow|fast|x-fast|faster|slower|justify|underline|overline|line-through|blink|capitalize|uppercase|lowercase|embed|bidi-override|baseline|sub|super|text-top|middle|text-bottom|silent|x-soft|soft|loud|x-loud|pre|nowrap|serif|sans-serif|cursive|fantasy|monospace|empty|string|strict|loose|char|true|false|dotted|dashed|solid|double|groove|ridge|inset|outset|larger|smaller|xx-small|x-small|small|large|x-large|xx-large|all|newspaper|distribute|distribute-all-lines|distribute-center-last|inter-word|inter-ideograph|inter-cluster|kashida|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|keep-all|break-all|break-word|lr-tb|tb-rl|thin|thick|inline-block|w-resize|hand|distribute-letter|distribute-space|whitespace|male|female|child)$/',
281: 'namedcolor' => '/^((?i)aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|purple|red|silver|teal|white|yellow|activeborder|activecaption|appworkspace|background|buttonface|buttonhighlight|buttonshadow|buttontext|captiontext|graytext|highlight|highlighttext|inactiveborder|inactivecaption|inactivecaptiontext|infobackground|infotext|menu|menutext|scrollbar|threeddarkshadow|threedface|threedhighlight|threedlightshadow|threedshadow|window|windowframe|windowtext)$/',
282: ),
283: 3 =>
284: array (
285: ),
286: ),
287: 2 =>
288: array (
289: 0 => -1,
290: 1 => -1,
291: 2 =>
292: array (
293: ),
294: ),
295: 3 =>
296: array (
297: 0 => -1,
298: 1 => -1,
299: 2 =>
300: array (
301: ),
302: 3 => -1,
303: ),
304: 4 =>
305: array (
306: 0 =>
307: array (
308: ),
309: ),
310: 5 =>
311: array (
312: 0 =>
313: array (
314: ),
315: ),
316: 6 =>
317: array (
318: 0 =>
319: array (
320: ),
321: ),
322: );
323: $this->_parts = array (
324: 0 =>
325: array (
326: ),
327: 1 =>
328: array (
329: 0 =>
330: array (
331: 1 => 'string',
332: ),
333: 1 => NULL,
334: 2 => NULL,
335: 3 => NULL,
336: ),
337: 2 =>
338: array (
339: 0 => NULL,
340: 1 => NULL,
341: 2 => NULL,
342: ),
343: 3 =>
344: array (
345: 0 => NULL,
346: 1 => NULL,
347: 2 => NULL,
348: 3 => NULL,
349: ),
350: 4 =>
351: array (
352: 0 => NULL,
353: ),
354: 5 =>
355: array (
356: 0 => NULL,
357: ),
358: 6 =>
359: array (
360: 0 => NULL,
361: ),
362: );
363: $this->_subst = array (
364: -1 =>
365: array (
366: 0 => false,
367: 1 => false,
368: 2 => false,
369: 3 => false,
370: 4 => false,
371: 5 => false,
372: ),
373: 0 =>
374: array (
375: ),
376: 1 =>
377: array (
378: 0 => false,
379: 1 => false,
380: 2 => false,
381: 3 => false,
382: ),
383: 2 =>
384: array (
385: 0 => false,
386: 1 => false,
387: 2 => false,
388: ),
389: 3 =>
390: array (
391: 0 => false,
392: 1 => false,
393: 2 => false,
394: 3 => false,
395: ),
396: 4 =>
397: array (
398: 0 => false,
399: ),
400: 5 =>
401: array (
402: 0 => false,
403: ),
404: 6 =>
405: array (
406: 0 => false,
407: ),
408: );
409: $this->_conditions = array (
410: );
411: $this->_kwmap = array (
412: 'propertyValue' => 'string',
413: 'namedcolor' => 'var',
414: );
415: $this->_defClass = 'code';
416: $this->_checkDefines();
417: }
418:
419: }