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