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