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