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