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