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