0882a27f3a5e4d894b8bfd928932ec9367b13851
[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_showFieldHelp': '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 'splash': 'keyword3',
1061 'sys_dmail': 'keyword3',
1062 'sys_domain': 'keyword3',
1063 'sys_filemounts': 'keyword3',
1064 'sys_note': 'keyword3',
1065 'sys_template': 'keyword3',
1066 'tabel': 'keyword3',
1067 'text': 'keyword3',
1068 'textpic': 'keyword3',
1069 'this': 'keyword3',
1070 'top': 'keyword3',
1071 'true': 'keyword3',
1072 'twice': 'keyword3',
1073 'uid': 'keyword3',
1074 'uniqueGlobal': 'keyword3',
1075 'uniqueLocal': 'keyword3',
1076 'unsetEmpty': 'keyword3',
1077 'updated': 'keyword3',
1078 'uploads': 'keyword3',
1079 'us': 'keyword3',
1080 'user_task': 'keyword3',
1081 'USERDEF1': 'keyword3',
1082 'USERDEF1RO': 'keyword3',
1083 'USERDEF2': 'keyword3',
1084 'USERDEF2RO': 'keyword3',
1085 'usergroup': 'keyword3',
1086 'USR': 'keyword3',
1087 'USRRO': 'keyword3',
1088 'web_func': 'keyword3',
1089 'web_info': 'keyword3',
1090 'web_layout': 'keyword3',
1091 'web_list': 'keyword3',
1092 'web_ts': 'keyword',
1093 'xhtml_strict': 'keyword3',
1094 'xhtml_trans': 'keyword3',
1095 'XY': 'keyword3',
1096 'ypMenu': 'keyword3'
1097 }
1098
1099 var tokenizeTypoScript = function() {
1100
1101 // Some helper regexp matchers.
1102 var isOperatorChar = matcher(/[\+\-\*\&\%\/=<>!\?]/);
1103 var isDigit = matcher(/[0-9]/);
1104 var isHexDigit = matcher(/[0-9A-Fa-f]/);
1105 var isWordChar = matcher(/[\w\$_]/);
1106
1107 function isWhiteSpace(ch) {
1108 // Unfortunately, IE's regexp matcher thinks non-breaking spaces
1109 // aren't whitespace. Also, in our scheme newlines are no
1110 // whitespace (they are another special case).
1111 return ch != "\n" && (ch == nbsp || /\s/.test(ch));
1112 }
1113
1114 // This function produces a MochiKit-style iterator that tokenizes
1115 // the output of the given stringstream (see stringstream.js).
1116 // Tokens are objects with a type, style, and value property. The
1117 // value contains the textual content of the token. Because this may
1118 // include trailing whitespace (for efficiency reasons), some
1119 // tokens, such a variable names, also have a name property
1120 // containing their actual textual value.
1121 return function(source) {
1122 // Produce a value to return. Automatically skips and includes any
1123 // whitespace. The base argument is prepended to the value
1124 // property and assigned to the name property -- this is used when
1125 // the caller has already extracted the text from the stream
1126 // himself.
1127 function result(type, style, base) {
1128 // nextWhile(isWhiteSpace); - comment thats line because needed for autocomplete
1129 var value = {
1130 type: type,
1131 style: style,
1132 value: (base ? base + source.get() : source.get())
1133 };
1134 if (base) {
1135 value.name = base;
1136 }
1137 return value;
1138 }
1139
1140 // Advance the text stream over characters for which test returns
1141 // true. (The characters that are 'consumed' like this can later
1142 // be retrieved by calling source.get()).
1143 function nextWhile(test) {
1144 var next;
1145 while ((next = source.peek()) && test(next)) {
1146 source.next();
1147 }
1148 }
1149
1150 // Advance the stream until the given character (not preceded by a
1151 // backslash) is encountered (or a newline is found).
1152 function nextUntilUnescaped(end) {
1153 var escaped = false;
1154 var next;
1155 while ((next = source.peek()) && next != "\n") {
1156 source.next();
1157 if (next == end && !escaped) {
1158 break;
1159 }
1160 escaped = next == "\\";
1161 }
1162 }
1163
1164 function readHexNumber() {
1165 source.next();
1166 // skip the 'x'
1167 nextWhile(isHexDigit);
1168 return result("number", "atom");
1169 }
1170
1171 function readNumber() {
1172 nextWhile(isDigit);
1173 return result("number", "atom");
1174 }
1175
1176 // Read a word, look it up in keywords. If not found, it is a
1177 // variable, otherwise it is a keyword of the type found.
1178 function readWord() {
1179 nextWhile(isWordChar);
1180 var word = source.get();
1181 var known = typoscriptWords.hasOwnProperty(word) && {
1182 type: 'keyword',
1183 style: typoscriptWords[word]
1184 };
1185 return known ?
1186 result(known.type, known.style, word) :
1187 result("variable", "other", word);
1188 }
1189
1190 function readRegexp() {
1191 nextUntilUnescaped("/");
1192 nextWhile(matcher(/[gi]/));
1193 return result("regexp", "string");
1194 }
1195
1196 // Mutli-line comments are tricky. We want to return the newlines
1197 // embedded in them as regular newline tokens, and then continue
1198 // returning a comment token for every line of the comment. So
1199 // some state has to be saved (inComment) to indicate whether we
1200 // are inside a /* */ sequence.
1201 function readMultilineComment(start) {
1202 this.inComment = true;
1203 var maybeEnd = (start == "*");
1204 while (true) {
1205 var next = source.peek();
1206 if (next == "\n") {
1207 break;
1208 }
1209 source.next();
1210 if (next == "/" && maybeEnd) {
1211 this.inComment = false;
1212 break;
1213 }
1214 maybeEnd = (next == "*");
1215 }
1216
1217 return result("comment", "ts-comment");
1218 }
1219
1220 // Fetch the next token. Dispatches on first character in the
1221 // stream, or first two characters when the first is a slash. The
1222 // || things are a silly trick to keep simple cases on a single
1223 // line.
1224 function next() {
1225 var token = null;
1226 var ch = source.next();
1227 if (ch == "\n") {
1228 token = {
1229 type: "newline",
1230 style: "whitespace",
1231 value: source.get()
1232 };
1233 this.inValue = false;
1234
1235 } else if (!this.inValue && this.inComment) {
1236 token = readMultilineComment.call(this, ch);
1237
1238 /*
1239 } else if (this.inValue) {
1240 token = nextUntilUnescaped(null) || {
1241 type: "value",
1242 style: "ts-value",
1243 value: source.get()
1244 };
1245 this.inValue = false;
1246 */
1247
1248 } else if (isWhiteSpace(ch)) {
1249 token = nextWhile(isWhiteSpace) || result("whitespace", "whitespace");
1250
1251 } else if (!this.inValue && (ch == "\"" || ch == "'")) {
1252 token = nextUntilUnescaped(ch) || result("string", "string");
1253
1254 } else if (
1255 ( ch == "<" ||
1256 ch == ">" ||
1257 ( ch == "="
1258 && source.peek() != "<"
1259 )
1260 )
1261 && source.peek() != "\n" ) { // there must be some value behind the operator!
1262 this.inValue = true;
1263 token = result(ch, "ts-operator");
1264
1265 } else if (!this.inValue && ch == "[") {
1266 token = nextUntilUnescaped("]") || result("condition", "ts-condition");
1267
1268 // with punctuation, the type of the token is the symbol itself
1269 } else if (!this.inValue && /[\[\]\(\),;\:\.\<\>\=]/.test(ch)) {
1270 token = result(ch, "ts-operator");
1271
1272 } else if (!this.inValue && (ch == "{" || ch == "}")) {
1273 token = result(ch, "ts-operator curly-bracket");
1274
1275 } else if (!this.inValue && ch == "0" && (source.peek() == "x" || source.peek() == "X")) {
1276 token = readHexNumber();
1277
1278 } else if (!this.inValue && isDigit(ch)) {
1279 token = readNumber();
1280
1281 } else if (!this.inValue && ch == "/") {
1282 next = source.peek();
1283
1284 if (next == "*") {
1285 token = readMultilineComment.call(this, ch);
1286
1287 } else if (next == "/") {
1288 token = nextUntilUnescaped(null) || result("comment", "ts-comment");
1289
1290 } else if (this.regexp) {
1291 token = readRegexp();
1292
1293 } else {
1294 token = nextWhile(isOperatorChar) || result("operator", "ts-operator");
1295 }
1296
1297 } else if (!this.inValue && ch == "#") {
1298 token = nextUntilUnescaped(null) || result("comment", "ts-comment");
1299
1300 } else if (!this.inValue && isOperatorChar(ch)) {
1301 token = nextWhile(isOperatorChar) || result("operator", "ts-operator");
1302
1303 } else {
1304 token = readWord();
1305 if (this.inValue) {
1306 token.style += ' ts-value';
1307 }
1308 }
1309
1310 // JavaScript's syntax rules for when a slash might be the start
1311 // of a regexp and when it is just a division operator are kind
1312 // of non-obvious. This decides, based on the current token,
1313 // whether the next token could be a regular expression.
1314 if (token.style != "whitespace" && token != "comment") {
1315 this.regexp = token.type == "operator" || token.type == "keyword c" || token.type.match(/[\[{}\(,;:]/);
1316 }
1317 return token;
1318 }
1319
1320 // Wrap it in an iterator. The state (regexp and inComment) is
1321 // exposed because a parser will need to save it when making a
1322 // copy of its state.
1323 return {
1324 next: next,
1325 regexp: true,
1326 inComment: false,
1327 inValue: false
1328 };
1329 }
1330 } ();
1331 /* Tokenizer for TypoScript code
1332 *
1333 * based on tokenizejavascript.js by Marijn Haverbeke
1334 */
1335
1336 // List of "reserved" word in typoscript and a css-class
1337 var typoscriptWords = {
1338 '_CSS_DEFAULT_STYLE': 'keyword',
1339 '_DEFAULT_PI_VARS': 'keyword',
1340 '_GIFBUILDER': 'keyword',
1341 '_LOCAL_LANG': 'keyword',
1342 'CARRAY': 'keyword',
1343 'CASE': 'keyword',
1344 'CLEARGIF': 'keyword',
1345 'COA': 'keyword',
1346 'COA_INT': 'keyword',
1347 'COBJ_ARRAY': 'keyword',
1348 'COLUMNS': 'keyword',
1349 'CONFIG': 'keyword',
1350 'CONSTANTS': 'keyword',
1351 'CONTENT': 'keyword',
1352 'CTABLE': 'keyword',
1353 'CType': 'keyword',
1354 'DB': 'keyword',
1355 'DOCUMENT_BODY': 'keyword',
1356 'EDITPANEL': 'keyword',
1357 'EFFECT': 'keyword',
1358 'FILE': 'keyword',
1359 'FORM': 'keyword',
1360 'FRAME': 'keyword',
1361 'FRAMESET': 'keyword',
1362 'GIFBUILDER': 'keyword',
1363 'global': 'keyword',
1364 'globalString': 'keyword',
1365 'globalVar': 'keyword',
1366 'GMENU': 'keyword',
1367 'GMENU_FOLDOUT': 'keyword',
1368 'GMENU_LAYERS': 'keyword',
1369 'GP': 'keyword',
1370 'HMENU': 'keyword',
1371 'HRULER': 'keyword',
1372 'HTML': 'keyword',
1373 'IENV': 'keyword',
1374 'IMAGE': 'keyword',
1375 'IMG_RESOURCE': 'keyword',
1376 'IMGMENU': 'keyword',
1377 'IMGMENUITEM': 'keyword',
1378 'IMGTEXT': 'keyword',
1379 'INCLUDE_TYPOSCRIPT': 'keyword',
1380 'includeLibs': 'keyword',
1381 'JSMENU': 'keyword',
1382 'JSMENUITEM': 'keyword',
1383 'LIT': 'keyword',
1384 'LOAD_REGISTER': 'keyword',
1385 'META': 'keyword',
1386 'MULTIMEDIA': 'keyword',
1387 'OTABLE': 'keyword',
1388 'PAGE': 'keyword',
1389 'PAGE_TARGET': 'keyword',
1390 'PAGE_TSCONFIG_ID': 'keyword',
1391 'PAGE_TSCONFIG_IDLIST': 'keyword',
1392 'PAGE_TSCONFIG_STR': 'keyword',
1393 'RECORDS': 'keyword',
1394 'REMOTE_ADDR': 'keyword',
1395 'RESTORE_REGISTER': 'keyword',
1396 'RTE': 'keyword',
1397 'SEARCHRESULT': 'keyword',
1398 'SHARED': 'keyword',
1399 'TCAdefaults': 'keyword',
1400 'TCEFORM': 'keyword',
1401 'TCEMAIN': 'keyword',
1402 'TEMPLATE': 'keyword',
1403 'TEXT': 'keyword',
1404 'TMENU': 'keyword',
1405 'TMENU_LAYERS': 'keyword',
1406 'TMENUITEM': 'keyword',
1407 'TSFE': 'keyword',
1408 'USER': 'keyword',
1409 'USER_INT': 'keyword',
1410
1411 'userFunc': 'keyword',
1412
1413 '_offset': 'reserved',
1414 'absRefPrefix': 'reserved',
1415 'accessibility': 'reserved',
1416 'accessKey': 'reserved',
1417 'addAttributes': 'reserved',
1418 'addExtUrlsAndShortCuts': 'reserved',
1419 'addItems': 'reserved',
1420 'additionalHeaders': 'reserved',
1421 'additionalParams': 'reserved',
1422 'addParams': 'reserved',
1423 'addQueryString': 'reserved',
1424 'adjustItemsH': 'reserved',
1425 'adjustSubItemsH': 'reserved',
1426 'adminPanelStyles': 'reserved',
1427 'after': 'reserved',
1428 'afterImg': 'reserved',
1429 'afterImgLink': 'reserved',
1430 'afterImgTagParams': 'reserved',
1431 'afterROImg': 'reserved',
1432 'afterWrap': 'reserved',
1433 'age': 'reserved',
1434 'alertPopups': 'reserved',
1435 'align': 'reserved',
1436 'allow': 'reserved',
1437 'allowCaching': 'reserved',
1438 'allowedAttribs': 'reserved',
1439 'allowedClasses': 'reserved',
1440 'allowedCols': 'reserved',
1441 'allowedNewTables': 'reserved',
1442 'allowTags': 'reserved',
1443 'allowTVlisting': 'reserved',
1444 'allSaveFunctions': 'reserved',
1445 'allStdWrap': 'reserved',
1446 'allWrap': 'reserved',
1447 'alternateBgColors': 'reserved',
1448 'alternativeSortingField': 'reserved',
1449 'alternativeTempPath': 'reserved',
1450 'altImgResource': 'reserved',
1451 'altLabels': 'reserved',
1452 'altTarget': 'reserved',
1453 'altText': 'reserved',
1454 'altUrl': 'reserved',
1455 'altUrl_noDefaultParams': 'reserved',
1456 'altWrap': 'reserved',
1457 'always': 'reserved',
1458 'alwaysActivePIDlist': 'reserved',
1459 'alwaysLink': 'reserved',
1460 'alwaysShowClickMenuInTopFrame': 'reserved',
1461 'andWhere': 'reserved',
1462 'angle': 'reserved',
1463 'antiAlias': 'reserved',
1464 'append': 'reserved',
1465 'applyTotalH': 'reserved',
1466 'applyTotalW': 'reserved',
1467 'archive': 'reserved',
1468 'archiveTypoLink': 'reserved',
1469 'arrayReturnMode': 'reserved',
1470 'arrowACT': 'reserved',
1471 'arrowImgParams': 'reserved',
1472 'arrowNO': 'reserved',
1473 'ATagAfterWrap': 'reserved',
1474 'ATagBeforeWrap': 'reserved',
1475 'ATagParams': 'reserved',
1476 'ATagTitle': 'reserved',
1477 'attribute': 'reserved',
1478 'autoLevels': 'reserved',
1479 'autonumber': 'reserved',
1480 'backColor': 'reserved',
1481 'background': 'reserved',
1482 'badMess': 'reserved',
1483 'baseURL': 'reserved',
1484 'before': 'reserved',
1485 'beforeImg': 'reserved',
1486 'beforeImgLink': 'reserved',
1487 'beforeImgTagParams': 'reserved',
1488 'beforeROImg': 'reserved',
1489 'beforeWrap': 'reserved',
1490 'begin': 'reserved',
1491 'beLoginLinkIPList': 'reserved',
1492 'beLoginLinkIPList_login': 'reserved',
1493 'beLoginLinkIPList_logout': 'reserved',
1494 'bgCol': 'reserved',
1495 'bgImg': 'reserved',
1496 'blankStrEqFalse': 'reserved',
1497 'blur': 'reserved',
1498 'bm': 'reserved',
1499 'bodyTag': 'reserved',
1500 'bodyTagAdd': 'reserved',
1501 'bodyTagCObject': 'reserved',
1502 'bodyTagMargins': 'reserved',
1503 'bodytext': 'reserved',
1504 'border': 'reserved',
1505 'borderCol': 'reserved',
1506 'bordersWithin': 'reserved',
1507 'borderThick': 'reserved',
1508 'bottomBackColor': 'reserved',
1509 'bottomContent': 'reserved',
1510 'bottomHeight': 'reserved',
1511 'bottomImg': 'reserved',
1512 'bottomImg_mask': 'reserved',
1513 'br': 'reserved',
1514 'brTag': 'reserved',
1515 'bullet': 'reserved',
1516 'bulletlist': 'reserved',
1517 'bytes': 'reserved',
1518 'cache_clearAtMidnight': 'reserved',
1519 'cache_period': 'reserved',
1520 'caption': 'reserved',
1521 'caption_stdWrap': 'reserved',
1522 'captionAlign': 'reserved',
1523 'captionHeader': 'reserved',
1524 'captionSplit': 'reserved',
1525 'case': 'reserved',
1526 'casesensitiveComp': 'reserved',
1527 'cellpadding': 'reserved',
1528 'cellspacing': 'reserved',
1529 'centerImgACT': 'reserved',
1530 'centerImgCUR': 'reserved',
1531 'centerImgNO': 'reserved',
1532 'centerLeftImgACT': 'reserved',
1533 'centerLeftImgCUR': 'reserved',
1534 'centerLeftImgNO': 'reserved',
1535 'centerRightImgACT': 'reserved',
1536 'centerRightImgCUR': 'reserved',
1537 'centerRightImgNO': 'reserved',
1538 'char': 'reserved',
1539 'charcoal': 'reserved',
1540 'charMapConfig': 'reserved',
1541 'check': 'reserved',
1542 'class': 'reserved',
1543 'classesAnchor': 'reserved',
1544 'classesCharacter': 'reserved',
1545 'classesImage': 'reserved',
1546 'classesParagraph': 'reserved',
1547 'classicPageEditMode': 'reserved',
1548 'clear': 'reserved',
1549 'clearCache': 'reserved',
1550 'clearCache_disable': 'reserved',
1551 'clearCache_pageGrandParent': 'reserved',
1552 'clearCache_pageSiblingChildren': 'reserved',
1553 'clearCacheCmd': 'reserved',
1554 'clearCacheLevels': 'reserved',
1555 'clearCacheOfPages': 'reserved',
1556 'clickMenuTimeOut': 'reserved',
1557 'clickTitleMode': 'reserved',
1558 'clipboardNumberPads': 'reserved',
1559 'cMargins': 'reserved',
1560 'cObjNum': 'reserved',
1561 'collapse': 'reserved',
1562 'color': 'reserved',
1563 'color1': 'reserved',
1564 'color2': 'reserved',
1565 'color3': 'reserved',
1566 'color4': 'reserved',
1567 'colors': 'reserved',
1568 'colour': 'reserved',
1569 'colPos_list': 'reserved',
1570 'colRelations': 'reserved',
1571 'cols': 'reserved',
1572 'colSpace': 'reserved',
1573 'comment_auto': 'reserved',
1574 'commentWrap': 'reserved',
1575 'compensateFieldWidth': 'reserved',
1576 'compX': 'reserved',
1577 'compY': 'reserved',
1578 'condensedMode': 'reserved',
1579 'conf': 'reserved',
1580 'constants': 'reserved',
1581 'content_from_pid_allowOutsideDomain': 'reserved',
1582 'contextMenu': 'reserved',
1583 'copyLevels': 'reserved',
1584 'count_HMENU_MENUOBJ': 'reserved',
1585 'count_menuItems': 'reserved',
1586 'count_MENUOBJ': 'reserved',
1587 'create': 'reserved',
1588 'createFoldersInEB': 'reserved',
1589 'crop': 'reserved',
1590 'csConv': 'reserved',
1591 'CSS_inlineStyle': 'reserved',
1592 'current': 'reserved',
1593 'curUid': 'reserved',
1594 'cWidth': 'reserved',
1595 'data': 'reserved',
1596 'dataWrap': 'reserved',
1597 'date': 'reserved',
1598 'date_stdWrap': 'reserved',
1599 'datePrefix': 'reserved',
1600 'debug': 'reserved',
1601 'debugData': 'reserved',
1602 'debugFunc': 'reserved',
1603 'debugItemConf': 'reserved',
1604 'debugRenumberedObject': 'reserved',
1605 'default': 'reserved',
1606 'defaultAlign': 'reserved',
1607 'defaultCmd': 'reserved',
1608 'defaultFileUploads': 'reserved',
1609 'defaultHeaderType': 'reserved',
1610 'defaultOutput': 'reserved',
1611 'defaults': 'reserved',
1612 'defaultType': 'reserved',
1613 'delete': 'reserved',
1614 'denyTags': 'reserved',
1615 'depth': 'reserved',
1616 'DESC': 'reserved',
1617 'dimensions': 'reserved',
1618 'directionLeft': 'reserved',
1619 'directionUp': 'reserved',
1620 'disableAdvanced': 'reserved',
1621 'disableAllHeaderCode': 'reserved',
1622 'disableAltText': 'reserved',
1623 'disableBigButtons': '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_showFieldHelp': 'reserved',
1671 'edit_wideDocument': 'reserved',
1672 'editFieldsAtATime': 'reserved',
1673 'editFormsOnPage': 'reserved',
1674 'editIcons': 'reserved',
1675 'editNoPopup': 'reserved',
1676 'editPanel': 'reserved',
1677 'elements': 'reserved',
1678 'emailMeAtLogin': 'reserved',
1679 'emailMess': 'reserved',
1680 'emboss': 'reserved',
1681 'enable': 'reserved',
1682 'encapsLines': 'reserved',
1683 'encapsLinesStdWrap': 'reserved',
1684 'encapsTagList': 'reserved',
1685 'entryLevel': 'reserved',
1686 'equalH': 'reserved',
1687 'everybody': 'reserved',
1688 'excludeDoktypes': 'reserved',
1689 'excludeUidList': 'reserved',
1690 'expAll': 'reserved',
1691 'expand': 'reserved',
1692 'explode': 'reserved',
1693 'ext': 'reserved',
1694 'externalBlocks': 'reserved',
1695 'extTarget': 'reserved',
1696 'face': 'reserved',
1697 'fe_adminLib': 'reserved',
1698 'field': 'reserved',
1699 'fieldOrder': 'reserved',
1700 'fieldRequired': 'reserved',
1701 'fields': 'reserved',
1702 'fieldWrap': 'reserved',
1703 'file': 'reserved',
1704 'file1': 'reserved',
1705 'file2': 'reserved',
1706 'file3': 'reserved',
1707 'file4': 'reserved',
1708 'file5': 'reserved',
1709 'filelink': 'reserved',
1710 'filelist': 'reserved',
1711 'firstLabel': 'reserved',
1712 'firstLabelGeneral': 'reserved',
1713 'fixAttrib': 'reserved',
1714 'flip': 'reserved',
1715 'flop': 'reserved',
1716 'foldSpeed': 'reserved',
1717 'foldTimer': 'reserved',
1718 'fontColor': 'reserved',
1719 'fontFile': 'reserved',
1720 'fontOffset': 'reserved',
1721 'fontSize': 'reserved',
1722 'fontSizeMultiplicator': 'reserved',
1723 'fontTag': 'reserved',
1724 'forceDisplayFieldIcons': 'reserved',
1725 'forceDisplayIcons': 'reserved',
1726 'forceNoPopup': 'reserved',
1727 'forceTemplateParsing': 'reserved',
1728 'forceTypeValue': 'reserved',
1729 'format': 'reserved',
1730 'frame': 'reserved',
1731 'frameReloadIfNotInFrameset': 'reserved',
1732 'frameSet': 'reserved',
1733 'freezeMouseover': 'reserved',
1734 'ftu': 'reserved',
1735 'function': 'reserved',
1736 'gamma': 'reserved',
1737 'gapBgCol': 'reserved',
1738 'gapLineCol': 'reserved',
1739 'gapLineThickness': 'reserved',
1740 'gapWidth': 'reserved',
1741 'get': 'reserved',
1742 'getBorder': 'reserved',
1743 'getLeft': 'reserved',
1744 'getRight': 'reserved',
1745 'globalNesting': 'reserved',
1746 'goodMess': 'reserved',
1747 'gray': 'reserved',
1748 'group': 'reserved',
1749 'groupBy': 'reserved',
1750 'groupid': 'reserved',
1751 'header': 'reserved',
1752 'header_layout': 'reserved',
1753 'headerComment': 'reserved',
1754 'headerData': 'reserved',
1755 'headerSpace': 'reserved',
1756 'headTag': 'reserved',
1757 'height': 'reserved',
1758 'helpText': 'reserved',
1759 'hidden': 'reserved',
1760 'hiddenFields': 'reserved',
1761 'hide': 'reserved',
1762 'hideButCreateMap': 'reserved',
1763 'hideMenuTimer': 'reserved',
1764 'hideMenuWhenNotOver': 'reserved',
1765 'hidePStyleItems': 'reserved',
1766 'hideRecords': 'reserved',
1767 'hideSubmoduleIcons': 'reserved',
1768 'highColor': 'reserved',
1769 'history': 'reserved',
1770 'HTMLparser': 'reserved',
1771 'HTMLparser_tags': 'reserved',
1772 'htmlSpecialChars': 'reserved',
1773 'htmlTag_dir': 'reserved',
1774 'htmlTag_langKey': 'reserved',
1775 'htmlTag_setParams': 'reserved',
1776 'http': 'reserved',
1777 'icon': 'reserved',
1778 'icon_image_ext_list': 'reserved',
1779 'icon_link': 'reserved',
1780 'iconCObject': 'reserved',
1781 'ifEmpty': 'reserved',
1782 'image': 'reserved',
1783 'image_compression': 'reserved',
1784 'image_effects': 'reserved',
1785 'image_frames': 'reserved',
1786 'imageLinkWrap': 'reserved',
1787 'imagePath': 'reserved',
1788 'images': 'reserved',
1789 'imageWrapIfAny': 'reserved',
1790 'imgList': 'reserved',
1791 'imgMap': 'reserved',
1792 'imgMapExtras': 'reserved',
1793 'imgMax': 'reserved',
1794 'imgNameNotRandom': 'reserved',
1795 'imgNamePrefix': 'reserved',
1796 'imgObjNum': 'reserved',
1797 'imgParams': 'reserved',
1798 'imgPath': 'reserved',
1799 'imgStart': 'reserved',
1800 'import': 'reserved',
1801 'inc': 'reserved',
1802 'includeCSS': 'reserved',
1803 'includeLibrary': 'reserved',
1804 'includeNotInMenu': 'reserved',
1805 'incT3Lib_htmlmail': 'reserved',
1806 'index': 'reserved',
1807 'index_descrLgd': 'reserved',
1808 'index_enable': 'reserved',
1809 'index_externals': 'reserved',
1810 'inlineStyle2TempFile': 'reserved',
1811 'innerStdWrap': 'reserved',
1812 'innerStdWrap_all': 'reserved',
1813 'innerWrap': 'reserved',
1814 'innerWrap2': 'reserved',
1815 'input': 'reserved',
1816 'inputLevels': 'reserved',
1817 'insertClassesFromRTE': 'reserved',
1818 'insertData': 'reserved',
1819 'insertDmailerBoundaries': 'reserved',
1820 'intensity': 'reserved',
1821 'intTarget': 'reserved',
1822 'intval': 'reserved',
1823 'invert': 'reserved',
1824 'IProcFunc': 'reserved',
1825 'itemArrayProcFunc': 'reserved',
1826 'itemH': 'reserved',
1827 'items': 'reserved',
1828 'itemsProcFunc': 'reserved',
1829 'iterations': 'reserved',
1830 'join': 'reserved',
1831 'JSWindow': 'reserved',
1832 'JSwindow_params': 'reserved',
1833 'jumpurl': 'reserved',
1834 'jumpUrl': 'reserved',
1835 'jumpurl_enable': 'reserved',
1836 'jumpurl_mailto_disable': 'reserved',
1837 'jumpUrl_transferSession': 'reserved',
1838 'keep': 'reserved',
1839 'keepEntries': 'reserved',
1840 'keepNonMatchedTags': 'reserved',
1841 'key': 'reserved',
1842 'label': 'reserved',
1843 'labelStdWrap': 'reserved',
1844 'labelWrap': 'reserved',
1845 'lang': 'reserved',
1846 'language': 'reserved',
1847 'language_alt': 'reserved',
1848 'languageField': 'reserved',
1849 'layer_menu_id': 'reserved',
1850 'layerStyle': 'reserved',
1851 'left': 'reserved',
1852 'leftIcons': 'reserved',
1853 'leftImgACT': 'reserved',
1854 'leftImgCUR': 'reserved',
1855 'leftImgNO': 'reserved',
1856 'leftjoin': 'reserved',
1857 'leftOffset': 'reserved',
1858 'levels': 'reserved',
1859 'leveluid': 'reserved',
1860 'limit': 'reserved',
1861 'line': 'reserved',
1862 'lineColor': 'reserved',
1863 'lineThickness': 'reserved',
1864 'linkPrefix': 'reserved',
1865 'linkTitleToSelf': 'reserved',
1866 'linkVars': 'reserved',
1867 'linkWrap': 'reserved',
1868 'listNum': 'reserved',
1869 'listOnlyInSingleTableView': 'reserved',
1870 'lm': 'reserved',
1871 'locale_all': 'reserved',
1872 'localNesting': 'reserved',
1873 'locationData': 'reserved',
1874 'lockFilePath': 'reserved',
1875 'lockPosition': 'reserved',
1876 'lockPosition_addSelf': 'reserved',
1877 'lockPosition_adjust': 'reserved',
1878 'lockToIP': 'reserved',
1879 'longdescURL': 'reserved',
1880 'lowColor': 'reserved',
1881 'lower': 'reserved',
1882 'LR': 'reserved',
1883 'mailto': 'reserved',
1884 'main': 'reserved',
1885 'mainScript': 'reserved',
1886 'makelinks': 'reserved',
1887 'markerWrap': 'reserved',
1888 'mask': 'reserved',
1889 'max': 'reserved',
1890 'maxAge': 'reserved',
1891 'maxChars': 'reserved',
1892 'maxH': 'reserved',
1893 'maxHeight': 'reserved',
1894 'maxItems': 'reserved',
1895 'maxW': 'reserved',
1896 'maxWidth': 'reserved',
1897 'maxWInText': 'reserved',
1898 'mayNotCreateEditShortcuts': 'reserved',
1899 'menu_type': 'reserved',
1900 'menuBackColor': 'reserved',
1901 'menuHeight': 'reserved',
1902 'menuName': 'reserved',
1903 'menuOffset': 'reserved',
1904 'menuWidth': 'reserved',
1905 'message_page_is_being_generated': 'reserved',
1906 'message_preview': 'reserved',
1907 'meta': 'reserved',
1908 'metaCharset': 'reserved',
1909 'method': 'reserved',
1910 'min': 'reserved',
1911 'minH': 'reserved',
1912 'minItems': 'reserved',
1913 'minW': 'reserved',
1914 'mode': 'reserved',
1915 'moduleMenuCollapsable': 'reserved',
1916 'MP_defaults': 'reserved',
1917 'MP_disableTypolinkClosestMPvalue': 'reserved',
1918 'MP_mapRootPoints': 'reserved',
1919 'name': 'reserved',
1920 'navFrameResizable': 'reserved',
1921 'navFrameWidth': 'reserved',
1922 'nesting': 'reserved',
1923 'netprintApplicationLink': 'reserved',
1924 'neverHideAtCopy': 'reserved',
1925 'newPageWiz': 'reserved',
1926 'newRecordFromTable': 'reserved',
1927 'newWindow': 'reserved',
1928 'newWizards': 'reserved',
1929 'next': 'reserved',
1930 'niceText': 'reserved',
1931 'nicetext': 'reserved',
1932 'no_cache': 'reserved',
1933 'no_search': 'reserved',
1934 'noAttrib': 'reserved',
1935 'noCache': 'reserved',
1936 'noCols': 'reserved',
1937 'noCreateRecordsLink': 'reserved',
1938 'noLink': 'reserved',
1939 'noMatchingValue_label': 'reserved',
1940 'noMenuMode': 'reserved',
1941 'nonCachedSubst': 'reserved',
1942 'nonTypoTagStdWrap': 'reserved',
1943 'nonTypoTagUserFunc': 'reserved',
1944 'nonWrappedTag': 'reserved',
1945 'noOrderBy': 'reserved',
1946 'noPageTitle': 'reserved',
1947 'noRows': 'reserved',
1948 'noScaleUp': 'reserved',
1949 'noStretchAndMarginCells': 'reserved',
1950 'noThumbsInEB': 'reserved',
1951 'noThumbsInRTEimageSelect': 'reserved',
1952 'notification_email_charset': 'reserved',
1953 'notification_email_encoding': 'reserved',
1954 'notification_email_urlmode': 'reserved',
1955 'noTrimWrap': 'reserved',
1956 'noValueInsert': 'reserved',
1957 'obj': 'reserved',
1958 'offset': 'reserved',
1959 'offsetWrap': 'reserved',
1960 'onlineWorkspaceInfo': 'reserved',
1961 'onlyCurrentPid': 'reserved',
1962 'opacity': 'reserved',
1963 'orderBy': 'reserved',
1964 'outerWrap': 'reserved',
1965 'outline': 'reserved',
1966 'outputLevels': 'reserved',
1967 'override': 'reserved',
1968 'overrideAttribs': 'reserved',
1969 'overrideId': 'reserved',
1970 'overridePageModule': 'reserved',
1971 'overrideWithExtension': 'reserved',
1972 'pageFrameObj': 'reserved',
1973 'pageGenScript': 'reserved',
1974 'pageTitleFirst': 'reserved',
1975 'parameter': 'reserved',
1976 'params': 'reserved',
1977 'parseFunc': 'reserved',
1978 'parser': 'reserved',
1979 'password': 'reserved',
1980 'path': 'reserved',
1981 'permissions': 'reserved',
1982 'pid_list': 'reserved',
1983 'pidInList': 'reserved',
1984 'pixelSpaceFontSizeRef': 'reserved',
1985 'plaintextLib': 'reserved',
1986 'plainTextStdWrap': 'reserved',
1987 'postCObject': 'reserved',
1988 'postLineBlanks': 'reserved',
1989 'postLineChar': 'reserved',
1990 'postLineLen': 'reserved',
1991 'postUserFunc': 'reserved',
1992 'postUserFuncInt': 'reserved',
1993 'preBlanks': 'reserved',
1994 'preCObject': 'reserved',
1995 'prefix': 'reserved',
1996 'prefixComment': 'reserved',
1997 'prefixLocalAnchors': 'reserved',
1998 'prefixRelPathWith': 'reserved',
1999 'preIfEmptyListNum': 'reserved',
2000 'preLineBlanks': 'reserved',
2001 'preLineChar': 'reserved',
2002 'preLineLen': 'reserved',
2003 'prepend': 'reserved',
2004 'preserveEntities': 'reserved',
2005 'preUserFunc': 'reserved',
2006 'prev': 'reserved',
2007 'previewBorder': 'reserved',
2008 'prevnextToSection': 'reserved',
2009 'printheader': 'reserved',
2010 'prioriCalc': 'reserved',
2011 'proc': 'reserved',
2012 'properties': 'reserved',
2013 'protect': 'reserved',
2014 'protectLvar': 'reserved',
2015 'publish_levels': 'reserved',
2016 'QEisDefault': 'reserved',
2017 'quality': 'reserved',
2018 'radio': 'reserved',
2019 'radioWrap': 'reserved',
2020 'range': 'reserved',
2021 'rawUrlEncode': 'reserved',
2022 'recipient': 'reserved',
2023 'recursive': 'reserved',
2024 'recursiveDelete': 'reserved',
2025 'redirect': 'reserved',
2026 'redirectToURL': 'reserved',
2027 'reduceColors': 'reserved',
2028 'register': 'reserved',
2029 'relativeToParentLayer': 'reserved',
2030 'relativeToTriggerItem': 'reserved',
2031 'relPathPrefix': 'reserved',
2032 'remap': 'reserved',
2033 'remapTag': 'reserved',
2034 'removeBadHTML': 'reserved',
2035 'removeDefaultJS': 'reserved',
2036 'removeIfEquals': 'reserved',
2037 'removeIfFalse': 'reserved',
2038 'removeItems': 'reserved',
2039 'removeObjectsOfDummy': 'reserved',
2040 'removePrependedNumbers': 'reserved',
2041 'removeTags': 'reserved',
2042 'removeWrapping': 'reserved',
2043 'renderCharset': 'reserved',
2044 'renderWrap': 'reserved',
2045 'reset': 'reserved',
2046 'resources': 'reserved',
2047 'resultObj': 'reserved',
2048 'returnLast': 'reserved',
2049 'returnUrl': 'reserved',
2050 'rightImgACT': 'reserved',
2051 'rightImgCUR': 'reserved',
2052 'rightImgNO': 'reserved',
2053 'rightjoin': 'reserved',
2054 'rm': 'reserved',
2055 'rmTagIfNoAttrib': 'reserved',
2056 'RO_chBgColor': 'reserved',
2057 'rotate': 'reserved',
2058 'rows': 'reserved',
2059 'rowSpace': 'reserved',
2060 'RTEfullScreenWidth': 'reserved',
2061 'rules': 'reserved',
2062 'sample': 'reserved',
2063 'saveClipboard': 'reserved',
2064 'saveDocNew': 'reserved',
2065 'secondRow': 'reserved',
2066 'section': 'reserved',
2067 'sectionIndex': 'reserved',
2068 'select': 'reserved',
2069 'select_key': 'reserved',
2070 'selectFields': 'reserved',
2071 'separator': 'reserved',
2072 'set': 'reserved',
2073 'setContentToCurrent': 'reserved',
2074 'setCurrent': 'reserved',
2075 'setfixed': 'reserved',
2076 'setFixedHeight': 'reserved',
2077 'setFixedWidth': 'reserved',
2078 'setJS_mouseOver': 'reserved',
2079 'setJS_openPic': 'reserved',
2080 'setOnly': 'reserved',
2081 'shadow': 'reserved',
2082 'sharpen': 'reserved',
2083 'shear': 'reserved',
2084 'short': 'reserved',
2085 'shortcut': 'reserved',
2086 'shortcut_onEditId_dontSetPageTree': 'reserved',
2087 'shortcut_onEditId_keepExistingExpanded': 'reserved',
2088 'shortcutFrame': 'reserved',
2089 'shortcutGroups': 'reserved',
2090 'shortcutIcon': 'reserved',
2091 'show': 'reserved',
2092 'showAccessRestrictedPages': 'reserved',
2093 'showActive': 'reserved',
2094 'showClipControlPanelsDespiteOfCMlayers': 'reserved',
2095 'showFirst': 'reserved',
2096 'showHiddenPages': 'reserved',
2097 'showHiddenRecords': 'reserved',
2098 'showHistory': 'reserved',
2099 'showPageIdWithTitle': 'reserved',
2100 'showTagFreeClasses': 'reserved',
2101 'simulateDate': 'reserved',
2102 'simulateUserGroup': 'reserved',
2103 'singlePid': 'reserved',
2104 'site_author': 'reserved',
2105 'site_reserved': 'reserved',
2106 'sitetitle': 'reserved',
2107 'siteUrl': 'reserved',
2108 'size': 'reserved',
2109 'solarize': 'reserved',
2110 'sorting': 'reserved',
2111 'source': 'reserved',
2112 'space': 'reserved',
2113 'spaceAfter': 'reserved',
2114 'spaceBefore': 'reserved',
2115 'spaceBelowAbove': 'reserved',
2116 'spaceLeft': 'reserved',
2117 'spaceRight': 'reserved',
2118 'spacing': 'reserved',
2119 'spamProtectEmailAddresses': 'reserved',
2120 'spamProtectEmailAddresses_atSubst': 'reserved',
2121 'spamProtectEmailAddresses_lastDotSubst': 'reserved',
2122 'special': 'reserved',
2123 'splitChar': 'reserved',
2124 'splitRendering': 'reserved',
2125 'src': 'reserved',
2126 'startInTaskCenter': 'reserved',
2127 'stayFolded': 'reserved',
2128 'stdheader': 'reserved',
2129 'stdWrap': 'reserved',
2130 'stdWrap2': 'reserved',
2131 'strftime': 'reserved',
2132 'stripHtml': 'reserved',
2133 'styles': 'reserved',
2134 'stylesheet': 'reserved',
2135 'submenuObjSuffixes': 'reserved',
2136 'subMenuOffset': 'reserved',
2137 'submit': 'reserved',
2138 'subst_elementUid': 'reserved',
2139 'substMarksSeparately': 'reserved',
2140 'substring': 'reserved',
2141 'swirl': 'reserved',
2142 'sword': 'reserved',
2143 'sword_noMixedCase': 'reserved',
2144 'SWORD_PARAMS': 'reserved',
2145 'sword_standAlone': 'reserved',
2146 'sys_language_mode': 'reserved',
2147 'sys_language_overlay': 'reserved',
2148 'sys_language_softMergeIfNotBlank': 'reserved',
2149 'sys_language_uid': 'reserved',
2150 'table': 'reserved',
2151 'tableCellColor': 'reserved',
2152 'tableParams': 'reserved',
2153 'tables': 'reserved',
2154 'tableStdWrap': 'reserved',
2155 'tableStyle': 'reserved',
2156 'tableWidth': 'reserved',
2157 'tags': 'reserved',
2158 'target': 'reserved',
2159 'TDparams': 'reserved',
2160 'templateContent': 'reserved',
2161 'templateFile': 'reserved',
2162 'text': 'reserved',
2163 'textarea': 'reserved',
2164 'textMargin': 'reserved',
2165 'textMargin_outOfText': 'reserved',
2166 'textMaxLength': 'reserved',
2167 'textObjNum': 'reserved',
2168 'textPos': 'reserved',
2169 'textStyle': 'reserved',
2170 'thickness': 'reserved',
2171 'thumbnailsByDefault': 'reserved',
2172 'tile': 'reserved',
2173 'time_stdWrap': 'reserved',
2174 'tipafriendLib': 'reserved',
2175 'title': 'reserved',
2176 'titleLen': 'reserved',
2177 'titleTagFunction': 'reserved',
2178 'titleText': 'reserved',
2179 'tm': 'reserved',
2180 'token': 'reserved',
2181 'topOffset': 'reserved',
2182 'totalWidth': 'reserved',
2183 'transparentBackground': 'reserved',
2184 'transparentColor': 'reserved',
2185 'trim': 'reserved',
2186 'tsdebug_tree': 'reserved',
2187 'type': 'reserved',
2188 'typeNum': 'reserved',
2189 'types': 'reserved',
2190 'typolinkCheckRootline': 'reserved',
2191 'uidInList': 'reserved',
2192 'unset': 'reserved',
2193 'uploadFieldsInTopOfEB': 'reserved',
2194 'uploads': 'reserved',
2195 'upper': 'reserved',
2196 'useCacheHash': 'reserved',
2197 'useLargestItemX': 'reserved',
2198 'useLargestItemY': 'reserved',
2199 'user': 'reserved',
2200 'userdefined': 'reserved',
2201 'userfunction': 'reserved',
2202 'userid': 'reserved',
2203 'USERNAME_substToken': 'reserved',
2204 'userProc': 'reserved',
2205 'value': 'reserved',
2206 'valueArray': 'reserved',
2207 'wave': 'reserved',
2208 'where': 'reserved',
2209 'width': 'reserved',
2210 'wiz': 'reserved',
2211 'wordSpacing': 'reserved',
2212 'workArea': 'reserved',
2213 'wrap': 'reserved',
2214 'wrap1': 'reserved',
2215 'wrap2': 'reserved',
2216 'wrap3': 'reserved',
2217 'wrapAfterTags': 'reserved',
2218 'wrapAlign': 'reserved',
2219 'wrapFieldName': 'reserved',
2220 'wrapItemAndSub': 'reserved',
2221 'wrapNonWrappedLines': 'reserved',
2222 'wraps': 'reserved',
2223 'xhtml_cleaning': 'reserved',
2224 'xmlprologue': 'reserved',
2225 'xPosOffset': 'reserved',
2226 'yPosOffset': 'reserved',
2227
2228 'admPanel': 'keyword2',
2229 'alt_print': 'keyword2',
2230 'auth': 'keyword2',
2231 'browser': 'keyword2',
2232 'cache': 'keyword2',
2233 'CHECK': 'keyword2',
2234 'cObj': 'keyword2',
2235 'cObject': 'keyword2',
2236 'COMMENT': 'keyword2',
2237 'config': 'keyword2',
2238 'content': 'keyword2',
2239 'copy': 'keyword2',
2240 'CSS_inlineStyle': 'keyword2',
2241 'cut': 'keyword2',
2242 'dataArray': 'keyword2',
2243 'dayofmonth': 'keyword2',
2244 'dayofweek': 'keyword2',
2245 'db_list': 'keyword2',
2246 'device': 'keyword2',
2247 'dynCSS': 'keyword2',
2248 'edit': 'keyword2',
2249 'edit_access': 'keyword2',
2250 'edit_pageheader': 'keyword2',
2251 'folder': 'keyword2',
2252 'folderTree': 'keyword2',
2253 'foldoutMenu': 'keyword2',
2254 'Functions': 'keyword2',
2255 'gmenu_foldout': 'keyword2',
2256 'gmenu_layers': 'keyword2',
2257 'hostname': 'keyword2',
2258 'hour': 'keyword2',
2259 'imgList': 'keyword2',
2260 'imgResource': 'keyword2',
2261 'imgText': 'keyword2',
2262 'info': 'keyword2',
2263 'IP': 'keyword2',
2264 'jsmenu': 'keyword2',
2265 'JSwindow': 'keyword2',
2266 'LABEL': 'keyword2',
2267 'layout': 'keyword2',
2268 'lib': 'keyword2',
2269 'loginUser': 'keyword2',
2270 'marks': 'keyword2',
2271 'minute': 'keyword2',
2272 'mod': 'keyword2',
2273 'module': 'keyword2',
2274 'month': 'keyword2',
2275 'move_wizard': 'keyword2',
2276 'new': 'keyword2',
2277 'new_wizard': 'keyword2',
2278 'noResultObj': 'keyword2',
2279 'numRows': 'keyword2',
2280 'options': 'keyword2',
2281 'page': 'keyword2',
2282 'pageTree': 'keyword2',
2283 'paste': 'keyword2',
2284 'perms': 'keyword2',
2285 'PIDinRootline': 'keyword2',
2286 'PIDupinRootline': 'keyword2',
2287 'plugin': 'keyword2',
2288 'postform': 'keyword2',
2289 'postform_newThread': 'keyword2',
2290 'preview': 'keyword2',
2291 'publish': 'keyword2',
2292 'RADIO': 'keyword2',
2293 'renderObj': 'keyword2',
2294 'REQ': 'keyword2',
2295 'RTE': 'keyword2',
2296 'RTE_compliant': 'keyword2',
2297 'select': 'keyword2',
2298 'setup': 'keyword2',
2299 'split': 'keyword2',
2300 'stdWrap': 'keyword2',
2301 'subparts': 'keyword2',
2302 'system': 'keyword2',
2303 'temp': 'keyword2',
2304 'template': 'keyword2',
2305 'treeLevel': 'keyword2',
2306 'tsdebug': 'keyword2',
2307 'typolink': 'keyword2',
2308 'url': 'keyword2',
2309 'useragent': 'keyword2',
2310 'userFunc': 'keyword2',
2311 'version': 'keyword2',
2312 'view': 'keyword2',
2313 'workOnSubpart': 'keyword2',
2314
2315 'ACT': 'keyword3',
2316 'ACTIFSUB': 'keyword3',
2317 'ACTIFSUBRO': 'keyword',
2318 'ACTRO': 'keyword3',
2319 'all': 'keyword3',
2320 'arrowACT': 'keyword3',
2321 'arrowNO': 'keyword3',
2322 'ascii': 'keyword3',
2323 'atLeast': 'keyword3',
2324 'atMost': 'keyword3',
2325 'BE': 'keyword3',
2326 'be_groups': 'keyword3',
2327 'be_users': 'keyword3',
2328 'BOX': 'keyword3',
2329 'browse': 'keyword3',
2330 'bullets': 'keyword3',
2331 'CUR': 'keyword3',
2332 'CURIFSUB': 'keyword3',
2333 'CURIFSUBRO': 'keyword3',
2334 'CURRO': 'keyword3',
2335 'default': 'keyword3',
2336 'description': 'keyword3',
2337 'directory': 'keyword3',
2338 'directReturn': 'keyword3',
2339 'div': 'keyword3',
2340 'else': 'keyword3',
2341 'email': 'keyword3',
2342 'end': 'keyword3',
2343 'equals': 'keyword3',
2344 'external': 'keyword3',
2345 'false': 'keyword3',
2346 'FE': 'keyword3',
2347 'fe_groups': 'keyword3',
2348 'fe_users': 'keyword3',
2349 'feadmin': 'keyword3',
2350 'header': 'keyword3',
2351 'html': 'keyword3',
2352 'id': 'keyword3',
2353 'if': 'keyword3',
2354 'ifEmpty': 'keyword3',
2355 'IFSUB': 'keyword3',
2356 'IFSUBRO': 'keyword3',
2357 'image': 'keyword3',
2358 'inBranch': 'keyword3',
2359 'isFalse': 'keyword3',
2360 'isGreaterThan': 'keyword3',
2361 'isInList': 'keyword3',
2362 'isLessThan': 'keyword3',
2363 'isPositive': 'keyword3',
2364 'isTrue': 'keyword3',
2365 'keyword3': 'keyword3',
2366 'language': 'keyword3',
2367 'leveltitle': 'keyword3',
2368 'list': 'keyword3',
2369 'login': 'keyword3',
2370 'mailform': 'keyword3',
2371 'media': 'keyword3',
2372 'menu': 'keyword3',
2373 'mod': 'keyword3',
2374 'multimedia': 'keyword3',
2375 'negate': 'keyword3',
2376 'NEW': 'keyword3',
2377 'NO': 'keyword3',
2378 'none': 'keyword3',
2379 'pages': 'keyword3',
2380 'pages_language_overlay': 'keyword3',
2381 'parseFunc_RTE': 'keyword3',
2382 'pid': 'keyword3',
2383 'required': 'keyword3',
2384 'RO': 'keyword3',
2385 'rootline': 'keyword3',
2386 'script': 'keyword3',
2387 'search': 'keyword3',
2388 'shortcut': 'keyword3',
2389 'sitemap': 'keyword3',
2390 'SPC': 'keyword3',
2391 'splash': 'keyword3',
2392 'sys_dmail': 'keyword3',
2393 'sys_domain': 'keyword3',
2394 'sys_filemounts': 'keyword3',
2395 'sys_note': 'keyword3',
2396 'sys_template': 'keyword3',
2397 'tabel': 'keyword3',
2398 'text': 'keyword3',
2399 'textpic': 'keyword3',
2400 'this': 'keyword3',
2401 'top': 'keyword3',
2402 'true': 'keyword3',
2403 'twice': 'keyword3',
2404 'uid': 'keyword3',
2405 'uniqueGlobal': 'keyword3',
2406 'uniqueLocal': 'keyword3',
2407 'unsetEmpty': 'keyword3',
2408 'updated': 'keyword3',
2409 'uploads': 'keyword3',
2410 'us': 'keyword3',
2411 'user_task': 'keyword3',
2412 'USERDEF1': 'keyword3',
2413 'USERDEF1RO': 'keyword3',
2414 'USERDEF2': 'keyword3',
2415 'USERDEF2RO': 'keyword3',
2416 'usergroup': 'keyword3',
2417 'USR': 'keyword3',
2418 'USRRO': 'keyword3',
2419 'web_func': 'keyword3',
2420 'web_info': 'keyword3',
2421 'web_layout': 'keyword3',
2422 'web_list': 'keyword3',
2423 'web_ts': 'keyword',
2424 'xhtml_strict': 'keyword3',
2425 'xhtml_trans': 'keyword3',
2426 'XY': 'keyword3',
2427 'ypMenu': 'keyword3'
2428 }
2429
2430 var tokenizeTypoScript = function() {
2431
2432 // Some helper regexp matchers.
2433 var isOperatorChar = matcher(/[\+\-\*\&\%\/=<>!\?]/);
2434 var isDigit = matcher(/[0-9]/);
2435 var isHexDigit = matcher(/[0-9A-Fa-f]/);
2436 var isWordChar = matcher(/[\w\$_]/);
2437
2438 function isWhiteSpace(ch) {
2439 // Unfortunately, IE's regexp matcher thinks non-breaking spaces
2440 // aren't whitespace. Also, in our scheme newlines are no
2441 // whitespace (they are another special case).
2442 return ch != "\n" && (ch == nbsp || /\s/.test(ch));
2443 }
2444
2445 // This function produces a MochiKit-style iterator that tokenizes
2446 // the output of the given stringstream (see stringstream.js).
2447 // Tokens are objects with a type, style, and value property. The
2448 // value contains the textual content of the token. Because this may
2449 // include trailing whitespace (for efficiency reasons), some
2450 // tokens, such a variable names, also have a name property
2451 // containing their actual textual value.
2452 return function(source) {
2453 // Produce a value to return. Automatically skips and includes any
2454 // whitespace. The base argument is prepended to the value
2455 // property and assigned to the name property -- this is used when
2456 // the caller has already extracted the text from the stream
2457 // himself.
2458 function result(type, style, base) {
2459 // nextWhile(isWhiteSpace); - comment thats line because needed for autocomplete
2460 var value = {
2461 type: type,
2462 style: style,
2463 value: (base ? base + source.get() : source.get())
2464 };
2465 if (base) {
2466 value.name = base;
2467 }
2468 return value;
2469 }
2470
2471 // Advance the text stream over characters for which test returns
2472 // true. (The characters that are 'consumed' like this can later
2473 // be retrieved by calling source.get()).
2474 function nextWhile(test) {
2475 var next;
2476 while ((next = source.peek()) && test(next)) {
2477 source.next();
2478 }
2479 }
2480
2481 // Advance the stream until the given character (not preceded by a
2482 // backslash) is encountered (or a newline is found).
2483 function nextUntilUnescaped(end) {
2484 var escaped = false;
2485 var next;
2486 while ((next = source.peek()) && next != "\n") {
2487 source.next();
2488 if (next == end && !escaped) {
2489 break;
2490 }
2491 escaped = next == "\\";
2492 }
2493 }
2494
2495 function readHexNumber() {
2496 source.next();
2497 // skip the 'x'
2498 nextWhile(isHexDigit);
2499 return result("number", "atom");
2500 }
2501
2502 function readNumber() {
2503 nextWhile(isDigit);
2504 return result("number", "atom");
2505 }
2506
2507 // Read a word, look it up in keywords. If not found, it is a
2508 // variable, otherwise it is a keyword of the type found.
2509 function readWord() {
2510 nextWhile(isWordChar);
2511 var word = source.get();
2512 var known = typoscriptWords.hasOwnProperty(word) && {
2513 type: 'keyword',
2514 style: typoscriptWords[word]
2515 };
2516 return known ?
2517 result(known.type, known.style, word) :
2518 result("variable", "other", word);
2519 }
2520
2521 function readRegexp() {
2522 nextUntilUnescaped("/");
2523 nextWhile(matcher(/[gi]/));
2524 return result("regexp", "string");
2525 }
2526
2527 // Mutli-line comments are tricky. We want to return the newlines
2528 // embedded in them as regular newline tokens, and then continue
2529 // returning a comment token for every line of the comment. So
2530 // some state has to be saved (inComment) to indicate whether we
2531 // are inside a /* */ sequence.
2532 function readMultilineComment(start) {
2533 this.inComment = true;
2534 var maybeEnd = (start == "*");
2535 while (true) {
2536 var next = source.peek();
2537 if (next == "\n") {
2538 break;
2539 }
2540 source.next();
2541 if (next == "/" && maybeEnd) {
2542 this.inComment = false;
2543 break;
2544 }
2545 maybeEnd = (next == "*");
2546 }
2547
2548 return result("comment", "ts-comment");
2549 }
2550
2551 // Fetch the next token. Dispatches on first character in the
2552 // stream, or first two characters when the first is a slash. The
2553 // || things are a silly trick to keep simple cases on a single
2554 // line.
2555 function next() {
2556 var token = null;
2557 var ch = source.next();
2558 if (ch == "\n") {
2559 token = {
2560 type: "newline",
2561 style: "whitespace",
2562 value: source.get()
2563 };
2564 this.inValue = false;
2565
2566 } else if (!this.inValue && this.inComment) {
2567 token = readMultilineComment.call(this, ch);
2568
2569 /*
2570 } else if (this.inValue) {
2571 token = nextUntilUnescaped(null) || {
2572 type: "value",
2573 style: "ts-value",
2574 value: source.get()
2575 };
2576 this.inValue = false;
2577 */
2578
2579 } else if (isWhiteSpace(ch)) {
2580 token = nextWhile(isWhiteSpace) || result("whitespace", "whitespace");
2581
2582 } else if (!this.inValue && (ch == "\"" || ch == "'")) {
2583 token = nextUntilUnescaped(ch) || result("string", "string");
2584
2585 } else if (
2586 ( ch == "<" ||
2587 ch == ">" ||
2588 ( ch == "="
2589 && source.peek() != "<"
2590 )
2591 )
2592 && source.peek() != "\n" ) { // there must be some value behind the operator!
2593 this.inValue = true;
2594 token = result(ch, "ts-operator");
2595
2596 } else if (!this.inValue && ch == "[") {
2597 token = nextUntilUnescaped("]") || result("condition", "ts-condition");
2598
2599 // with punctuation, the type of the token is the symbol itself
2600 } else if (!this.inValue && /[\[\]\(\),;\:\.\<\>\=]/.test(ch)) {
2601 token = result(ch, "ts-operator");
2602
2603 } else if (!this.inValue && (ch == "{" || ch == "}")) {
2604 token = result(ch, "ts-operator curly-bracket");
2605
2606 } else if (!this.inValue && ch == "0" && (source.peek() == "x" || source.peek() == "X")) {
2607 token = readHexNumber();
2608
2609 } else if (!this.inValue && isDigit(ch)) {
2610 token = readNumber();
2611
2612 } else if (!this.inValue && ch == "/") {
2613 next = source.peek();
2614
2615 if (next == "*") {
2616 token = readMultilineComment.call(this, ch);
2617
2618 } else if (next == "/") {
2619 token = nextUntilUnescaped(null) || result("comment", "ts-comment");
2620
2621 } else if (this.regexp) {
2622 token = readRegexp();
2623
2624 } else {
2625 token = nextWhile(isOperatorChar) || result("operator", "ts-operator");
2626 }
2627
2628 } else if (!this.inValue && ch == "#") {
2629 token = nextUntilUnescaped(null) || result("comment", "ts-comment");
2630
2631 } else if (!this.inValue && isOperatorChar(ch)) {
2632 token = nextWhile(isOperatorChar) || result("operator", "ts-operator");
2633
2634 } else {
2635 token = readWord();
2636 if (this.inValue) {
2637 token.style += ' ts-value';
2638 }
2639 }
2640
2641 // JavaScript's syntax rules for when a slash might be the start
2642 // of a regexp and when it is just a division operator are kind
2643 // of non-obvious. This decides, based on the current token,
2644 // whether the next token could be a regular expression.
2645 if (token.style != "whitespace" && token != "comment") {
2646 this.regexp = token.type == "operator" || token.type == "keyword c" || token.type.match(/[\[{}\(,;:]/);
2647 }
2648 return token;
2649 }
2650
2651 // Wrap it in an iterator. The state (regexp and inComment) is
2652 // exposed because a parser will need to save it when making a
2653 // copy of its state.
2654 return {
2655 next: next,
2656 regexp: true,
2657 inComment: false,
2658 inValue: false
2659 };
2660 }
2661 } ();