9d475a2191af10085464a4e2dc24989797c81819
[Packages/TYPO3.CMS.git] / typo3 / sysext / t3editor / Resources / Public / JavaScript / parse_typoscript / tokenizetyposcript.js
1 /*
2 * This file is part of the TYPO3 CMS project.
3 *
4 * It is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU General Public License, either version 2
6 * of the License, or any later version.
7 *
8 * For the full copyright and license information, please read the
9 * LICENSE.txt file that was distributed with this source code.
10 *
11 * The TYPO3 project - inspiring people to share!
12 */
13
14 /* Tokenizer for TypoScript code
15 *
16 * based on tokenizejavascript.js by Marijn Haverbeke
17 */
18
19 // List of "reserved" word in typoscript and a css-class
20 var typoscriptWords = {
21 '_CSS_DEFAULT_STYLE': 'keyword',
22 '_DEFAULT_PI_VARS': 'keyword',
23 '_GIFBUILDER': 'keyword',
24 '_LOCAL_LANG': 'keyword',
25 'CARRAY': 'keyword',
26 'CASE': 'keyword',
27 'COA': 'keyword',
28 'COA_INT': 'keyword',
29 'COBJ_ARRAY': 'keyword',
30 'CONFIG': 'keyword',
31 'CONSTANTS': 'keyword',
32 'CONTENT': 'keyword',
33 'CType': 'keyword',
34 'DB': 'keyword',
35 'DOCUMENT_BODY': 'keyword',
36 'EDITPANEL': 'keyword',
37 'EFFECT': 'keyword',
38 'FILE': 'keyword',
39 'FILES': 'keyword',
40 'FORM': 'keyword',
41 'FRAME': 'keyword',
42 'FRAMESET': 'keyword',
43 'GIFBUILDER': 'keyword',
44 'global': 'keyword',
45 'globalString': 'keyword',
46 'globalVar': 'keyword',
47 'GMENU': 'keyword',
48 'GMENU_FOLDOUT': 'keyword',
49 'GMENU_LAYERS': 'keyword',
50 'GP': 'keyword',
51 'HMENU': 'keyword',
52 'HTML': 'keyword',
53 'IENV': 'keyword',
54 'IMAGE': 'keyword',
55 'IMG_RESOURCE': 'keyword',
56 'IMGMENU': 'keyword',
57 'IMGMENUITEM': 'keyword',
58 'IMGTEXT': 'keyword',
59 'INCLUDE_TYPOSCRIPT': 'keyword',
60 'includeLibs': 'keyword',
61 'JSMENU': 'keyword',
62 'JSMENUITEM': 'keyword',
63 'LIT': 'keyword',
64 'LOAD_REGISTER': 'keyword',
65 'META': 'keyword',
66 'MULTIMEDIA': 'keyword',
67 'PAGE': 'keyword',
68 'PAGE_TARGET': 'keyword',
69 'PAGE_TSCONFIG_ID': 'keyword',
70 'PAGE_TSCONFIG_IDLIST': 'keyword',
71 'PAGE_TSCONFIG_STR': 'keyword',
72 'RECORDS': 'keyword',
73 'REMOTE_ADDR': 'keyword',
74 'RESTORE_REGISTER': 'keyword',
75 'RTE': 'keyword',
76 'SEARCHRESULT': 'keyword',
77 'SHARED': 'keyword',
78 'TCAdefaults': 'keyword',
79 'TCEFORM': 'keyword',
80 'TCEMAIN': 'keyword',
81 'TEMPLATE': 'keyword',
82 'TEXT': 'keyword',
83 'TMENU': 'keyword',
84 'TMENU_LAYERS': 'keyword',
85 'TMENUITEM': 'keyword',
86 'TSFE': 'keyword',
87 'USER': 'keyword',
88 'USER_INT': 'keyword',
89
90 'userFunc': 'keyword',
91
92 '_offset': 'reserved',
93 'absRefPrefix': 'reserved',
94 'accessibility': 'reserved',
95 'accessKey': 'reserved',
96 'addAttributes': 'reserved',
97 'addExtUrlsAndShortCuts': 'reserved',
98 'addItems': 'reserved',
99 'additionalHeaders': 'reserved',
100 'additionalParams': 'reserved',
101 'addParams': 'reserved',
102 'addQueryString': 'reserved',
103 'adjustItemsH': 'reserved',
104 'adjustSubItemsH': 'reserved',
105 'after': 'reserved',
106 'afterImg': 'reserved',
107 'afterImgLink': 'reserved',
108 'afterImgTagParams': 'reserved',
109 'afterROImg': 'reserved',
110 'afterWrap': 'reserved',
111 'age': 'reserved',
112 'alertPopups': 'reserved',
113 'align': 'reserved',
114 'allow': 'reserved',
115 'allowCaching': 'reserved',
116 'allowedAttribs': 'reserved',
117 'allowedClasses': 'reserved',
118 'allowedCols': 'reserved',
119 'allowedNewTables': 'reserved',
120 'allowTags': 'reserved',
121 'allowTVlisting': 'reserved',
122 'allSaveFunctions': 'reserved',
123 'allStdWrap': 'reserved',
124 'allWrap': 'reserved',
125 'alternativeSortingField': 'reserved',
126 'alternativeTempPath': 'reserved',
127 'altImgResource': 'reserved',
128 'altLabels': 'reserved',
129 'altIcons': 'reserved',
130 'altTarget': 'reserved',
131 'altText': 'reserved',
132 'altUrl': 'reserved',
133 'altUrl_noDefaultParams': 'reserved',
134 'altWrap': 'reserved',
135 'always': 'reserved',
136 'alwaysActivePIDlist': 'reserved',
137 'alwaysLink': 'reserved',
138 'alwaysShowClickMenuInTopFrame': 'reserved',
139 'andWhere': 'reserved',
140 'angle': 'reserved',
141 'antiAlias': 'reserved',
142 'append': 'reserved',
143 'applyTotalH': 'reserved',
144 'applyTotalW': 'reserved',
145 'archive': 'reserved',
146 'archiveTypoLink': 'reserved',
147 'arrayReturnMode': 'reserved',
148 'arrowACT': 'reserved',
149 'arrowImgParams': 'reserved',
150 'arrowNO': 'reserved',
151 'ATagAfterWrap': 'reserved',
152 'ATagBeforeWrap': 'reserved',
153 'ATagParams': 'reserved',
154 'ATagTitle': 'reserved',
155 'attribute': 'reserved',
156 'autoLevels': 'reserved',
157 'autonumber': 'reserved',
158 'backColor': 'reserved',
159 'background': 'reserved',
160 'badMess': 'reserved',
161 'baseURL': 'reserved',
162 'before': 'reserved',
163 'beforeImg': 'reserved',
164 'beforeImgLink': 'reserved',
165 'beforeImgTagParams': 'reserved',
166 'beforeROImg': 'reserved',
167 'beforeWrap': 'reserved',
168 'begin': 'reserved',
169 'beLoginLinkIPList': 'reserved',
170 'beLoginLinkIPList_login': 'reserved',
171 'beLoginLinkIPList_logout': 'reserved',
172 'bgCol': 'reserved',
173 'bgImg': 'reserved',
174 'blankStrEqFalse': 'reserved',
175 'blur': 'reserved',
176 'bm': 'reserved',
177 'bodyTag': 'reserved',
178 'bodyTagAdd': 'reserved',
179 'bodyTagCObject': 'reserved',
180 'bodyTagMargins': 'reserved',
181 'bodytext': 'reserved',
182 'border': 'reserved',
183 'borderCol': 'reserved',
184 'bordersWithin': 'reserved',
185 'borderThick': 'reserved',
186 'bottomBackColor': 'reserved',
187 'bottomContent': 'reserved',
188 'bottomHeight': 'reserved',
189 'bottomImg': 'reserved',
190 'bottomImg_mask': 'reserved',
191 'br': 'reserved',
192 'brTag': 'reserved',
193 'bullet': 'reserved',
194 'bulletlist': 'reserved',
195 'bytes': 'reserved',
196 'cache_clearAtMidnight': 'reserved',
197 'cache_period': 'reserved',
198 'caption': 'reserved',
199 'caption_stdWrap': 'reserved',
200 'captionAlign': 'reserved',
201 'captionHeader': 'reserved',
202 'captionSplit': 'reserved',
203 'case': 'reserved',
204 'casesensitiveComp': 'reserved',
205 'cellpadding': 'reserved',
206 'cellspacing': 'reserved',
207 'centerImgACT': 'reserved',
208 'centerImgCUR': 'reserved',
209 'centerImgNO': 'reserved',
210 'centerLeftImgACT': 'reserved',
211 'centerLeftImgCUR': 'reserved',
212 'centerLeftImgNO': 'reserved',
213 'centerRightImgACT': 'reserved',
214 'centerRightImgCUR': 'reserved',
215 'centerRightImgNO': 'reserved',
216 'char': 'reserved',
217 'charcoal': 'reserved',
218 'charMapConfig': 'reserved',
219 'check': 'reserved',
220 'class': 'reserved',
221 'classesAnchor': 'reserved',
222 'classesCharacter': 'reserved',
223 'classesImage': 'reserved',
224 'classesParagraph': 'reserved',
225 'clear': 'reserved',
226 'clearCache': 'reserved',
227 'clearCache_disable': 'reserved',
228 'clearCache_pageGrandParent': 'reserved',
229 'clearCache_pageSiblingChildren': 'reserved',
230 'clearCacheCmd': 'reserved',
231 'clearCacheLevels': 'reserved',
232 'clearCacheOfPages': 'reserved',
233 'clickMenuTimeOut': 'reserved',
234 'clickTitleMode': 'reserved',
235 'clipboardNumberPads': 'reserved',
236 'cMargins': 'reserved',
237 'cObjNum': 'reserved',
238 'collapse': 'reserved',
239 'collections': 'reserved',
240 'color': 'reserved',
241 'color1': 'reserved',
242 'color2': 'reserved',
243 'color3': 'reserved',
244 'color4': 'reserved',
245 'colors': 'reserved',
246 'colour': 'reserved',
247 'colPos_list': 'reserved',
248 'colRelations': 'reserved',
249 'cols': 'reserved',
250 'colSpace': 'reserved',
251 'comment_auto': 'reserved',
252 'commentWrap': 'reserved',
253 'compensateFieldWidth': 'reserved',
254 'compX': 'reserved',
255 'compY': 'reserved',
256 'conf': 'reserved',
257 'constants': 'reserved',
258 'content_from_pid_allowOutsideDomain': 'reserved',
259 'contextMenu': 'reserved',
260 'copyLevels': 'reserved',
261 'count_HMENU_MENUOBJ': 'reserved',
262 'count_menuItems': 'reserved',
263 'count_MENUOBJ': 'reserved',
264 'create': 'reserved',
265 'createFoldersInEB': 'reserved',
266 'crop': 'reserved',
267 'csConv': 'reserved',
268 'CSS_inlineStyle': 'reserved',
269 'current': 'reserved',
270 'curUid': 'reserved',
271 'cWidth': 'reserved',
272 'data': 'reserved',
273 'dataWrap': 'reserved',
274 'date': 'reserved',
275 'date_stdWrap': 'reserved',
276 'datePrefix': 'reserved',
277 'debug': 'reserved',
278 'debugData': 'reserved',
279 'debugFunc': 'reserved',
280 'debugItemConf': 'reserved',
281 'debugRenumberedObject': 'reserved',
282 'default': 'reserved',
283 'defaultAlign': 'reserved',
284 'defaultCmd': 'reserved',
285 'defaultFileUploads': 'reserved',
286 'defaultHeaderType': 'reserved',
287 'defaultOutput': 'reserved',
288 'defaults': 'reserved',
289 'defaultType': 'reserved',
290 'delete': 'reserved',
291 'denyTags': 'reserved',
292 'depth': 'reserved',
293 'DESC': 'reserved',
294 'dimensions': 'reserved',
295 'direction': 'reserved',
296 'directionLeft': 'reserved',
297 'directionUp': 'reserved',
298 'disableAdvanced': 'reserved',
299 'disableAllHeaderCode': 'reserved',
300 'disableAltText': 'reserved',
301 'disableBodyTag': 'reserved',
302 'disableCacheSelector': 'reserved',
303 'disableCharsetHeader': 'reserved',
304 'disabled': 'reserved',
305 'disableDelete': 'reserved',
306 'disableDocSelector': 'reserved',
307 'disableHideAtCopy': 'reserved',
308 'disableIconLinkToContextmenu': 'reserved',
309 'disableItems': 'reserved',
310 'disableNewContentElementWizard': 'reserved',
311 'disableNoMatchingValueElement': 'reserved',
312 'disablePageExternalUrl': 'reserved',
313 'disablePrefixComment': 'reserved',
314 'disablePrependAtCopy': 'reserved',
315 'disableSearchBox': 'reserved',
316 'disableSingleTableView': 'reserved',
317 'disableTabInTextarea': 'reserved',
318 'displayActiveOnLoad': 'reserved',
319 'displayContent': 'reserved',
320 'displayFieldIcons': 'reserved',
321 'displayIcons': 'reserved',
322 'displayMessages': 'reserved',
323 'displayQueries': 'reserved',
324 'displayRecord': 'reserved',
325 'displayTimes': 'reserved',
326 'distributeX': 'reserved',
327 'distributeY': 'reserved',
328 'DIV': 'reserved',
329 'doctype': 'reserved',
330 'doctypeSwitch': 'reserved',
331 'doktype': 'reserved',
332 'doNotLinkIt': 'reserved',
333 'doNotShowLink': 'reserved',
334 'doNotStripHTML': 'reserved',
335 'dontCheckPid': 'reserved',
336 'dontFollowMouse': 'reserved',
337 'dontHideOnMouseUp': 'reserved',
338 'dontLinkIfSubmenu': 'reserved',
339 'dontShowPalettesOnFocusInAB': 'reserved',
340 'dontWrapInTable': 'reserved',
341 'doubleBrTag': 'reserved',
342 'dWorkArea': 'reserved',
343 'edge': 'reserved',
344 'edit_docModuleUplaod': 'reserved',
345 'edit_docModuleUpload': 'reserved',
346 'edit_RTE': 'reserved',
347 'editFieldsAtATime': 'reserved',
348 'editFormsOnPage': 'reserved',
349 'editIcons': 'reserved',
350 'editNoPopup': 'reserved',
351 'editPanel': 'reserved',
352 'elements': 'reserved',
353 'emailMeAtLogin': 'reserved',
354 'emailMess': 'reserved',
355 'emboss': 'reserved',
356 'enable': 'reserved',
357 'encapsLines': 'reserved',
358 'encapsLinesStdWrap': 'reserved',
359 'encapsTagList': 'reserved',
360 'entryLevel': 'reserved',
361 'equalH': 'reserved',
362 'everybody': 'reserved',
363 'excludeDoktypes': 'reserved',
364 'excludeUidList': 'reserved',
365 'expAll': 'reserved',
366 'expand': 'reserved',
367 'explode': 'reserved',
368 'ext': 'reserved',
369 'externalBlocks': 'reserved',
370 'extTarget': 'reserved',
371 'face': 'reserved',
372 'fe_adminLib': 'reserved',
373 'field': 'reserved',
374 'fieldName': 'reserved',
375 'fieldOrder': 'reserved',
376 'fieldRequired': 'reserved',
377 'fields': 'reserved',
378 'fieldWrap': 'reserved',
379 'file': 'reserved',
380 'file1': 'reserved',
381 'file2': 'reserved',
382 'file3': 'reserved',
383 'file4': 'reserved',
384 'file5': 'reserved',
385 'filelink': 'reserved',
386 'filelist': 'reserved',
387 'files': 'reserved',
388 'firstLabel': 'reserved',
389 'firstLabelGeneral': 'reserved',
390 'fixAttrib': 'reserved',
391 'flip': 'reserved',
392 'flop': 'reserved',
393 'folders': 'reserved',
394 'foldSpeed': 'reserved',
395 'foldTimer': 'reserved',
396 'fontColor': 'reserved',
397 'fontFile': 'reserved',
398 'fontOffset': 'reserved',
399 'fontSize': 'reserved',
400 'fontSizeMultiplicator': 'reserved',
401 'fontTag': 'reserved',
402 'forceDisplayFieldIcons': 'reserved',
403 'forceDisplayIcons': 'reserved',
404 'forceTemplateParsing': 'reserved',
405 'forceTypeValue': 'reserved',
406 'format': 'reserved',
407 'frame': 'reserved',
408 'frameReloadIfNotInFrameset': 'reserved',
409 'frameSet': 'reserved',
410 'freezeMouseover': 'reserved',
411 'ftu': 'reserved',
412 'function': 'reserved',
413 'gamma': 'reserved',
414 'gapBgCol': 'reserved',
415 'gapLineCol': 'reserved',
416 'gapLineThickness': 'reserved',
417 'gapWidth': 'reserved',
418 'get': 'reserved',
419 'getBorder': 'reserved',
420 'getLeft': 'reserved',
421 'getRight': 'reserved',
422 'globalNesting': 'reserved',
423 'goodMess': 'reserved',
424 'gray': 'reserved',
425 'group': 'reserved',
426 'groupBy': 'reserved',
427 'groupid': 'reserved',
428 'header': 'reserved',
429 'header_layout': 'reserved',
430 'headerComment': 'reserved',
431 'headerData': 'reserved',
432 'headerSpace': 'reserved',
433 'headTag': 'reserved',
434 'height': 'reserved',
435 'helpText': 'reserved',
436 'hidden': 'reserved',
437 'hiddenFields': 'reserved',
438 'hide': 'reserved',
439 'hideButCreateMap': 'reserved',
440 'hideMenuTimer': 'reserved',
441 'hideMenuWhenNotOver': 'reserved',
442 'hidePStyleItems': 'reserved',
443 'hideRecords': 'reserved',
444 'hideSubmoduleIcons': 'reserved',
445 'highColor': 'reserved',
446 'history': 'reserved',
447 'HTMLparser': 'reserved',
448 'HTMLparser_tags': 'reserved',
449 'htmlSpecialChars': 'reserved',
450 'htmlTag_dir': 'reserved',
451 'htmlTag_langKey': 'reserved',
452 'htmlTag_setParams': 'reserved',
453 'http': 'reserved',
454 'icon': 'reserved',
455 'icon_image_ext_list': 'reserved',
456 'icon_link': 'reserved',
457 'iconCObject': 'reserved',
458 'ifEmpty': 'reserved',
459 'image': 'reserved',
460 'image_compression': 'reserved',
461 'image_effects': 'reserved',
462 'image_frames': 'reserved',
463 'imageLinkWrap': 'reserved',
464 'imagePath': 'reserved',
465 'images': 'reserved',
466 'imageWrapIfAny': 'reserved',
467 'imgList': 'reserved',
468 'imgMap': 'reserved',
469 'imgMapExtras': 'reserved',
470 'imgMax': 'reserved',
471 'imgNameNotRandom': 'reserved',
472 'imgNamePrefix': 'reserved',
473 'imgObjNum': 'reserved',
474 'imgParams': 'reserved',
475 'imgPath': 'reserved',
476 'imgStart': 'reserved',
477 'import': 'reserved',
478 'inc': 'reserved',
479 'includeCSS': 'reserved',
480 'includeLibrary': 'reserved',
481 'includeNotInMenu': 'reserved',
482 'incT3Lib_htmlmail': 'reserved',
483 'index': 'reserved',
484 'index_descrLgd': 'reserved',
485 'index_enable': 'reserved',
486 'index_externals': 'reserved',
487 'inlineStyle2TempFile': 'reserved',
488 'innerStdWrap': 'reserved',
489 'innerStdWrap_all': 'reserved',
490 'innerWrap': 'reserved',
491 'innerWrap2': 'reserved',
492 'input': 'reserved',
493 'inputLevels': 'reserved',
494 'insertClassesFromRTE': 'reserved',
495 'insertData': 'reserved',
496 'insertDmailerBoundaries': 'reserved',
497 'intensity': 'reserved',
498 'intTarget': 'reserved',
499 'intval': 'reserved',
500 'invert': 'reserved',
501 'IProcFunc': 'reserved',
502 'itemArrayProcFunc': 'reserved',
503 'itemH': 'reserved',
504 'items': 'reserved',
505 'itemsProcFunc': 'reserved',
506 'iterations': 'reserved',
507 'join': 'reserved',
508 'JSWindow': 'reserved',
509 'JSwindow_params': 'reserved',
510 'jumpurl': 'reserved',
511 'jumpUrl': 'reserved',
512 'jumpurl_enable': 'reserved',
513 'jumpurl_mailto_disable': 'reserved',
514 'jumpUrl_transferSession': 'reserved',
515 'keep': 'reserved',
516 'keepEntries': 'reserved',
517 'keepNonMatchedTags': 'reserved',
518 'key': 'reserved',
519 'label': 'reserved',
520 'labelStdWrap': 'reserved',
521 'labelWrap': 'reserved',
522 'lang': 'reserved',
523 'language': 'reserved',
524 'language_alt': 'reserved',
525 'languageField': 'reserved',
526 'layer_menu_id': 'reserved',
527 'layerStyle': 'reserved',
528 'left': 'reserved',
529 'leftIcons': 'reserved',
530 'leftImgACT': 'reserved',
531 'leftImgCUR': 'reserved',
532 'leftImgNO': 'reserved',
533 'leftjoin': 'reserved',
534 'leftOffset': 'reserved',
535 'levels': 'reserved',
536 'leveluid': 'reserved',
537 'limit': 'reserved',
538 'line': 'reserved',
539 'lineColor': 'reserved',
540 'lineThickness': 'reserved',
541 'linkPrefix': 'reserved',
542 'linkTitleToSelf': 'reserved',
543 'linkVars': 'reserved',
544 'linkWrap': 'reserved',
545 'listNum': 'reserved',
546 'listOnlyInSingleTableView': 'reserved',
547 'lm': 'reserved',
548 'locale_all': 'reserved',
549 'localNesting': 'reserved',
550 'locationData': 'reserved',
551 'lockFilePath': 'reserved',
552 'lockPosition': 'reserved',
553 'lockPosition_addSelf': 'reserved',
554 'lockPosition_adjust': 'reserved',
555 'lockToIP': 'reserved',
556 'longdescURL': 'reserved',
557 'lowColor': 'reserved',
558 'lower': 'reserved',
559 'LR': 'reserved',
560 'mailto': 'reserved',
561 'main': 'reserved',
562 'mainScript': 'reserved',
563 'makelinks': 'reserved',
564 'markerWrap': 'reserved',
565 'mask': 'reserved',
566 'max': 'reserved',
567 'maxAge': 'reserved',
568 'maxChars': 'reserved',
569 'maxH': 'reserved',
570 'maxHeight': 'reserved',
571 'maxItems': 'reserved',
572 'maxW': 'reserved',
573 'maxWidth': 'reserved',
574 'maxWInText': 'reserved',
575 'mayNotCreateEditShortcuts': 'reserved',
576 'menu_type': 'reserved',
577 'menuBackColor': 'reserved',
578 'menuHeight': 'reserved',
579 'menuName': 'reserved',
580 'menuOffset': 'reserved',
581 'menuWidth': 'reserved',
582 'message_page_is_being_generated': 'reserved',
583 'message_preview': 'reserved',
584 'meta': 'reserved',
585 'metaCharset': 'reserved',
586 'method': 'reserved',
587 'min': 'reserved',
588 'minH': 'reserved',
589 'minItems': 'reserved',
590 'minW': 'reserved',
591 'mode': 'reserved',
592 'moduleMenuCollapsable': 'reserved',
593 'MP_defaults': 'reserved',
594 'MP_disableTypolinkClosestMPvalue': 'reserved',
595 'MP_mapRootPoints': 'reserved',
596 'name': 'reserved',
597 'navFrameResizable': 'reserved',
598 'nesting': 'reserved',
599 'netprintApplicationLink': 'reserved',
600 'neverHideAtCopy': 'reserved',
601 'newPageWiz': 'reserved',
602 'newRecordFromTable': 'reserved',
603 'newWindow': 'reserved',
604 'newWizards': 'reserved',
605 'next': 'reserved',
606 'niceText': 'reserved',
607 'nicetext': 'reserved',
608 'no_cache': 'reserved',
609 'no_search': 'reserved',
610 'noAttrib': 'reserved',
611 'noCache': 'reserved',
612 'noCols': 'reserved',
613 'noCreateRecordsLink': 'reserved',
614 'noLink': 'reserved',
615 'noMatchingValue_label': 'reserved',
616 'nonCachedSubst': 'reserved',
617 'nonTypoTagStdWrap': 'reserved',
618 'nonTypoTagUserFunc': 'reserved',
619 'nonWrappedTag': 'reserved',
620 'noOrderBy': 'reserved',
621 'noPageTitle': 'reserved',
622 'noRows': 'reserved',
623 'noScaleUp': 'reserved',
624 'noStretchAndMarginCells': 'reserved',
625 'noThumbsInEB': 'reserved',
626 'noThumbsInRTEimageSelect': 'reserved',
627 'noTrimWrap': 'reserved',
628 'noValueInsert': 'reserved',
629 'obj': 'reserved',
630 'offset': 'reserved',
631 'offsetWrap': 'reserved',
632 'onlineWorkspaceInfo': 'reserved',
633 'onlyCurrentPid': 'reserved',
634 'opacity': 'reserved',
635 'orderBy': 'reserved',
636 'outerWrap': 'reserved',
637 'outline': 'reserved',
638 'outputLevels': 'reserved',
639 'override': 'reserved',
640 'overrideAttribs': 'reserved',
641 'overrideId': 'reserved',
642 'overridePageModule': 'reserved',
643 'overrideWithExtension': 'reserved',
644 'pageFrameObj': 'reserved',
645 'pageGenScript': 'reserved',
646 'pageTitleFirst': 'reserved',
647 'parameter': 'reserved',
648 'params': 'reserved',
649 'parseFunc': 'reserved',
650 'parser': 'reserved',
651 'password': 'reserved',
652 'path': 'reserved',
653 'permissions': 'reserved',
654 'pid_list': 'reserved',
655 'pidInList': 'reserved',
656 'pixelSpaceFontSizeRef': 'reserved',
657 'plaintextLib': 'reserved',
658 'plainTextStdWrap': 'reserved',
659 'postCObject': 'reserved',
660 'postLineBlanks': 'reserved',
661 'postLineChar': 'reserved',
662 'postLineLen': 'reserved',
663 'postUserFunc': 'reserved',
664 'postUserFuncInt': 'reserved',
665 'preBlanks': 'reserved',
666 'preCObject': 'reserved',
667 'prefix': 'reserved',
668 'prefixComment': 'reserved',
669 'prefixLocalAnchors': 'reserved',
670 'prefixRelPathWith': 'reserved',
671 'preIfEmptyListNum': 'reserved',
672 'preLineBlanks': 'reserved',
673 'preLineChar': 'reserved',
674 'preLineLen': 'reserved',
675 'prepend': 'reserved',
676 'preserveEntities': 'reserved',
677 'preUserFunc': 'reserved',
678 'prev': 'reserved',
679 'previewBorder': 'reserved',
680 'prevnextToSection': 'reserved',
681 'printheader': 'reserved',
682 'prioriCalc': 'reserved',
683 'proc': 'reserved',
684 'properties': 'reserved',
685 'protect': 'reserved',
686 'protectLvar': 'reserved',
687 'publish_levels': 'reserved',
688 'QEisDefault': 'reserved',
689 'quality': 'reserved',
690 'radio': 'reserved',
691 'radioWrap': 'reserved',
692 'range': 'reserved',
693 'rawUrlEncode': 'reserved',
694 'recipient': 'reserved',
695 'recursive': 'reserved',
696 'recursiveDelete': 'reserved',
697 'redirect': 'reserved',
698 'redirectToURL': 'reserved',
699 'reduceColors': 'reserved',
700 'references': 'reserved',
701 'register': 'reserved',
702 'relativeToParentLayer': 'reserved',
703 'relativeToTriggerItem': 'reserved',
704 'relPathPrefix': 'reserved',
705 'remap': 'reserved',
706 'remapTag': 'reserved',
707 'removeBadHTML': 'reserved',
708 'removeDefaultJS': 'reserved',
709 'removeIfEquals': 'reserved',
710 'removeIfFalse': 'reserved',
711 'removeItems': 'reserved',
712 'removeObjectsOfDummy': 'reserved',
713 'removePrependedNumbers': 'reserved',
714 'removeTags': 'reserved',
715 'removeWrapping': 'reserved',
716 'renderCharset': 'reserved',
717 'renderWrap': 'reserved',
718 'reset': 'reserved',
719 'resources': 'reserved',
720 'resultObj': 'reserved',
721 'returnLast': 'reserved',
722 'returnUrl': 'reserved',
723 'rightImgACT': 'reserved',
724 'rightImgCUR': 'reserved',
725 'rightImgNO': 'reserved',
726 'rightjoin': 'reserved',
727 'rm': 'reserved',
728 'rmTagIfNoAttrib': 'reserved',
729 'RO_chBgColor': 'reserved',
730 'rotate': 'reserved',
731 'rows': 'reserved',
732 'rowSpace': 'reserved',
733 'RTEfullScreenWidth': 'reserved',
734 'rules': 'reserved',
735 'sample': 'reserved',
736 'saveClipboard': 'reserved',
737 'saveDocNew': 'reserved',
738 'secondRow': 'reserved',
739 'section': 'reserved',
740 'sectionIndex': 'reserved',
741 'select': 'reserved',
742 'select_key': 'reserved',
743 'selectFields': 'reserved',
744 'separator': 'reserved',
745 'set': 'reserved',
746 'setContentToCurrent': 'reserved',
747 'setCurrent': 'reserved',
748 'setfixed': 'reserved',
749 'setFixedHeight': 'reserved',
750 'setFixedWidth': 'reserved',
751 'setJS_mouseOver': 'reserved',
752 'setJS_openPic': 'reserved',
753 'setOnly': 'reserved',
754 'shadow': 'reserved',
755 'sharpen': 'reserved',
756 'shear': 'reserved',
757 'short': 'reserved',
758 'shortcut': 'reserved',
759 'shortcut_onEditId_dontSetPageTree': 'reserved',
760 'shortcut_onEditId_keepExistingExpanded': 'reserved',
761 'shortcutFrame': 'reserved',
762 'shortcutGroups': 'reserved',
763 'shortcutIcon': 'reserved',
764 'show': 'reserved',
765 'showAccessRestrictedPages': 'reserved',
766 'showActive': 'reserved',
767 'showClipControlPanelsDespiteOfCMlayers': 'reserved',
768 'showFirst': 'reserved',
769 'showHiddenPages': 'reserved',
770 'showHiddenRecords': 'reserved',
771 'showHistory': 'reserved',
772 'showPageIdWithTitle': 'reserved',
773 'showTagFreeClasses': 'reserved',
774 'simulateDate': 'reserved',
775 'simulateUserGroup': 'reserved',
776 'singlePid': 'reserved',
777 'site_author': 'reserved',
778 'site_reserved': 'reserved',
779 'sitetitle': 'reserved',
780 'siteUrl': 'reserved',
781 'size': 'reserved',
782 'solarize': 'reserved',
783 'sorting': 'reserved',
784 'source': 'reserved',
785 'space': 'reserved',
786 'spaceAfter': 'reserved',
787 'spaceBefore': 'reserved',
788 'spaceBelowAbove': 'reserved',
789 'spaceLeft': 'reserved',
790 'spaceRight': 'reserved',
791 'spacing': 'reserved',
792 'spamProtectEmailAddresses': 'reserved',
793 'spamProtectEmailAddresses_atSubst': 'reserved',
794 'spamProtectEmailAddresses_lastDotSubst': 'reserved',
795 'special': 'reserved',
796 'splitChar': 'reserved',
797 'splitRendering': 'reserved',
798 'src': 'reserved',
799 'startInTaskCenter': 'reserved',
800 'stayFolded': 'reserved',
801 'stdheader': 'reserved',
802 'stdWrap': 'reserved',
803 'stdWrap2': 'reserved',
804 'strftime': 'reserved',
805 'stripHtml': 'reserved',
806 'styles': 'reserved',
807 'stylesheet': 'reserved',
808 'submenuObjSuffixes': 'reserved',
809 'subMenuOffset': 'reserved',
810 'submit': 'reserved',
811 'subst_elementUid': 'reserved',
812 'substMarksSeparately': 'reserved',
813 'substring': 'reserved',
814 'swirl': 'reserved',
815 'sword': 'reserved',
816 'sword_noMixedCase': 'reserved',
817 'SWORD_PARAMS': 'reserved',
818 'sword_standAlone': 'reserved',
819 'sys_language_mode': 'reserved',
820 'sys_language_overlay': 'reserved',
821 'sys_language_softMergeIfNotBlank': 'reserved',
822 'sys_language_uid': 'reserved',
823 'table': 'reserved',
824 'tableCellColor': 'reserved',
825 'tableParams': 'reserved',
826 'tables': 'reserved',
827 'tableStdWrap': 'reserved',
828 'tableStyle': 'reserved',
829 'tableWidth': 'reserved',
830 'tags': 'reserved',
831 'target': 'reserved',
832 'TDparams': 'reserved',
833 'templateContent': 'reserved',
834 'templateFile': 'reserved',
835 'text': 'reserved',
836 'textarea': 'reserved',
837 'textMargin': 'reserved',
838 'textMargin_outOfText': 'reserved',
839 'textMaxLength': 'reserved',
840 'textObjNum': 'reserved',
841 'textPos': 'reserved',
842 'textStyle': 'reserved',
843 'thickness': 'reserved',
844 'thumbnailsByDefault': 'reserved',
845 'tile': 'reserved',
846 'time_stdWrap': 'reserved',
847 'tipafriendLib': 'reserved',
848 'title': 'reserved',
849 'titleLen': 'reserved',
850 'titleTagFunction': 'reserved',
851 'titleText': 'reserved',
852 'tm': 'reserved',
853 'token': 'reserved',
854 'topOffset': 'reserved',
855 'totalWidth': 'reserved',
856 'transparentBackground': 'reserved',
857 'transparentColor': 'reserved',
858 'trim': 'reserved',
859 'tsdebug_tree': 'reserved',
860 'type': 'reserved',
861 'typeNum': 'reserved',
862 'types': 'reserved',
863 'typolinkCheckRootline': 'reserved',
864 'uidInList': 'reserved',
865 'unset': 'reserved',
866 'uploadFieldsInTopOfEB': 'reserved',
867 'uploads': 'reserved',
868 'upper': 'reserved',
869 'useCacheHash': 'reserved',
870 'useLargestItemX': 'reserved',
871 'useLargestItemY': 'reserved',
872 'user': 'reserved',
873 'userdefined': 'reserved',
874 'userfunction': 'reserved',
875 'userid': 'reserved',
876 'USERNAME_substToken': 'reserved',
877 'userProc': 'reserved',
878 'value': 'reserved',
879 'valueArray': 'reserved',
880 'wave': 'reserved',
881 'where': 'reserved',
882 'width': 'reserved',
883 'wiz': 'reserved',
884 'wordSpacing': 'reserved',
885 'workArea': 'reserved',
886 'wrap': 'reserved',
887 'wrap1': 'reserved',
888 'wrap2': 'reserved',
889 'wrap3': 'reserved',
890 'wrapAfterTags': 'reserved',
891 'wrapAlign': 'reserved',
892 'wrapFieldName': 'reserved',
893 'wrapItemAndSub': 'reserved',
894 'wrapNonWrappedLines': 'reserved',
895 'wraps': 'reserved',
896 'xhtml_cleaning': 'reserved',
897 'xmlprologue': 'reserved',
898 'xPosOffset': 'reserved',
899 'yPosOffset': 'reserved',
900
901 'admPanel': 'keyword2',
902 'alt_print': 'keyword2',
903 'auth': 'keyword2',
904 'browser': 'keyword2',
905 'cache': 'keyword2',
906 'CHECK': 'keyword2',
907 'cObj': 'keyword2',
908 'cObject': 'keyword2',
909 'COMMENT': 'keyword2',
910 'config': 'keyword2',
911 'content': 'keyword2',
912 'copy': 'keyword2',
913 'CSS_inlineStyle': 'keyword2',
914 'cut': 'keyword2',
915 'dataArray': 'keyword2',
916 'dayofmonth': 'keyword2',
917 'dayofweek': 'keyword2',
918 'db_list': 'keyword2',
919 'device': 'keyword2',
920 'dynCSS': 'keyword2',
921 'edit': 'keyword2',
922 'edit_access': 'keyword2',
923 'edit_pageheader': 'keyword2',
924 'folder': 'keyword2',
925 'folderTree': 'keyword2',
926 'foldoutMenu': 'keyword2',
927 'Functions': 'keyword2',
928 'gmenu_foldout': 'keyword2',
929 'gmenu_layers': 'keyword2',
930 'hostname': 'keyword2',
931 'hour': 'keyword2',
932 'imgList': 'keyword2',
933 'imgResource': 'keyword2',
934 'imgText': 'keyword2',
935 'info': 'keyword2',
936 'IP': 'keyword2',
937 'jsmenu': 'keyword2',
938 'JSwindow': 'keyword2',
939 'LABEL': 'keyword2',
940 'layout': 'keyword2',
941 'lib': 'keyword2',
942 'loginUser': 'keyword2',
943 'marks': 'keyword2',
944 'minute': 'keyword2',
945 'mod': 'keyword2',
946 'module': 'keyword2',
947 'month': 'keyword2',
948 'move_wizard': 'keyword2',
949 'new': 'keyword2',
950 'new_wizard': 'keyword2',
951 'noResultObj': 'keyword2',
952 'numRows': 'keyword2',
953 'options': 'keyword2',
954 'page': 'keyword2',
955 'pageTree': 'keyword2',
956 'paste': 'keyword2',
957 'perms': 'keyword2',
958 'PIDinRootline': 'keyword2',
959 'PIDupinRootline': 'keyword2',
960 'plugin': 'keyword2',
961 'postform': 'keyword2',
962 'postform_newThread': 'keyword2',
963 'preview': 'keyword2',
964 'publish': 'keyword2',
965 'RADIO': 'keyword2',
966 'renderObj': 'keyword2',
967 'REQ': 'keyword2',
968 'RTE': 'keyword2',
969 'RTE_compliant': 'keyword2',
970 'select': 'keyword2',
971 'setup': 'keyword2',
972 'split': 'keyword2',
973 'stdWrap': 'keyword2',
974 'subparts': 'keyword2',
975 'system': 'keyword2',
976 'temp': 'keyword2',
977 'template': 'keyword2',
978 'treeLevel': 'keyword2',
979 'tsdebug': 'keyword2',
980 'typolink': 'keyword2',
981 'url': 'keyword2',
982 'useragent': 'keyword2',
983 'userFunc': 'keyword2',
984 'version': 'keyword2',
985 'view': 'keyword2',
986 'workOnSubpart': 'keyword2',
987
988 'ACT': 'keyword3',
989 'ACTIFSUB': 'keyword3',
990 'ACTIFSUBRO': 'keyword',
991 'ACTRO': 'keyword3',
992 'all': 'keyword3',
993 'arrowACT': 'keyword3',
994 'arrowNO': 'keyword3',
995 'ascii': 'keyword3',
996 'atLeast': 'keyword3',
997 'atMost': 'keyword3',
998 'BE': 'keyword3',
999 'be_groups': 'keyword3',
1000 'be_users': 'keyword3',
1001 'BOX': 'keyword3',
1002 'browse': 'keyword3',
1003 'bullets': 'keyword3',
1004 'CUR': 'keyword3',
1005 'CURIFSUB': 'keyword3',
1006 'CURIFSUBRO': 'keyword3',
1007 'CURRO': 'keyword3',
1008 'default': 'keyword3',
1009 'description': 'keyword3',
1010 'directory': 'keyword3',
1011 'directReturn': 'keyword3',
1012 'div': 'keyword3',
1013 'else': 'keyword3',
1014 'email': 'keyword3',
1015 'end': 'keyword3',
1016 'equals': 'keyword3',
1017 'external': 'keyword3',
1018 'false': 'keyword3',
1019 'FE': 'keyword3',
1020 'fe_groups': 'keyword3',
1021 'fe_users': 'keyword3',
1022 'feadmin': 'keyword3',
1023 'header': 'keyword3',
1024 'html': 'keyword3',
1025 'id': 'keyword3',
1026 'if': 'keyword3',
1027 'ifEmpty': 'keyword3',
1028 'IFSUB': 'keyword3',
1029 'IFSUBRO': 'keyword3',
1030 'image': 'keyword3',
1031 'inBranch': 'keyword3',
1032 'isFalse': 'keyword3',
1033 'isGreaterThan': 'keyword3',
1034 'isInList': 'keyword3',
1035 'isLessThan': 'keyword3',
1036 'isPositive': 'keyword3',
1037 'isTrue': 'keyword3',
1038 'keyword3': 'keyword3',
1039 'language': 'keyword3',
1040 'leveltitle': 'keyword3',
1041 'list': 'keyword3',
1042 'login': 'keyword3',
1043 'mailform': 'keyword3',
1044 'media': 'keyword3',
1045 'menu': 'keyword3',
1046 'mod': 'keyword3',
1047 'multimedia': 'keyword3',
1048 'negate': 'keyword3',
1049 'NEW': 'keyword3',
1050 'NO': 'keyword3',
1051 'none': 'keyword3',
1052 'pages': 'keyword3',
1053 'pages_language_overlay': 'keyword3',
1054 'parseFunc_RTE': 'keyword3',
1055 'pid': 'keyword3',
1056 'required': 'keyword3',
1057 'RO': 'keyword3',
1058 'rootline': 'keyword3',
1059 'search': 'keyword3',
1060 'shortcut': 'keyword3',
1061 'sitemap': 'keyword3',
1062 'SPC': 'keyword3',
1063 'sys_dmail': 'keyword3',
1064 'sys_domain': 'keyword3',
1065 'sys_filemounts': 'keyword3',
1066 'sys_note': 'keyword3',
1067 'sys_template': 'keyword3',
1068 'tabel': 'keyword3',
1069 'text': 'keyword3',
1070 'textpic': 'keyword3',
1071 'this': 'keyword3',
1072 'top': 'keyword3',
1073 'true': 'keyword3',
1074 'twice': 'keyword3',
1075 'uid': 'keyword3',
1076 'uniqueGlobal': 'keyword3',
1077 'uniqueLocal': 'keyword3',
1078 'unsetEmpty': 'keyword3',
1079 'updated': 'keyword3',
1080 'uploads': 'keyword3',
1081 'us': 'keyword3',
1082 'user_task': 'keyword3',
1083 'USERDEF1': 'keyword3',
1084 'USERDEF1RO': 'keyword3',
1085 'USERDEF2': 'keyword3',
1086 'USERDEF2RO': 'keyword3',
1087 'usergroup': 'keyword3',
1088 'USR': 'keyword3',
1089 'USRRO': 'keyword3',
1090 'web_func': 'keyword3',
1091 'web_info': 'keyword3',
1092 'web_layout': 'keyword3',
1093 'web_list': 'keyword3',
1094 'web_ts': 'keyword',
1095 'xhtml_strict': 'keyword3',
1096 'xhtml_trans': 'keyword3',
1097 'XY': 'keyword3',
1098 'ypMenu': 'keyword3'
1099 }
1100
1101 var tokenizeTypoScript = function() {
1102
1103 // Some helper regexp matchers.
1104 var isOperatorChar = matcher(/[\+\-\*\&\%\/=<>!\?]/);
1105 var isDigit = matcher(/[0-9]/);
1106 var isHexDigit = matcher(/[0-9A-Fa-f]/);
1107 var isWordChar = matcher(/[\w\$_]/);
1108
1109 function isWhiteSpace(ch) {
1110 // Unfortunately, IE's regexp matcher thinks non-breaking spaces
1111 // aren't whitespace. Also, in our scheme newlines are no
1112 // whitespace (they are another special case).
1113 return ch != "\n" && (ch == nbsp || /\s/.test(ch));
1114 }
1115
1116 // This function produces a MochiKit-style iterator that tokenizes
1117 // the output of the given stringstream (see stringstream.js).
1118 // Tokens are objects with a type, style, and value property. The
1119 // value contains the textual content of the token. Because this may
1120 // include trailing whitespace (for efficiency reasons), some
1121 // tokens, such a variable names, also have a name property
1122 // containing their actual textual value.
1123 return function(source) {
1124 // Produce a value to return. Automatically skips and includes any
1125 // whitespace. The base argument is prepended to the value
1126 // property and assigned to the name property -- this is used when
1127 // the caller has already extracted the text from the stream
1128 // himself.
1129 function result(type, style, base) {
1130 // nextWhile(isWhiteSpace); - comment thats line because needed for autocomplete
1131 var value = {
1132 type: type,
1133 style: style,
1134 value: (base ? base + source.get() : source.get())
1135 };
1136 if (base) {
1137 value.name = base;
1138 }
1139 return value;
1140 }
1141
1142 // Advance the text stream over characters for which test returns
1143 // true. (The characters that are 'consumed' like this can later
1144 // be retrieved by calling source.get()).
1145 function nextWhile(test) {
1146 var next;
1147 while ((next = source.peek()) && test(next)) {
1148 source.next();
1149 }
1150 }
1151
1152 // Advance the stream until the given character (not preceded by a
1153 // backslash) is encountered (or a newline is found).
1154 function nextUntilUnescaped(end) {
1155 var escaped = false;
1156 var next;
1157 while ((next = source.peek()) && next != "\n") {
1158 source.next();
1159 if (next == end && !escaped) {
1160 break;
1161 }
1162 escaped = next == "\\";
1163 }
1164 }
1165
1166 function readHexNumber() {
1167 source.next();
1168 // skip the 'x'
1169 nextWhile(isHexDigit);
1170 return result("number", "atom");
1171 }
1172
1173 function readNumber() {
1174 nextWhile(isDigit);
1175 return result("number", "atom");
1176 }
1177
1178 // Read a word, look it up in keywords. If not found, it is a
1179 // variable, otherwise it is a keyword of the type found.
1180 function readWord() {
1181 nextWhile(isWordChar);
1182 var word = source.get();
1183 var known = typoscriptWords.hasOwnProperty(word) && {
1184 type: 'keyword',
1185 style: typoscriptWords[word]
1186 };
1187 return known ?
1188 result(known.type, known.style, word) :
1189 result("variable", "other", word);
1190 }
1191
1192 function readRegexp() {
1193 nextUntilUnescaped("/");
1194 nextWhile(matcher(/[gi]/));
1195 return result("regexp", "string");
1196 }
1197
1198 // Mutli-line comments are tricky. We want to return the newlines
1199 // embedded in them as regular newline tokens, and then continue
1200 // returning a comment token for every line of the comment. So
1201 // some state has to be saved (inComment) to indicate whether we
1202 // are inside a /* */ sequence.
1203 function readMultilineComment(start) {
1204 this.inComment = true;
1205 var maybeEnd = (start == "*");
1206 while (true) {
1207 var next = source.peek();
1208 if (next == "\n") {
1209 break;
1210 }
1211 source.next();
1212 if (next == "/" && maybeEnd) {
1213 this.inComment = false;
1214 break;
1215 }
1216 maybeEnd = (next == "*");
1217 }
1218
1219 return result("comment", "ts-comment");
1220 }
1221
1222 // Fetch the next token. Dispatches on first character in the
1223 // stream, or first two characters when the first is a slash. The
1224 // || things are a silly trick to keep simple cases on a single
1225 // line.
1226 function next() {
1227 var token = null;
1228 var ch = source.next();
1229 if (ch == "\n") {
1230 token = {
1231 type: "newline",
1232 style: "whitespace",
1233 value: source.get()
1234 };
1235 this.inValue = false;
1236
1237 } else if (!this.inValue && this.inComment) {
1238 token = readMultilineComment.call(this, ch);
1239
1240 /*
1241 } else if (this.inValue) {
1242 token = nextUntilUnescaped(null) || {
1243 type: "value",
1244 style: "ts-value",
1245 value: source.get()
1246 };
1247 this.inValue = false;
1248 */
1249
1250 } else if (isWhiteSpace(ch)) {
1251 token = nextWhile(isWhiteSpace) || result("whitespace", "whitespace");
1252
1253 } else if (!this.inValue && (ch == "\"" || ch == "'")) {
1254 token = nextUntilUnescaped(ch) || result("string", "string");
1255
1256 } else if (
1257 ( ch == "<" ||
1258 ch == ">" ||
1259 ( ch == "="
1260 && source.peek() != "<"
1261 )
1262 )
1263 && source.peek() != "\n" ) { // there must be some value behind the operator!
1264 this.inValue = true;
1265 token = result(ch, "ts-operator");
1266
1267 } else if (!this.inValue && ch == "[") {
1268 token = nextUntilUnescaped("]") || result("condition", "ts-condition");
1269
1270 // with punctuation, the type of the token is the symbol itself
1271 } else if (!this.inValue && /[\[\]\(\),;\:\.\<\>\=]/.test(ch)) {
1272 token = result(ch, "ts-operator");
1273
1274 } else if (!this.inValue && (ch == "{" || ch == "}")) {
1275 token = result(ch, "ts-operator curly-bracket");
1276
1277 } else if (!this.inValue && ch == "0" && (source.peek() == "x" || source.peek() == "X")) {
1278 token = readHexNumber();
1279
1280 } else if (!this.inValue && isDigit(ch)) {
1281 token = readNumber();
1282
1283 } else if (!this.inValue && ch == "/") {
1284 next = source.peek();
1285
1286 if (next == "*") {
1287 token = readMultilineComment.call(this, ch);
1288
1289 } else if (next == "/") {
1290 token = nextUntilUnescaped(null) || result("comment", "ts-comment");
1291
1292 } else if (this.regexp) {
1293 token = readRegexp();
1294
1295 } else {
1296 token = nextWhile(isOperatorChar) || result("operator", "ts-operator");
1297 }
1298
1299 } else if (!this.inValue && ch == "#") {
1300 token = nextUntilUnescaped(null) || result("comment", "ts-comment");
1301
1302 } else if (!this.inValue && isOperatorChar(ch)) {
1303 token = nextWhile(isOperatorChar) || result("operator", "ts-operator");
1304
1305 } else {
1306 token = readWord();
1307 if (this.inValue) {
1308 token.style += ' ts-value';
1309 }
1310 }
1311
1312 // JavaScript's syntax rules for when a slash might be the start
1313 // of a regexp and when it is just a division operator are kind
1314 // of non-obvious. This decides, based on the current token,
1315 // whether the next token could be a regular expression.
1316 if (token.style != "whitespace" && token != "comment") {
1317 this.regexp = token.type == "operator" || token.type == "keyword c" || token.type.match(/[\[{}\(,;:]/);
1318 }
1319 return token;
1320 }
1321
1322 // Wrap it in an iterator. The state (regexp and inComment) is
1323 // exposed because a parser will need to save it when making a
1324 // copy of its state.
1325 return {
1326 next: next,
1327 regexp: true,
1328 inComment: false,
1329 inValue: false
1330 };
1331 }
1332 } ();
1333 /* Tokenizer for TypoScript code
1334 *
1335 * based on tokenizejavascript.js by Marijn Haverbeke
1336 */
1337
1338 // List of "reserved" word in typoscript and a css-class
1339 var typoscriptWords = {
1340 '_CSS_DEFAULT_STYLE': 'keyword',
1341 '_DEFAULT_PI_VARS': 'keyword',
1342 '_GIFBUILDER': 'keyword',
1343 '_LOCAL_LANG': 'keyword',
1344 'CARRAY': 'keyword',
1345 'CASE': 'keyword',
1346 'COA': 'keyword',
1347 'COA_INT': 'keyword',
1348 'COBJ_ARRAY': 'keyword',
1349 'CONFIG': 'keyword',
1350 'CONSTANTS': 'keyword',
1351 'CONTENT': 'keyword',
1352 'CType': 'keyword',
1353 'DB': 'keyword',
1354 'DOCUMENT_BODY': 'keyword',
1355 'EDITPANEL': 'keyword',
1356 'EFFECT': 'keyword',
1357 'FILE': 'keyword',
1358 'FORM': 'keyword',
1359 'FRAME': 'keyword',
1360 'FRAMESET': 'keyword',
1361 'GIFBUILDER': 'keyword',
1362 'global': 'keyword',
1363 'globalString': 'keyword',
1364 'globalVar': 'keyword',
1365 'GMENU': 'keyword',
1366 'GMENU_FOLDOUT': 'keyword',
1367 'GMENU_LAYERS': 'keyword',
1368 'GP': 'keyword',
1369 'HMENU': 'keyword',
1370 'HTML': 'keyword',
1371 'IENV': 'keyword',
1372 'IMAGE': 'keyword',
1373 'IMG_RESOURCE': 'keyword',
1374 'IMGMENU': 'keyword',
1375 'IMGMENUITEM': 'keyword',
1376 'IMGTEXT': 'keyword',
1377 'INCLUDE_TYPOSCRIPT': 'keyword',
1378 'includeLibs': 'keyword',
1379 'JSMENU': 'keyword',
1380 'JSMENUITEM': 'keyword',
1381 'LIT': 'keyword',
1382 'LOAD_REGISTER': 'keyword',
1383 'META': 'keyword',
1384 'MULTIMEDIA': 'keyword',
1385 'PAGE': 'keyword',
1386 'PAGE_TARGET': 'keyword',
1387 'PAGE_TSCONFIG_ID': 'keyword',
1388 'PAGE_TSCONFIG_IDLIST': 'keyword',
1389 'PAGE_TSCONFIG_STR': 'keyword',
1390 'RECORDS': 'keyword',
1391 'REMOTE_ADDR': 'keyword',
1392 'RESTORE_REGISTER': 'keyword',
1393 'RTE': 'keyword',
1394 'SEARCHRESULT': 'keyword',
1395 'SHARED': 'keyword',
1396 'TCAdefaults': 'keyword',
1397 'TCEFORM': 'keyword',
1398 'TCEMAIN': 'keyword',
1399 'TEMPLATE': 'keyword',
1400 'TEXT': 'keyword',
1401 'TMENU': 'keyword',
1402 'TMENU_LAYERS': 'keyword',
1403 'TMENUITEM': 'keyword',
1404 'TSFE': 'keyword',
1405 'USER': 'keyword',
1406 'USER_INT': 'keyword',
1407
1408 'userFunc': 'keyword',
1409
1410 '_offset': 'reserved',
1411 'absRefPrefix': 'reserved',
1412 'accessibility': 'reserved',
1413 'accessKey': 'reserved',
1414 'addAttributes': 'reserved',
1415 'addExtUrlsAndShortCuts': 'reserved',
1416 'addItems': 'reserved',
1417 'additionalHeaders': 'reserved',
1418 'additionalParams': 'reserved',
1419 'addParams': 'reserved',
1420 'addQueryString': 'reserved',
1421 'adjustItemsH': 'reserved',
1422 'adjustSubItemsH': 'reserved',
1423 'after': 'reserved',
1424 'afterImg': 'reserved',
1425 'afterImgLink': 'reserved',
1426 'afterImgTagParams': 'reserved',
1427 'afterROImg': 'reserved',
1428 'afterWrap': 'reserved',
1429 'age': 'reserved',
1430 'alertPopups': 'reserved',
1431 'align': 'reserved',
1432 'allow': 'reserved',
1433 'allowCaching': 'reserved',
1434 'allowedAttribs': 'reserved',
1435 'allowedClasses': 'reserved',
1436 'allowedCols': 'reserved',
1437 'allowedNewTables': 'reserved',
1438 'allowTags': 'reserved',
1439 'allowTVlisting': 'reserved',
1440 'allSaveFunctions': 'reserved',
1441 'allStdWrap': 'reserved',
1442 'allWrap': 'reserved',
1443 'alternativeSortingField': 'reserved',
1444 'alternativeTempPath': 'reserved',
1445 'altImgResource': 'reserved',
1446 'altLabels': 'reserved',
1447 'altIcons': 'reserved',
1448 'altTarget': 'reserved',
1449 'altText': 'reserved',
1450 'altUrl': 'reserved',
1451 'altUrl_noDefaultParams': 'reserved',
1452 'altWrap': 'reserved',
1453 'always': 'reserved',
1454 'alwaysActivePIDlist': 'reserved',
1455 'alwaysLink': 'reserved',
1456 'alwaysShowClickMenuInTopFrame': 'reserved',
1457 'andWhere': 'reserved',
1458 'angle': 'reserved',
1459 'antiAlias': 'reserved',
1460 'append': 'reserved',
1461 'applyTotalH': 'reserved',
1462 'applyTotalW': 'reserved',
1463 'archive': 'reserved',
1464 'archiveTypoLink': 'reserved',
1465 'arrayReturnMode': 'reserved',
1466 'arrowACT': 'reserved',
1467 'arrowImgParams': 'reserved',
1468 'arrowNO': 'reserved',
1469 'ATagAfterWrap': 'reserved',
1470 'ATagBeforeWrap': 'reserved',
1471 'ATagParams': 'reserved',
1472 'ATagTitle': 'reserved',
1473 'attribute': 'reserved',
1474 'autoLevels': 'reserved',
1475 'autonumber': 'reserved',
1476 'backColor': 'reserved',
1477 'background': 'reserved',
1478 'badMess': 'reserved',
1479 'baseURL': 'reserved',
1480 'before': 'reserved',
1481 'beforeImg': 'reserved',
1482 'beforeImgLink': 'reserved',
1483 'beforeImgTagParams': 'reserved',
1484 'beforeROImg': 'reserved',
1485 'beforeWrap': 'reserved',
1486 'begin': 'reserved',
1487 'beLoginLinkIPList': 'reserved',
1488 'beLoginLinkIPList_login': 'reserved',
1489 'beLoginLinkIPList_logout': 'reserved',
1490 'bgCol': 'reserved',
1491 'bgImg': 'reserved',
1492 'blankStrEqFalse': 'reserved',
1493 'blur': 'reserved',
1494 'bm': 'reserved',
1495 'bodyTag': 'reserved',
1496 'bodyTagAdd': 'reserved',
1497 'bodyTagCObject': 'reserved',
1498 'bodyTagMargins': 'reserved',
1499 'bodytext': 'reserved',
1500 'border': 'reserved',
1501 'borderCol': 'reserved',
1502 'bordersWithin': 'reserved',
1503 'borderThick': 'reserved',
1504 'bottomBackColor': 'reserved',
1505 'bottomContent': 'reserved',
1506 'bottomHeight': 'reserved',
1507 'bottomImg': 'reserved',
1508 'bottomImg_mask': 'reserved',
1509 'br': 'reserved',
1510 'brTag': 'reserved',
1511 'bullet': 'reserved',
1512 'bulletlist': 'reserved',
1513 'bytes': 'reserved',
1514 'cache_clearAtMidnight': 'reserved',
1515 'cache_period': 'reserved',
1516 'caption': 'reserved',
1517 'caption_stdWrap': 'reserved',
1518 'captionAlign': 'reserved',
1519 'captionHeader': 'reserved',
1520 'captionSplit': 'reserved',
1521 'case': 'reserved',
1522 'casesensitiveComp': 'reserved',
1523 'cellpadding': 'reserved',
1524 'cellspacing': 'reserved',
1525 'centerImgACT': 'reserved',
1526 'centerImgCUR': 'reserved',
1527 'centerImgNO': 'reserved',
1528 'centerLeftImgACT': 'reserved',
1529 'centerLeftImgCUR': 'reserved',
1530 'centerLeftImgNO': 'reserved',
1531 'centerRightImgACT': 'reserved',
1532 'centerRightImgCUR': 'reserved',
1533 'centerRightImgNO': 'reserved',
1534 'char': 'reserved',
1535 'charcoal': 'reserved',
1536 'charMapConfig': 'reserved',
1537 'check': 'reserved',
1538 'class': 'reserved',
1539 'classesAnchor': 'reserved',
1540 'classesCharacter': 'reserved',
1541 'classesImage': 'reserved',
1542 'classesParagraph': 'reserved',
1543 'clear': 'reserved',
1544 'clearCache': 'reserved',
1545 'clearCache_disable': 'reserved',
1546 'clearCache_pageGrandParent': 'reserved',
1547 'clearCache_pageSiblingChildren': 'reserved',
1548 'clearCacheCmd': 'reserved',
1549 'clearCacheLevels': 'reserved',
1550 'clearCacheOfPages': 'reserved',
1551 'clickMenuTimeOut': 'reserved',
1552 'clickTitleMode': 'reserved',
1553 'clipboardNumberPads': 'reserved',
1554 'cMargins': 'reserved',
1555 'cObjNum': 'reserved',
1556 'collapse': 'reserved',
1557 'collections': 'reserved',
1558 'color': 'reserved',
1559 'color1': 'reserved',
1560 'color2': 'reserved',
1561 'color3': 'reserved',
1562 'color4': 'reserved',
1563 'colors': 'reserved',
1564 'colour': 'reserved',
1565 'colPos_list': 'reserved',
1566 'colRelations': 'reserved',
1567 'cols': 'reserved',
1568 'colSpace': 'reserved',
1569 'comment_auto': 'reserved',
1570 'commentWrap': 'reserved',
1571 'compensateFieldWidth': 'reserved',
1572 'compX': 'reserved',
1573 'compY': 'reserved',
1574 'conf': 'reserved',
1575 'constants': 'reserved',
1576 'content_from_pid_allowOutsideDomain': 'reserved',
1577 'contextMenu': 'reserved',
1578 'copyLevels': 'reserved',
1579 'count_HMENU_MENUOBJ': 'reserved',
1580 'count_menuItems': 'reserved',
1581 'count_MENUOBJ': 'reserved',
1582 'create': 'reserved',
1583 'createFoldersInEB': 'reserved',
1584 'crop': 'reserved',
1585 'csConv': 'reserved',
1586 'CSS_inlineStyle': 'reserved',
1587 'current': 'reserved',
1588 'curUid': 'reserved',
1589 'cWidth': 'reserved',
1590 'data': 'reserved',
1591 'dataWrap': 'reserved',
1592 'date': 'reserved',
1593 'date_stdWrap': 'reserved',
1594 'datePrefix': 'reserved',
1595 'debug': 'reserved',
1596 'debugData': 'reserved',
1597 'debugFunc': 'reserved',
1598 'debugItemConf': 'reserved',
1599 'debugRenumberedObject': 'reserved',
1600 'default': 'reserved',
1601 'defaultAlign': 'reserved',
1602 'defaultCmd': 'reserved',
1603 'defaultFileUploads': 'reserved',
1604 'defaultHeaderType': 'reserved',
1605 'defaultOutput': 'reserved',
1606 'defaults': 'reserved',
1607 'defaultType': 'reserved',
1608 'delete': 'reserved',
1609 'denyTags': 'reserved',
1610 'depth': 'reserved',
1611 'DESC': 'reserved',
1612 'dimensions': 'reserved',
1613 'direction': 'reserved',
1614 'directionLeft': 'reserved',
1615 'directionUp': 'reserved',
1616 'disableAdvanced': 'reserved',
1617 'disableAllHeaderCode': 'reserved',
1618 'disableAltText': 'reserved',
1619 'disableBodyTag': 'reserved',
1620 'disableCacheSelector': 'reserved',
1621 'disableCharsetHeader': 'reserved',
1622 'disabled': 'reserved',
1623 'disableDelete': 'reserved',
1624 'disableDocSelector': 'reserved',
1625 'disableHideAtCopy': 'reserved',
1626 'disableIconLinkToContextmenu': 'reserved',
1627 'disableItems': 'reserved',
1628 'disableNewContentElementWizard': 'reserved',
1629 'disableNoMatchingValueElement': 'reserved',
1630 'disablePageExternalUrl': 'reserved',
1631 'disablePrefixComment': 'reserved',
1632 'disablePrependAtCopy': 'reserved',
1633 'disableSearchBox': 'reserved',
1634 'disableSingleTableView': 'reserved',
1635 'disableTabInTextarea': 'reserved',
1636 'displayActiveOnLoad': 'reserved',
1637 'displayContent': 'reserved',
1638 'displayFieldIcons': 'reserved',
1639 'displayIcons': 'reserved',
1640 'displayMessages': 'reserved',
1641 'displayQueries': 'reserved',
1642 'displayRecord': 'reserved',
1643 'displayTimes': 'reserved',
1644 'distributeX': 'reserved',
1645 'distributeY': 'reserved',
1646 'DIV': 'reserved',
1647 'doctype': 'reserved',
1648 'doctypeSwitch': 'reserved',
1649 'doktype': 'reserved',
1650 'doNotLinkIt': 'reserved',
1651 'doNotShowLink': 'reserved',
1652 'doNotStripHTML': 'reserved',
1653 'dontCheckPid': 'reserved',
1654 'dontFollowMouse': 'reserved',
1655 'dontHideOnMouseUp': 'reserved',
1656 'dontLinkIfSubmenu': 'reserved',
1657 'dontShowPalettesOnFocusInAB': 'reserved',
1658 'dontWrapInTable': 'reserved',
1659 'doubleBrTag': 'reserved',
1660 'dWorkArea': 'reserved',
1661 'edge': 'reserved',
1662 'edit_docModuleUplaod': 'reserved',
1663 'edit_docModuleUpload': 'reserved',
1664 'edit_RTE': 'reserved',
1665 'editFieldsAtATime': 'reserved',
1666 'editFormsOnPage': 'reserved',
1667 'editIcons': 'reserved',
1668 'editNoPopup': 'reserved',
1669 'editPanel': 'reserved',
1670 'elements': 'reserved',
1671 'emailMeAtLogin': 'reserved',
1672 'emailMess': 'reserved',
1673 'emboss': 'reserved',
1674 'enable': 'reserved',
1675 'encapsLines': 'reserved',
1676 'encapsLinesStdWrap': 'reserved',
1677 'encapsTagList': 'reserved',
1678 'entryLevel': 'reserved',
1679 'equalH': 'reserved',
1680 'everybody': 'reserved',
1681 'excludeDoktypes': 'reserved',
1682 'excludeUidList': 'reserved',
1683 'expAll': 'reserved',
1684 'expand': 'reserved',
1685 'explode': 'reserved',
1686 'ext': 'reserved',
1687 'externalBlocks': 'reserved',
1688 'extTarget': 'reserved',
1689 'face': 'reserved',
1690 'fe_adminLib': 'reserved',
1691 'field': 'reserved',
1692 'fieldOrder': 'reserved',
1693 'fieldRequired': 'reserved',
1694 'fields': 'reserved',
1695 'fieldWrap': 'reserved',
1696 'file': 'reserved',
1697 'file1': 'reserved',
1698 'file2': 'reserved',
1699 'file3': 'reserved',
1700 'file4': 'reserved',
1701 'file5': 'reserved',
1702 'filelink': 'reserved',
1703 'filelist': 'reserved',
1704 'files': 'reserved',
1705 'firstLabel': 'reserved',
1706 'firstLabelGeneral': 'reserved',
1707 'fixAttrib': 'reserved',
1708 'flip': 'reserved',
1709 'flop': 'reserved',
1710 'folders': 'reserved',
1711 'foldSpeed': 'reserved',
1712 'foldTimer': 'reserved',
1713 'fontColor': 'reserved',
1714 'fontFile': 'reserved',
1715 'fontOffset': 'reserved',
1716 'fontSize': 'reserved',
1717 'fontSizeMultiplicator': 'reserved',
1718 'fontTag': 'reserved',
1719 'forceDisplayFieldIcons': 'reserved',
1720 'forceDisplayIcons': 'reserved',
1721 'forceTemplateParsing': 'reserved',
1722 'forceTypeValue': 'reserved',
1723 'format': 'reserved',
1724 'frame': 'reserved',
1725 'frameReloadIfNotInFrameset': 'reserved',
1726 'frameSet': 'reserved',
1727 'freezeMouseover': 'reserved',
1728 'ftu': 'reserved',
1729 'function': 'reserved',
1730 'gamma': 'reserved',
1731 'gapBgCol': 'reserved',
1732 'gapLineCol': 'reserved',
1733 'gapLineThickness': 'reserved',
1734 'gapWidth': 'reserved',
1735 'get': 'reserved',
1736 'getBorder': 'reserved',
1737 'getLeft': 'reserved',
1738 'getRight': 'reserved',
1739 'globalNesting': 'reserved',
1740 'goodMess': 'reserved',
1741 'gray': 'reserved',
1742 'group': 'reserved',
1743 'groupBy': 'reserved',
1744 'groupid': 'reserved',
1745 'header': 'reserved',
1746 'header_layout': 'reserved',
1747 'headerComment': 'reserved',
1748 'headerData': 'reserved',
1749 'headerSpace': 'reserved',
1750 'headTag': 'reserved',
1751 'height': 'reserved',
1752 'helpText': 'reserved',
1753 'hidden': 'reserved',
1754 'hiddenFields': 'reserved',
1755 'hide': 'reserved',
1756 'hideButCreateMap': 'reserved',
1757 'hideMenuTimer': 'reserved',
1758 'hideMenuWhenNotOver': 'reserved',
1759 'hidePStyleItems': 'reserved',
1760 'hideRecords': 'reserved',
1761 'hideSubmoduleIcons': 'reserved',
1762 'highColor': 'reserved',
1763 'history': 'reserved',
1764 'HTMLparser': 'reserved',
1765 'HTMLparser_tags': 'reserved',
1766 'htmlSpecialChars': 'reserved',
1767 'htmlTag_dir': 'reserved',
1768 'htmlTag_langKey': 'reserved',
1769 'htmlTag_setParams': 'reserved',
1770 'http': 'reserved',
1771 'icon': 'reserved',
1772 'icon_image_ext_list': 'reserved',
1773 'icon_link': 'reserved',
1774 'iconCObject': 'reserved',
1775 'ifEmpty': 'reserved',
1776 'image': 'reserved',
1777 'image_compression': 'reserved',
1778 'image_effects': 'reserved',
1779 'image_frames': 'reserved',
1780 'imageLinkWrap': 'reserved',
1781 'imagePath': 'reserved',
1782 'images': 'reserved',
1783 'imageWrapIfAny': 'reserved',
1784 'imgList': 'reserved',
1785 'imgMap': 'reserved',
1786 'imgMapExtras': 'reserved',
1787 'imgMax': 'reserved',
1788 'imgNameNotRandom': 'reserved',
1789 'imgNamePrefix': 'reserved',
1790 'imgObjNum': 'reserved',
1791 'imgParams': 'reserved',
1792 'imgPath': 'reserved',
1793 'imgStart': 'reserved',
1794 'import': 'reserved',
1795 'inc': 'reserved',
1796 'includeCSS': 'reserved',
1797 'includeLibrary': 'reserved',
1798 'includeNotInMenu': 'reserved',
1799 'incT3Lib_htmlmail': 'reserved',
1800 'index': 'reserved',
1801 'index_descrLgd': 'reserved',
1802 'index_enable': 'reserved',
1803 'index_externals': 'reserved',
1804 'inlineStyle2TempFile': 'reserved',
1805 'innerStdWrap': 'reserved',
1806 'innerStdWrap_all': 'reserved',
1807 'innerWrap': 'reserved',
1808 'innerWrap2': 'reserved',
1809 'input': 'reserved',
1810 'inputLevels': 'reserved',
1811 'insertClassesFromRTE': 'reserved',
1812 'insertData': 'reserved',
1813 'insertDmailerBoundaries': 'reserved',
1814 'intensity': 'reserved',
1815 'intTarget': 'reserved',
1816 'intval': 'reserved',
1817 'invert': 'reserved',
1818 'IProcFunc': 'reserved',
1819 'itemArrayProcFunc': 'reserved',
1820 'itemH': 'reserved',
1821 'items': 'reserved',
1822 'itemsProcFunc': 'reserved',
1823 'iterations': 'reserved',
1824 'join': 'reserved',
1825 'JSWindow': 'reserved',
1826 'JSwindow_params': 'reserved',
1827 'jumpurl': 'reserved',
1828 'jumpUrl': 'reserved',
1829 'jumpurl_enable': 'reserved',
1830 'jumpurl_mailto_disable': 'reserved',
1831 'jumpUrl_transferSession': 'reserved',
1832 'keep': 'reserved',
1833 'keepEntries': 'reserved',
1834 'keepNonMatchedTags': 'reserved',
1835 'key': 'reserved',
1836 'label': 'reserved',
1837 'labelStdWrap': 'reserved',
1838 'labelWrap': 'reserved',
1839 'lang': 'reserved',
1840 'language': 'reserved',
1841 'language_alt': 'reserved',
1842 'languageField': 'reserved',
1843 'layer_menu_id': 'reserved',
1844 'layerStyle': 'reserved',
1845 'left': 'reserved',
1846 'leftIcons': 'reserved',
1847 'leftImgACT': 'reserved',
1848 'leftImgCUR': 'reserved',
1849 'leftImgNO': 'reserved',
1850 'leftjoin': 'reserved',
1851 'leftOffset': 'reserved',
1852 'levels': 'reserved',
1853 'leveluid': 'reserved',
1854 'limit': 'reserved',
1855 'line': 'reserved',
1856 'lineColor': 'reserved',
1857 'lineThickness': 'reserved',
1858 'linkPrefix': 'reserved',
1859 'linkTitleToSelf': 'reserved',
1860 'linkVars': 'reserved',
1861 'linkWrap': 'reserved',
1862 'listNum': 'reserved',
1863 'listOnlyInSingleTableView': 'reserved',
1864 'lm': 'reserved',
1865 'locale_all': 'reserved',
1866 'localNesting': 'reserved',
1867 'locationData': 'reserved',
1868 'lockFilePath': 'reserved',
1869 'lockPosition': 'reserved',
1870 'lockPosition_addSelf': 'reserved',
1871 'lockPosition_adjust': 'reserved',
1872 'lockToIP': 'reserved',
1873 'longdescURL': 'reserved',
1874 'lowColor': 'reserved',
1875 'lower': 'reserved',
1876 'LR': 'reserved',
1877 'mailto': 'reserved',
1878 'main': 'reserved',
1879 'mainScript': 'reserved',
1880 'makelinks': 'reserved',
1881 'markerWrap': 'reserved',
1882 'mask': 'reserved',
1883 'max': 'reserved',
1884 'maxAge': 'reserved',
1885 'maxChars': 'reserved',
1886 'maxH': 'reserved',
1887 'maxHeight': 'reserved',
1888 'maxItems': 'reserved',
1889 'maxW': 'reserved',
1890 'maxWidth': 'reserved',
1891 'maxWInText': 'reserved',
1892 'mayNotCreateEditShortcuts': 'reserved',
1893 'menu_type': 'reserved',
1894 'menuBackColor': 'reserved',
1895 'menuHeight': 'reserved',
1896 'menuName': 'reserved',
1897 'menuOffset': 'reserved',
1898 'menuWidth': 'reserved',
1899 'message_page_is_being_generated': 'reserved',
1900 'message_preview': 'reserved',
1901 'meta': 'reserved',
1902 'metaCharset': 'reserved',
1903 'method': 'reserved',
1904 'min': 'reserved',
1905 'minH': 'reserved',
1906 'minItems': 'reserved',
1907 'minW': 'reserved',
1908 'mode': 'reserved',
1909 'moduleMenuCollapsable': 'reserved',
1910 'MP_defaults': 'reserved',
1911 'MP_disableTypolinkClosestMPvalue': 'reserved',
1912 'MP_mapRootPoints': 'reserved',
1913 'name': 'reserved',
1914 'navFrameResizable': 'reserved',
1915 'nesting': 'reserved',
1916 'netprintApplicationLink': 'reserved',
1917 'neverHideAtCopy': 'reserved',
1918 'newPageWiz': 'reserved',
1919 'newRecordFromTable': 'reserved',
1920 'newWindow': 'reserved',
1921 'newWizards': 'reserved',
1922 'next': 'reserved',
1923 'niceText': 'reserved',
1924 'nicetext': 'reserved',
1925 'no_cache': 'reserved',
1926 'no_search': 'reserved',
1927 'noAttrib': 'reserved',
1928 'noCache': 'reserved',
1929 'noCols': 'reserved',
1930 'noCreateRecordsLink': 'reserved',
1931 'noLink': 'reserved',
1932 'noMatchingValue_label': 'reserved',
1933 'nonCachedSubst': 'reserved',
1934 'nonTypoTagStdWrap': 'reserved',
1935 'nonTypoTagUserFunc': 'reserved',
1936 'nonWrappedTag': 'reserved',
1937 'noOrderBy': 'reserved',
1938 'noPageTitle': 'reserved',
1939 'noRows': 'reserved',
1940 'noScaleUp': 'reserved',
1941 'noStretchAndMarginCells': 'reserved',
1942 'noThumbsInEB': 'reserved',
1943 'noThumbsInRTEimageSelect': 'reserved',
1944 'noTrimWrap': 'reserved',
1945 'noValueInsert': 'reserved',
1946 'obj': 'reserved',
1947 'offset': 'reserved',
1948 'offsetWrap': 'reserved',
1949 'onlineWorkspaceInfo': 'reserved',
1950 'onlyCurrentPid': 'reserved',
1951 'opacity': 'reserved',
1952 'orderBy': 'reserved',
1953 'outerWrap': 'reserved',
1954 'outline': 'reserved',
1955 'outputLevels': 'reserved',
1956 'override': 'reserved',
1957 'overrideAttribs': 'reserved',
1958 'overrideId': 'reserved',
1959 'overridePageModule': 'reserved',
1960 'overrideWithExtension': 'reserved',
1961 'pageFrameObj': 'reserved',
1962 'pageGenScript': 'reserved',
1963 'pageTitleFirst': 'reserved',
1964 'parameter': 'reserved',
1965 'params': 'reserved',
1966 'parseFunc': 'reserved',
1967 'parser': 'reserved',
1968 'password': 'reserved',
1969 'path': 'reserved',
1970 'permissions': 'reserved',
1971 'pid_list': 'reserved',
1972 'pidInList': 'reserved',
1973 'pixelSpaceFontSizeRef': 'reserved',
1974 'plaintextLib': 'reserved',
1975 'plainTextStdWrap': 'reserved',
1976 'postCObject': 'reserved',
1977 'postLineBlanks': 'reserved',
1978 'postLineChar': 'reserved',
1979 'postLineLen': 'reserved',
1980 'postUserFunc': 'reserved',
1981 'postUserFuncInt': 'reserved',
1982 'preBlanks': 'reserved',
1983 'preCObject': 'reserved',
1984 'prefix': 'reserved',
1985 'prefixComment': 'reserved',
1986 'prefixLocalAnchors': 'reserved',
1987 'prefixRelPathWith': 'reserved',
1988 'preIfEmptyListNum': 'reserved',
1989 'preLineBlanks': 'reserved',
1990 'preLineChar': 'reserved',
1991 'preLineLen': 'reserved',
1992 'prepend': 'reserved',
1993 'preserveEntities': 'reserved',
1994 'preUserFunc': 'reserved',
1995 'prev': 'reserved',
1996 'previewBorder': 'reserved',
1997 'prevnextToSection': 'reserved',
1998 'printheader': 'reserved',
1999 'prioriCalc': 'reserved',
2000 'proc': 'reserved',
2001 'properties': 'reserved',
2002 'protect': 'reserved',
2003 'protectLvar': 'reserved',
2004 'publish_levels': 'reserved',
2005 'QEisDefault': 'reserved',
2006 'quality': 'reserved',
2007 'radio': 'reserved',
2008 'radioWrap': 'reserved',
2009 'range': 'reserved',
2010 'rawUrlEncode': 'reserved',
2011 'recipient': 'reserved',
2012 'recursive': 'reserved',
2013 'recursiveDelete': 'reserved',
2014 'redirect': 'reserved',
2015 'redirectToURL': 'reserved',
2016 'reduceColors': 'reserved',
2017 'references': 'reserved',
2018 'register': 'reserved',
2019 'relativeToParentLayer': 'reserved',
2020 'relativeToTriggerItem': 'reserved',
2021 'relPathPrefix': 'reserved',
2022 'remap': 'reserved',
2023 'remapTag': 'reserved',
2024 'removeBadHTML': 'reserved',
2025 'removeDefaultJS': 'reserved',
2026 'removeIfEquals': 'reserved',
2027 'removeIfFalse': 'reserved',
2028 'removeItems': 'reserved',
2029 'removeObjectsOfDummy': 'reserved',
2030 'removePrependedNumbers': 'reserved',
2031 'removeTags': 'reserved',
2032 'removeWrapping': 'reserved',
2033 'renderCharset': 'reserved',
2034 'renderWrap': 'reserved',
2035 'reset': 'reserved',
2036 'resources': 'reserved',
2037 'resultObj': 'reserved',
2038 'returnLast': 'reserved',
2039 'returnUrl': 'reserved',
2040 'rightImgACT': 'reserved',
2041 'rightImgCUR': 'reserved',
2042 'rightImgNO': 'reserved',
2043 'rightjoin': 'reserved',
2044 'rm': 'reserved',
2045 'rmTagIfNoAttrib': 'reserved',
2046 'RO_chBgColor': 'reserved',
2047 'rotate': 'reserved',
2048 'rows': 'reserved',
2049 'rowSpace': 'reserved',
2050 'RTEfullScreenWidth': 'reserved',
2051 'rules': 'reserved',
2052 'sample': 'reserved',
2053 'saveClipboard': 'reserved',
2054 'saveDocNew': 'reserved',
2055 'secondRow': 'reserved',
2056 'section': 'reserved',
2057 'sectionIndex': 'reserved',
2058 'select': 'reserved',
2059 'select_key': 'reserved',
2060 'selectFields': 'reserved',
2061 'separator': 'reserved',
2062 'set': 'reserved',
2063 'setContentToCurrent': 'reserved',
2064 'setCurrent': 'reserved',
2065 'setfixed': 'reserved',
2066 'setFixedHeight': 'reserved',
2067 'setFixedWidth': 'reserved',
2068 'setJS_mouseOver': 'reserved',
2069 'setJS_openPic': 'reserved',
2070 'setOnly': 'reserved',
2071 'shadow': 'reserved',
2072 'sharpen': 'reserved',
2073 'shear': 'reserved',
2074 'short': 'reserved',
2075 'shortcut': 'reserved',
2076 'shortcut_onEditId_dontSetPageTree': 'reserved',
2077 'shortcut_onEditId_keepExistingExpanded': 'reserved',
2078 'shortcutFrame': 'reserved',
2079 'shortcutGroups': 'reserved',
2080 'shortcutIcon': 'reserved',
2081 'show': 'reserved',
2082 'showAccessRestrictedPages': 'reserved',
2083 'showActive': 'reserved',
2084 'showClipControlPanelsDespiteOfCMlayers': 'reserved',
2085 'showFirst': 'reserved',
2086 'showHiddenPages': 'reserved',
2087 'showHiddenRecords': 'reserved',
2088 'showHistory': 'reserved',
2089 'showPageIdWithTitle': 'reserved',
2090 'showTagFreeClasses': 'reserved',
2091 'simulateDate': 'reserved',
2092 'simulateUserGroup': 'reserved',
2093 'singlePid': 'reserved',
2094 'site_author': 'reserved',
2095 'site_reserved': 'reserved',
2096 'sitetitle': 'reserved',
2097 'siteUrl': 'reserved',
2098 'size': 'reserved',
2099 'solarize': 'reserved',
2100 'sorting': 'reserved',
2101 'source': 'reserved',
2102 'space': 'reserved',
2103 'spaceAfter': 'reserved',
2104 'spaceBefore': 'reserved',
2105 'spaceBelowAbove': 'reserved',
2106 'spaceLeft': 'reserved',
2107 'spaceRight': 'reserved',
2108 'spacing': 'reserved',
2109 'spamProtectEmailAddresses': 'reserved',
2110 'spamProtectEmailAddresses_atSubst': 'reserved',
2111 'spamProtectEmailAddresses_lastDotSubst': 'reserved',
2112 'special': 'reserved',
2113 'splitChar': 'reserved',
2114 'splitRendering': 'reserved',
2115 'src': 'reserved',
2116 'startInTaskCenter': 'reserved',
2117 'stayFolded': 'reserved',
2118 'stdheader': 'reserved',
2119 'stdWrap': 'reserved',
2120 'stdWrap2': 'reserved',
2121 'strftime': 'reserved',
2122 'stripHtml': 'reserved',
2123 'styles': 'reserved',
2124 'stylesheet': 'reserved',
2125 'submenuObjSuffixes': 'reserved',
2126 'subMenuOffset': 'reserved',
2127 'submit': 'reserved',
2128 'subst_elementUid': 'reserved',
2129 'substMarksSeparately': 'reserved',
2130 'substring': 'reserved',
2131 'swirl': 'reserved',
2132 'sword': 'reserved',
2133 'sword_noMixedCase': 'reserved',
2134 'SWORD_PARAMS': 'reserved',
2135 'sword_standAlone': 'reserved',
2136 'sys_language_mode': 'reserved',
2137 'sys_language_overlay': 'reserved',
2138 'sys_language_softMergeIfNotBlank': 'reserved',
2139 'sys_language_uid': 'reserved',
2140 'table': 'reserved',
2141 'tableCellColor': 'reserved',
2142 'tableParams': 'reserved',
2143 'tables': 'reserved',
2144 'tableStdWrap': 'reserved',
2145 'tableStyle': 'reserved',
2146 'tableWidth': 'reserved',
2147 'tags': 'reserved',
2148 'target': 'reserved',
2149 'TDparams': 'reserved',
2150 'templateContent': 'reserved',
2151 'templateFile': 'reserved',
2152 'text': 'reserved',
2153 'textarea': 'reserved',
2154 'textMargin': 'reserved',
2155 'textMargin_outOfText': 'reserved',
2156 'textMaxLength': 'reserved',
2157 'textObjNum': 'reserved',
2158 'textPos': 'reserved',
2159 'textStyle': 'reserved',
2160 'thickness': 'reserved',
2161 'thumbnailsByDefault': 'reserved',
2162 'tile': 'reserved',
2163 'time_stdWrap': 'reserved',
2164 'tipafriendLib': 'reserved',
2165 'title': 'reserved',
2166 'titleLen': 'reserved',
2167 'titleTagFunction': 'reserved',
2168 'titleText': 'reserved',
2169 'tm': 'reserved',
2170 'token': 'reserved',
2171 'topOffset': 'reserved',
2172 'totalWidth': 'reserved',
2173 'transparentBackground': 'reserved',
2174 'transparentColor': 'reserved',
2175 'trim': 'reserved',
2176 'tsdebug_tree': 'reserved',
2177 'type': 'reserved',
2178 'typeNum': 'reserved',
2179 'types': 'reserved',
2180 'typolinkCheckRootline': 'reserved',
2181 'uidInList': 'reserved',
2182 'unset': 'reserved',
2183 'uploadFieldsInTopOfEB': 'reserved',
2184 'uploads': 'reserved',
2185 'upper': 'reserved',
2186 'useCacheHash': 'reserved',
2187 'useLargestItemX': 'reserved',
2188 'useLargestItemY': 'reserved',
2189 'user': 'reserved',
2190 'userdefined': 'reserved',
2191 'userfunction': 'reserved',
2192 'userid': 'reserved',
2193 'USERNAME_substToken': 'reserved',
2194 'userProc': 'reserved',
2195 'value': 'reserved',
2196 'valueArray': 'reserved',
2197 'wave': 'reserved',
2198 'where': 'reserved',
2199 'width': 'reserved',
2200 'wiz': 'reserved',
2201 'wordSpacing': 'reserved',
2202 'workArea': 'reserved',
2203 'wrap': 'reserved',
2204 'wrap1': 'reserved',
2205 'wrap2': 'reserved',
2206 'wrap3': 'reserved',
2207 'wrapAfterTags': 'reserved',
2208 'wrapAlign': 'reserved',
2209 'wrapFieldName': 'reserved',
2210 'wrapItemAndSub': 'reserved',
2211 'wrapNonWrappedLines': 'reserved',
2212 'wraps': 'reserved',
2213 'xhtml_cleaning': 'reserved',
2214 'xmlprologue': 'reserved',
2215 'xPosOffset': 'reserved',
2216 'yPosOffset': 'reserved',
2217
2218 'admPanel': 'keyword2',
2219 'alt_print': 'keyword2',
2220 'auth': 'keyword2',
2221 'browser': 'keyword2',
2222 'cache': 'keyword2',
2223 'CHECK': 'keyword2',
2224 'cObj': 'keyword2',
2225 'cObject': 'keyword2',
2226 'COMMENT': 'keyword2',
2227 'config': 'keyword2',
2228 'content': 'keyword2',
2229 'copy': 'keyword2',
2230 'CSS_inlineStyle': 'keyword2',
2231 'cut': 'keyword2',
2232 'dataArray': 'keyword2',
2233 'dayofmonth': 'keyword2',
2234 'dayofweek': 'keyword2',
2235 'db_list': 'keyword2',
2236 'device': 'keyword2',
2237 'dynCSS': 'keyword2',
2238 'edit': 'keyword2',
2239 'edit_access': 'keyword2',
2240 'edit_pageheader': 'keyword2',
2241 'folder': 'keyword2',
2242 'folderTree': 'keyword2',
2243 'foldoutMenu': 'keyword2',
2244 'Functions': 'keyword2',
2245 'gmenu_foldout': 'keyword2',
2246 'gmenu_layers': 'keyword2',
2247 'hostname': 'keyword2',
2248 'hour': 'keyword2',
2249 'imgList': 'keyword2',
2250 'imgResource': 'keyword2',
2251 'imgText': 'keyword2',
2252 'info': 'keyword2',
2253 'IP': 'keyword2',
2254 'jsmenu': 'keyword2',
2255 'JSwindow': 'keyword2',
2256 'LABEL': 'keyword2',
2257 'layout': 'keyword2',
2258 'lib': 'keyword2',
2259 'loginUser': 'keyword2',
2260 'marks': 'keyword2',
2261 'minute': 'keyword2',
2262 'mod': 'keyword2',
2263 'module': 'keyword2',
2264 'month': 'keyword2',
2265 'move_wizard': 'keyword2',
2266 'new': 'keyword2',
2267 'new_wizard': 'keyword2',
2268 'noResultObj': 'keyword2',
2269 'numRows': 'keyword2',
2270 'options': 'keyword2',
2271 'page': 'keyword2',
2272 'pageTree': 'keyword2',
2273 'paste': 'keyword2',
2274 'perms': 'keyword2',
2275 'PIDinRootline': 'keyword2',
2276 'PIDupinRootline': 'keyword2',
2277 'plugin': 'keyword2',
2278 'postform': 'keyword2',
2279 'postform_newThread': 'keyword2',
2280 'preview': 'keyword2',
2281 'publish': 'keyword2',
2282 'RADIO': 'keyword2',
2283 'renderObj': 'keyword2',
2284 'REQ': 'keyword2',
2285 'RTE': 'keyword2',
2286 'RTE_compliant': 'keyword2',
2287 'select': 'keyword2',
2288 'setup': 'keyword2',
2289 'split': 'keyword2',
2290 'stdWrap': 'keyword2',
2291 'subparts': 'keyword2',
2292 'system': 'keyword2',
2293 'temp': 'keyword2',
2294 'template': 'keyword2',
2295 'treeLevel': 'keyword2',
2296 'tsdebug': 'keyword2',
2297 'typolink': 'keyword2',
2298 'url': 'keyword2',
2299 'useragent': 'keyword2',
2300 'userFunc': 'keyword2',
2301 'version': 'keyword2',
2302 'view': 'keyword2',
2303 'workOnSubpart': 'keyword2',
2304
2305 'ACT': 'keyword3',
2306 'ACTIFSUB': 'keyword3',
2307 'ACTIFSUBRO': 'keyword',
2308 'ACTRO': 'keyword3',
2309 'all': 'keyword3',
2310 'arrowACT': 'keyword3',
2311 'arrowNO': 'keyword3',
2312 'ascii': 'keyword3',
2313 'atLeast': 'keyword3',
2314 'atMost': 'keyword3',
2315 'BE': 'keyword3',
2316 'be_groups': 'keyword3',
2317 'be_users': 'keyword3',
2318 'BOX': 'keyword3',
2319 'browse': 'keyword3',
2320 'bullets': 'keyword3',
2321 'CUR': 'keyword3',
2322 'CURIFSUB': 'keyword3',
2323 'CURIFSUBRO': 'keyword3',
2324 'CURRO': 'keyword3',
2325 'default': 'keyword3',
2326 'description': 'keyword3',
2327 'directory': 'keyword3',
2328 'directReturn': 'keyword3',
2329 'div': 'keyword3',
2330 'else': 'keyword3',
2331 'email': 'keyword3',
2332 'end': 'keyword3',
2333 'equals': 'keyword3',
2334 'external': 'keyword3',
2335 'false': 'keyword3',
2336 'FE': 'keyword3',
2337 'fe_groups': 'keyword3',
2338 'fe_users': 'keyword3',
2339 'feadmin': 'keyword3',
2340 'header': 'keyword3',
2341 'html': 'keyword3',
2342 'id': 'keyword3',
2343 'if': 'keyword3',
2344 'ifEmpty': 'keyword3',
2345 'IFSUB': 'keyword3',
2346 'IFSUBRO': 'keyword3',
2347 'image': 'keyword3',
2348 'inBranch': 'keyword3',
2349 'isFalse': 'keyword3',
2350 'isGreaterThan': 'keyword3',
2351 'isInList': 'keyword3',
2352 'isLessThan': 'keyword3',
2353 'isPositive': 'keyword3',
2354 'isTrue': 'keyword3',
2355 'keyword3': 'keyword3',
2356 'language': 'keyword3',
2357 'leveltitle': 'keyword3',
2358 'list': 'keyword3',
2359 'login': 'keyword3',
2360 'mailform': 'keyword3',
2361 'media': 'keyword3',
2362 'menu': 'keyword3',
2363 'mod': 'keyword3',
2364 'multimedia': 'keyword3',
2365 'negate': 'keyword3',
2366 'NEW': 'keyword3',
2367 'NO': 'keyword3',
2368 'none': 'keyword3',
2369 'pages': 'keyword3',
2370 'pages_language_overlay': 'keyword3',
2371 'parseFunc_RTE': 'keyword3',
2372 'pid': 'keyword3',
2373 'required': 'keyword3',
2374 'RO': 'keyword3',
2375 'rootline': 'keyword3',
2376 'script': 'keyword3',
2377 'search': 'keyword3',
2378 'shortcut': 'keyword3',
2379 'sitemap': 'keyword3',
2380 'SPC': 'keyword3',
2381 'sys_dmail': 'keyword3',
2382 'sys_domain': 'keyword3',
2383 'sys_filemounts': 'keyword3',
2384 'sys_note': 'keyword3',
2385 'sys_template': 'keyword3',
2386 'tabel': 'keyword3',
2387 'text': 'keyword3',
2388 'textpic': 'keyword3',
2389 'this': 'keyword3',
2390 'top': 'keyword3',
2391 'true': 'keyword3',
2392 'twice': 'keyword3',
2393 'uid': 'keyword3',
2394 'uniqueGlobal': 'keyword3',
2395 'uniqueLocal': 'keyword3',
2396 'unsetEmpty': 'keyword3',
2397 'updated': 'keyword3',
2398 'uploads': 'keyword3',
2399 'us': 'keyword3',
2400 'user_task': 'keyword3',
2401 'USERDEF1': 'keyword3',
2402 'USERDEF1RO': 'keyword3',
2403 'USERDEF2': 'keyword3',
2404 'USERDEF2RO': 'keyword3',
2405 'usergroup': 'keyword3',
2406 'USR': 'keyword3',
2407 'USRRO': 'keyword3',
2408 'web_func': 'keyword3',
2409 'web_info': 'keyword3',
2410 'web_layout': 'keyword3',
2411 'web_list': 'keyword3',
2412 'web_ts': 'keyword',
2413 'xhtml_strict': 'keyword3',
2414 'xhtml_trans': 'keyword3',
2415 'XY': 'keyword3',
2416 'ypMenu': 'keyword3'
2417 }
2418
2419 var tokenizeTypoScript = function() {
2420
2421 // Some helper regexp matchers.
2422 var isOperatorChar = matcher(/[\+\-\*\&\%\/=<>!\?]/);
2423 var isDigit = matcher(/[0-9]/);
2424 var isHexDigit = matcher(/[0-9A-Fa-f]/);
2425 var isWordChar = matcher(/[\w\$_]/);
2426
2427 function isWhiteSpace(ch) {
2428 // Unfortunately, IE's regexp matcher thinks non-breaking spaces
2429 // aren't whitespace. Also, in our scheme newlines are no
2430 // whitespace (they are another special case).
2431 return ch != "\n" && (ch == nbsp || /\s/.test(ch));
2432 }
2433
2434 // This function produces a MochiKit-style iterator that tokenizes
2435 // the output of the given stringstream (see stringstream.js).
2436 // Tokens are objects with a type, style, and value property. The
2437 // value contains the textual content of the token. Because this may
2438 // include trailing whitespace (for efficiency reasons), some
2439 // tokens, such a variable names, also have a name property
2440 // containing their actual textual value.
2441 return function(source) {
2442 // Produce a value to return. Automatically skips and includes any
2443 // whitespace. The base argument is prepended to the value
2444 // property and assigned to the name property -- this is used when
2445 // the caller has already extracted the text from the stream
2446 // himself.
2447 function result(type, style, base) {
2448 // nextWhile(isWhiteSpace); - comment thats line because needed for autocomplete
2449 var value = {
2450 type: type,
2451 style: style,
2452 value: (base ? base + source.get() : source.get())
2453 };
2454 if (base) {
2455 value.name = base;
2456 }
2457 return value;
2458 }
2459
2460 // Advance the text stream over characters for which test returns
2461 // true. (The characters that are 'consumed' like this can later
2462 // be retrieved by calling source.get()).
2463 function nextWhile(test) {
2464 var next;
2465 while ((next = source.peek()) && test(next)) {
2466 source.next();
2467 }
2468 }
2469
2470 // Advance the stream until the given character (not preceded by a
2471 // backslash) is encountered (or a newline is found).
2472 function nextUntilUnescaped(end) {
2473 var escaped = false;
2474 var next;
2475 while ((next = source.peek()) && next != "\n") {
2476 source.next();
2477 if (next == end && !escaped) {
2478 break;
2479 }
2480 escaped = next == "\\";
2481 }
2482 }
2483
2484 function readHexNumber() {
2485 source.next();
2486 // skip the 'x'
2487 nextWhile(isHexDigit);
2488 return result("number", "atom");
2489 }
2490
2491 function readNumber() {
2492 nextWhile(isDigit);
2493 return result("number", "atom");
2494 }
2495
2496 // Read a word, look it up in keywords. If not found, it is a
2497 // variable, otherwise it is a keyword of the type found.
2498 function readWord() {
2499 nextWhile(isWordChar);
2500 var word = source.get();
2501 var known = typoscriptWords.hasOwnProperty(word) && {
2502 type: 'keyword',
2503 style: typoscriptWords[word]
2504 };
2505 return known ?
2506 result(known.type, known.style, word) :
2507 result("variable", "other", word);
2508 }
2509
2510 function readRegexp() {
2511 nextUntilUnescaped("/");
2512 nextWhile(matcher(/[gi]/));
2513 return result("regexp", "string");
2514 }
2515
2516 // Mutli-line comments are tricky. We want to return the newlines
2517 // embedded in them as regular newline tokens, and then continue
2518 // returning a comment token for every line of the comment. So
2519 // some state has to be saved (inComment) to indicate whether we
2520 // are inside a /* */ sequence.
2521 function readMultilineComment(start) {
2522 this.inComment = true;
2523 var maybeEnd = (start == "*");
2524 while (true) {
2525 var next = source.peek();
2526 if (next == "\n") {
2527 break;
2528 }
2529 source.next();
2530 if (next == "/" && maybeEnd) {
2531 this.inComment = false;
2532 break;
2533 }
2534 maybeEnd = (next == "*");
2535 }
2536
2537 return result("comment", "ts-comment");
2538 }
2539
2540 // Fetch the next token. Dispatches on first character in the
2541 // stream, or first two characters when the first is a slash. The
2542 // || things are a silly trick to keep simple cases on a single
2543 // line.
2544 function next() {
2545 var token = null;
2546 var ch = source.next();
2547 if (ch == "\n") {
2548 token = {
2549 type: "newline",
2550 style: "whitespace",
2551 value: source.get()
2552 };
2553 this.inValue = false;
2554
2555 } else if (!this.inValue && this.inComment) {
2556 token = readMultilineComment.call(this, ch);
2557
2558 /*
2559 } else if (this.inValue) {
2560 token = nextUntilUnescaped(null) || {
2561 type: "value",
2562 style: "ts-value",
2563 value: source.get()
2564 };
2565 this.inValue = false;
2566 */
2567
2568 } else if (isWhiteSpace(ch)) {
2569 token = nextWhile(isWhiteSpace) || result("whitespace", "whitespace");
2570
2571 } else if (!this.inValue && (ch == "\"" || ch == "'")) {
2572 token = nextUntilUnescaped(ch) || result("string", "string");
2573
2574 } else if (
2575 (ch == "<" ||
2576 ch == ">" ||
2577 ch == "." ||
2578 (ch == "=" && source.peek() != "<")
2579 )
2580 && source.peek() != "\n" ) { // there must be some value behind the operator!
2581 this.inValue = true;
2582 token = result(ch, "ts-operator");
2583
2584 } else if (!this.inValue && ch == "[") {
2585 token = nextUntilUnescaped("]") || result("condition", "ts-condition");
2586
2587 // with punctuation, the type of the token is the symbol itself
2588 } else if (!this.inValue && /[\[\]\(\),;\:\.\<\>\=]/.test(ch)) {
2589 token = result(ch, "ts-operator");
2590
2591 } else if (!this.inValue && (ch == "{" || ch == "}")) {
2592 token = result(ch, "ts-operator curly-bracket");
2593
2594 } else if (!this.inValue && ch == "0" && (source.peek() == "x" || source.peek() == "X")) {
2595 token = readHexNumber();
2596
2597 } else if (!this.inValue && isDigit(ch)) {
2598 token = readNumber();
2599
2600 } else if (!this.inValue && ch == "/") {
2601 next = source.peek();
2602
2603 if (next == "*") {
2604 token = readMultilineComment.call(this, ch);
2605
2606 } else if (next == "/") {
2607 token = nextUntilUnescaped(null) || result("comment", "ts-comment");
2608
2609 } else if (this.regexp) {
2610 token = readRegexp();
2611
2612 } else {
2613 token = nextWhile(isOperatorChar) || result("operator", "ts-operator");
2614 }
2615
2616 } else if (!this.inValue && ch == "#") {
2617 token = nextUntilUnescaped(null) || result("comment", "ts-comment");
2618
2619 } else if (!this.inValue && isOperatorChar(ch)) {
2620 token = nextWhile(isOperatorChar) || result("operator", "ts-operator");
2621
2622 } else {
2623 token = readWord();
2624 if (this.inValue) {
2625 token.style += ' ts-value';
2626 }
2627 }
2628
2629 // JavaScript's syntax rules for when a slash might be the start
2630 // of a regexp and when it is just a division operator are kind
2631 // of non-obvious. This decides, based on the current token,
2632 // whether the next token could be a regular expression.
2633 if (token.style != "whitespace" && token != "comment") {
2634 this.regexp = token.type == "operator" || token.type == "keyword c" || token.type.match(/[\[{}\(,;:]/);
2635 }
2636 return token;
2637 }
2638
2639 // Wrap it in an iterator. The state (regexp and inComment) is
2640 // exposed because a parser will need to save it when making a
2641 // copy of its state.
2642 return {
2643 next: next,
2644 regexp: true,
2645 inComment: false,
2646 inValue: false
2647 };
2648 }
2649 } ();