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