From 77a9d6947b5123e84c891f4871506d646dd2d30d Mon Sep 17 00:00:00 2001 From: Benjamin Franzke <ben@bnf.dev> Date: Wed, 30 Aug 2023 11:19:39 +0200 Subject: [PATCH] [TASK] Migrate @typo3/t3editor/stream-parser/typoscript to TypeScript The parser originates from the original codemirror javascript-mode and therefore contains a lot of legacy and unneeded code. Code that is obviously unneded for TypoScript (like backticks (called "quasi") or function expressions are removed to reduce the amount of code that needs to be type-declared. Resolves: #101803 Related: #101783 Releases: main, 12.4 Change-Id: If048e8c914cad3953463e9af712908f0e84c5f8f Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/80852 Tested-by: Benjamin Franzke <ben@bnf.dev> Reviewed-by: Benjamin Franzke <ben@bnf.dev> Tested-by: core-ci <typo3@b13.com> --- .../t3editor/language/typoscript.ts | 7 +- .../t3editor/stream-parser/typoscript.ts | 1609 +++++++++++++++ Build/types/TYPO3/index.d.ts | 2 - .../Public/JavaScript/language/typoscript.js | 2 +- .../JavaScript/stream-parser/typoscript.js | 1770 +---------------- 5 files changed, 1628 insertions(+), 1762 deletions(-) create mode 100644 Build/Sources/TypeScript/t3editor/stream-parser/typoscript.ts diff --git a/Build/Sources/TypeScript/t3editor/language/typoscript.ts b/Build/Sources/TypeScript/t3editor/language/typoscript.ts index 2522a8a6c336..d14857f36f6a 100644 --- a/Build/Sources/TypeScript/t3editor/language/typoscript.ts +++ b/Build/Sources/TypeScript/t3editor/language/typoscript.ts @@ -1,7 +1,7 @@ import DocumentService from '@typo3/core/document-service'; import { StreamLanguage, LanguageSupport } from '@codemirror/language'; import { CompletionContext, CompletionResult } from '@codemirror/autocomplete'; -import { typoScriptStreamParser } from '@typo3/t3editor/stream-parser/typoscript'; +import { TypoScriptStreamParserFactory } from '@typo3/t3editor/stream-parser/typoscript'; import { TsCodeCompletion } from '@typo3/t3editor/autocomplete/ts-code-completion'; import { syntaxTree } from '@codemirror/language'; import type { SyntaxNodeRef } from '@lezer/common'; @@ -33,7 +33,10 @@ export interface CodeMirror5CompatibleCompletionState { * based on lezer.codemirror.net at some point. */ export function typoscript() { - const language = StreamLanguage.define(typoScriptStreamParser); + const language = StreamLanguage.define( + new TypoScriptStreamParserFactory().create() + ); + const completion = language.data.of({ autocomplete: complete diff --git a/Build/Sources/TypeScript/t3editor/stream-parser/typoscript.ts b/Build/Sources/TypeScript/t3editor/stream-parser/typoscript.ts new file mode 100644 index 000000000000..ae6e2afd7129 --- /dev/null +++ b/Build/Sources/TypeScript/t3editor/stream-parser/typoscript.ts @@ -0,0 +1,1609 @@ +import type { StringStream, StreamParser, IndentContext } from '@codemirror/language'; + +type Type = string; +type Value = string; +type Keyword = { + type: string, + style: 'keyword' +}; + +type CombinatorReturnType = boolean | undefined; +type CombinatorFunction = (type?: Type, value?: unknown) => CombinatorReturnType; +type CombinatorLexFunction = ((type?: Type, value?: unknown) => CombinatorReturnType) & { lex: true }; +type CC = CombinatorFunction | CombinatorLexFunction; + +type CX = { + state: State, + stream?: StringStream, + column: number, + marked: string, + style?: string, + cc: CC[] +} + +type LocalVars = { + name: string, + next: LocalVars +}; + +type Context = { + vars: LocalVars, + prev?: Context | null +} + +type State = { + tokenize: (stream: StringStream, state: State) => string | undefined; + lastType: Type, + cc: CC[], + lexical: TSLexical, + localVars: LocalVars, + context: Context, + indented: number, +}; + +class TSLexical { + public indented: number; + public column: number; + public type: Type; + public prev: TSLexical; + public info: number | string; + public align: boolean; + public pos: number | undefined; + + constructor(indented: number, column: number, type: Type, align: boolean, prev?: TSLexical, info?: number | string) { + this.indented = indented; + this.column = column; + this.type = type; + this.prev = prev; + this.info = info; + if (align != null) { + this.align = align; + } + } +} + +function expressionAllowed(stream: StringStream, state: State): boolean { + return ( + // eslint-disable-next-line no-useless-escape + /^(?:operator|sof|keyword c|case|new|export|default|[\[{}\(,;:]|=>)$/.test(state.lastType) + ); +} + +export class TypoScriptStreamParserFactory { + public create(): StreamParser<State> { + const wordRE = /[\w$\xa1-\uffff]/; + //const statementIndent = undefined; + const statementIndent = false; + const parserConfig: { name: string, localVars: LocalVars, doubleIndentSwitch: boolean } = { + name: 'typoscript', + localVars: undefined, + doubleIndentSwitch: false, + }; + + // Tokenizer + + const keywords = function(): Record<string, Keyword> { + function kw(type: string): Keyword { + return { type: type, style: 'keyword' }; + } + + const A = kw('keyword a'), B = kw('keyword b'); + + return { + '_CSS_DEFAULT_STYLE': kw('_CSS_DEFAULT_STYLE'), + '_LOCAL_LANG': kw('_LOCAL_LANG'), + '_offset': kw('_offset'), + 'absRefPrefix': kw('absRefPrefix'), + 'accessibility': kw('accessibility'), + 'ACT': B, + 'ACTIFSUB': B, + 'ACTIFSUBRO': kw('ACTIFSUBRO'), + 'ACTRO': B, + 'addAttributes': kw('addAttributes'), + 'addExtUrlsAndShortCuts': kw('addExtUrlsAndShortCuts'), + 'addItems': kw('addItems'), + 'additionalHeaders': kw('additionalHeaders'), + 'additionalParams': kw('additionalParams'), + 'addQueryString': kw('addQueryString'), + 'adjustItemsH': kw('adjustItemsH'), + 'adjustSubItemsH': kw('adjustSubItemsH'), + 'admPanel': A, + 'after': kw('after'), + 'afterImg': kw('afterImg'), + 'afterImgLink': kw('afterImgLink'), + 'afterImgTagParams': kw('afterImgTagParams'), + 'afterROImg': kw('afterROImg'), + 'afterWrap': kw('afterWrap'), + 'age': kw('age'), + 'alertPopups': kw('alertPopups'), + 'align': kw('align'), + 'all': B, + 'allow': kw('allow'), + 'allowCaching': kw('allowCaching'), + 'allowedAttribs': kw('allowedAttribs'), + 'allowedClasses': kw('allowedClasses'), + 'allowedCols': kw('allowedCols'), + 'allowedNewTables': kw('allowedNewTables'), + 'allowTags': kw('allowTags'), + 'allStdWrap': kw('allStdWrap'), + 'allWrap': kw('allWrap'), + 'alt_print': A, + 'alternativeSortingField': kw('alternativeSortingField'), + 'altIcons': kw('altIcons'), + 'altImgResource': kw('altImgResource'), + 'altLabels': kw('altLabels'), + 'altTarget': kw('altTarget'), + 'altText': kw('altText'), + 'altUrl': kw('altUrl'), + 'altUrl_noDefaultParams': kw('altUrl_noDefaultParams'), + 'altWrap': kw('altWrap'), + 'always': kw('always'), + 'alwaysActivePIDlist': kw('alwaysActivePIDlist'), + 'alwaysLink': kw('alwaysLink'), + 'andWhere': kw('andWhere'), + 'angle': kw('angle'), + 'antiAlias': kw('antiAlias'), + 'append': kw('append'), + 'applyTotalH': kw('applyTotalH'), + 'applyTotalW': kw('applyTotalW'), + 'archive': kw('archive'), + 'ascii': B, + 'ATagAfterWrap': kw('ATagAfterWrap'), + 'ATagBeforeWrap': kw('ATagBeforeWrap'), + 'ATagParams': kw('ATagParams'), + 'ATagTitle': kw('ATagTitle'), + 'atLeast': B, + 'atMost': B, + 'attribute': kw('attribute'), + 'auth': A, + 'autoLevels': kw('autoLevels'), + 'autonumber': kw('autonumber'), + 'backColor': kw('backColor'), + 'background': kw('background'), + 'baseURL': kw('baseURL'), + 'BE': B, + 'be_groups': B, + 'be_users': B, + 'before': kw('before'), + 'beforeImg': kw('beforeImg'), + 'beforeImgLink': kw('beforeImgLink'), + 'beforeImgTagParams': kw('beforeImgTagParams'), + 'beforeROImg': kw('beforeROImg'), + 'beforeWrap': kw('beforeWrap'), + 'begin': kw('begin'), + 'bgCol': kw('bgCol'), + 'bgImg': kw('bgImg'), + 'blur': kw('blur'), + 'bm': kw('bm'), + 'bodyTag': kw('bodyTag'), + 'bodyTagAdd': kw('bodyTagAdd'), + 'bodyTagCObject': kw('bodyTagCObject'), + 'bodytext': kw('bodytext'), + 'borderCol': kw('borderCol'), + 'borderThick': kw('borderThick'), + 'bottomBackColor': kw('bottomBackColor'), + 'bottomContent': kw('bottomContent'), + 'bottomHeight': kw('bottomHeight'), + 'bottomImg': kw('bottomImg'), + 'bottomImg_mask': kw('bottomImg_mask'), + 'BOX': B, + 'br': kw('br'), + 'browse': B, + 'browser': A, + 'brTag': kw('brTag'), + 'bullet': kw('bullet'), + 'bulletlist': kw('bulletlist'), + 'bullets': B, + 'bytes': kw('bytes'), + 'cache': A, + 'cache_clearAtMidnight': kw('cache_clearAtMidnight'), + 'cache_period': kw('cache_period'), + 'caption': kw('caption'), + 'caption_stdWrap': kw('caption_stdWrap'), + 'captionHeader': kw('captionHeader'), + 'captionSplit': kw('captionSplit'), + 'CARRAY': kw('CARRAY'), + 'CASE': kw('CASE'), + 'case': kw('case'), + 'casesensitiveComp': kw('casesensitiveComp'), + 'cellpadding': kw('cellpadding'), + 'cellspacing': kw('cellspacing'), + 'char': kw('char'), + 'charcoal': kw('charcoal'), + 'charMapConfig': kw('charMapConfig'), + 'CHECK': A, + 'check': kw('check'), + 'class': kw('class'), + 'classesAnchor': kw('classesAnchor'), + 'classesCharacter': kw('classesCharacter'), + 'classesImage': kw('classesImage'), + 'classesParagraph': kw('classesParagraph'), + 'clear': kw('clear'), + 'clearCache': kw('clearCache'), + 'clearCache_disable': kw('clearCache_disable'), + 'clearCache_pageGrandParent': kw('clearCache_pageGrandParent'), + 'clearCache_pageSiblingChildren': kw('clearCache_pageSiblingChildren'), + 'clearCacheCmd': kw('clearCacheCmd'), + 'clearCacheLevels': kw('clearCacheLevels'), + 'clearCacheOfPages': kw('clearCacheOfPages'), + 'clickTitleMode': kw('clickTitleMode'), + 'clipboardNumberPads': kw('clipboardNumberPads'), + 'cMargins': kw('cMargins'), + 'COA': kw('COA'), + 'COA_INT': kw('COA_INT'), + 'cObj': A, + 'COBJ_ARRAY': kw('COBJ_ARRAY'), + 'cObject': A, + 'cObjNum': kw('cObjNum'), + 'collapse': kw('collapse'), + 'collections': kw('collections'), + 'color': kw('color'), + 'color1': kw('color1'), + 'color2': kw('color2'), + 'color3': kw('color3'), + 'color4': kw('color4'), + 'colors': kw('colors'), + 'colour': kw('colour'), + 'colPos_list': kw('colPos_list'), + 'colRelations': kw('colRelations'), + 'cols': kw('cols'), + 'colSpace': kw('colSpace'), + 'COMMENT': A, + 'comment_auto': kw('comment_auto'), + 'commentWrap': kw('commentWrap'), + 'compX': kw('compX'), + 'compY': kw('compY'), + 'conf': kw('conf'), + 'CONFIG': kw('CONFIG'), + 'config': A, + 'CONSTANTS': kw('CONSTANTS'), + 'constants': kw('constants'), + 'CONTENT': kw('CONTENT'), + 'content': A, + 'contextMenu': kw('contextMenu'), + 'copy': A, + 'copyLevels': kw('copyLevels'), + 'count_HMENU_MENUOBJ': kw('count_HMENU_MENUOBJ'), + 'count_menuItems': kw('count_menuItems'), + 'count_MENUOBJ': kw('count_MENUOBJ'), + 'create': kw('create'), + 'crop': kw('crop'), + 'csConv': kw('csConv'), + 'CType': kw('CType'), + 'CUR': B, + 'CURIFSUB': B, + 'CURIFSUBRO': B, + 'current': kw('current'), + 'CURRO': B, + 'curUid': kw('curUid'), + 'cut': A, + 'cWidth': kw('cWidth'), + 'data': kw('data'), + 'dataArray': A, + 'dataWrap': kw('dataWrap'), + 'date': kw('date'), + 'date_stdWrap': kw('date_stdWrap'), + 'datePrefix': kw('datePrefix'), + 'dayofmonth': A, + 'dayofweek': A, + 'DB': kw('DB'), + 'db_list': A, + 'debug': kw('debug'), + 'debugData': kw('debugData'), + 'debugFunc': kw('debugFunc'), + 'debugItemConf': kw('debugItemConf'), + 'debugRenumberedObject': kw('debugRenumberedObject'), + 'default': B, + 'defaultAlign': kw('defaultAlign'), + 'defaultCmd': kw('defaultCmd'), + 'defaultHeaderType': kw('defaultHeaderType'), + 'defaultOutput': kw('defaultOutput'), + 'defaults': kw('defaults'), + 'defaultType': kw('defaultType'), + 'delete': kw('delete'), + 'denyTags': kw('denyTags'), + 'depth': kw('depth'), + 'DESC': kw('DESC'), + 'description': B, + 'dimensions': kw('dimensions'), + 'direction': kw('direction'), + 'directory': B, + 'directReturn': B, + 'disableAllHeaderCode': kw('disableAllHeaderCode'), + 'disableAltText': kw('disableAltText'), + 'disableBodyTag': kw('disableBodyTag'), + 'disabled': kw('disabled'), + 'disableDelete': kw('disableDelete'), + 'disableHideAtCopy': kw('disableHideAtCopy'), + 'disableItems': kw('disableItems'), + 'disableNoMatchingValueElement': kw('disableNoMatchingValueElement'), + 'disablePrefixComment': kw('disablePrefixComment'), + 'disablePrependAtCopy': kw('disablePrependAtCopy'), + 'disableSearchBox': kw('disableSearchBox'), + 'disableSingleTableView': kw('disableSingleTableView'), + 'displayContent': kw('displayContent'), + 'displayFieldIcons': kw('displayFieldIcons'), + 'displayIcons': kw('displayIcons'), + 'displayMessages': kw('displayMessages'), + 'displayRecord': kw('displayRecord'), + 'displayTimes': kw('displayTimes'), + 'distributeX': kw('distributeX'), + 'distributeY': kw('distributeY'), + 'div': B, + 'DIV': kw('DIV'), + 'doctype': kw('doctype'), + 'DOCUMENT_BODY': kw('DOCUMENT_BODY'), + 'doktype': kw('doktype'), + 'doNotLinkIt': kw('doNotLinkIt'), + 'doNotShowLink': kw('doNotShowLink'), + 'doNotStripHTML': kw('doNotStripHTML'), + 'dontCheckPid': kw('dontCheckPid'), + 'dontLinkIfSubmenu': kw('dontLinkIfSubmenu'), + 'dontWrapInTable': kw('dontWrapInTable'), + 'doubleBrTag': kw('doubleBrTag'), + 'dWorkArea': kw('dWorkArea'), + 'dynCSS': A, + 'edge': kw('edge'), + 'edit': A, + 'edit_access': A, + 'edit_docModuleUpload': kw('edit_docModuleUpload'), + 'EFFECT': kw('EFFECT'), + 'elements': kw('elements'), + 'else': B, + 'email': B, + 'emailMeAtLogin': kw('emailMeAtLogin'), + 'emailMess': kw('emailMess'), + 'emboss': kw('emboss'), + 'enable': kw('enable'), + 'encapsLines': kw('encapsLines'), + 'encapsLinesStdWrap': kw('encapsLinesStdWrap'), + 'encapsTagList': kw('encapsTagList'), + 'end': B, + 'entryLevel': kw('entryLevel'), + 'equalH': kw('equalH'), + 'equals': B, + 'everybody': kw('everybody'), + 'excludeDoktypes': kw('excludeDoktypes'), + 'excludeUidList': kw('excludeUidList'), + 'expAll': kw('expAll'), + 'expand': kw('expand'), + 'explode': kw('explode'), + 'ext': kw('ext'), + 'external': B, + 'externalBlocks': kw('externalBlocks'), + 'extTarget': kw('extTarget'), + 'face': kw('face'), + 'false': B, + 'FE': B, + 'fe_adminLib': kw('fe_adminLib'), + 'fe_groups': B, + 'fe_users': B, + 'feadmin': B, + 'field': kw('field'), + 'fieldName': kw('fieldName'), + 'fieldOrder': kw('fieldOrder'), + 'fieldRequired': kw('fieldRequired'), + 'fields': kw('fields'), + 'fieldWrap': kw('fieldWrap'), + 'file': kw('file'), + 'file1': kw('file1'), + 'file2': kw('file2'), + 'file3': kw('file3'), + 'file4': kw('file4'), + 'file5': kw('file5'), + 'FILES': kw('FILES'), + 'files': kw('files'), + 'firstLabel': kw('firstLabel'), + 'firstLabelGeneral': kw('firstLabelGeneral'), + 'fixAttrib': kw('fixAttrib'), + 'flip': kw('flip'), + 'flop': kw('flop'), + 'FLUIDTEMPLATE': kw('FLUIDTEMPLATE'), + 'folder': A, + 'folders': kw('folders'), + 'folderTree': A, + 'foldoutMenu': A, + 'fontColor': kw('fontColor'), + 'fontFile': kw('fontFile'), + 'fontOffset': kw('fontOffset'), + 'fontSize': kw('fontSize'), + 'fontSizeMultiplicator': kw('fontSizeMultiplicator'), + 'forceDisplayFieldIcons': kw('forceDisplayFieldIcons'), + 'forceDisplayIcons': kw('forceDisplayIcons'), + 'forceTemplateParsing': kw('forceTemplateParsing'), + 'forceTypeValue': kw('forceTypeValue'), + 'FORM': kw('FORM'), + 'format': kw('format'), + 'function': kw('function'), + 'Functions': A, + 'gamma': kw('gamma'), + 'gapBgCol': kw('gapBgCol'), + 'gapLineCol': kw('gapLineCol'), + 'gapLineThickness': kw('gapLineThickness'), + 'gapWidth': kw('gapWidth'), + 'get': kw('get'), + 'getBorder': kw('getBorder'), + 'getLeft': kw('getLeft'), + 'getRight': kw('getRight'), + 'GIFBUILDER': kw('GIFBUILDER'), + 'global': kw('global'), + 'globalNesting': kw('globalNesting'), + 'globalString': kw('globalString'), + 'globalVar': kw('globalVar'), + 'GP': kw('GP'), + 'gray': kw('gray'), + 'group': kw('group'), + 'groupBy': kw('groupBy'), + 'groupid': kw('groupid'), + 'header': B, + 'header_layout': kw('header_layout'), + 'headerComment': kw('headerComment'), + 'headerData': kw('headerData'), + 'headerSpace': kw('headerSpace'), + 'headTag': kw('headTag'), + 'height': kw('height'), + 'helpText': kw('helpText'), + 'hidden': kw('hidden'), + 'hiddenFields': kw('hiddenFields'), + 'hide': kw('hide'), + 'hideButCreateMap': kw('hideButCreateMap'), + 'hidePStyleItems': kw('hidePStyleItems'), + 'hideRecords': kw('hideRecords'), + 'highColor': kw('highColor'), + 'history': kw('history'), + 'HMENU': kw('HMENU'), + 'hostname': A, + 'hour': A, + 'HTML': kw('HTML'), + 'html': B, + 'HTMLparser': kw('HTMLparser'), + 'HTMLparser_tags': kw('HTMLparser_tags'), + 'htmlSpecialChars': kw('htmlSpecialChars'), + 'htmlTag_setParams': kw('htmlTag_setParams'), + 'http': kw('http'), + 'icon': kw('icon'), + 'icon_image_ext_list': kw('icon_image_ext_list'), + 'icon_link': kw('icon_link'), + 'iconCObject': kw('iconCObject'), + 'id': B, + 'IENV': kw('IENV'), + 'if': B, + 'ifEmpty': B, + 'IFSUB': B, + 'IFSUBRO': B, + 'IMAGE': kw('IMAGE'), + 'image': B, + 'image_frames': kw('image_frames'), + 'imageLinkWrap': kw('imageLinkWrap'), + 'imagePath': kw('imagePath'), + 'images': kw('images'), + 'imageWrapIfAny': kw('imageWrapIfAny'), + 'IMG_RESOURCE': kw('IMG_RESOURCE'), + 'imgList': A, + 'imgMap': kw('imgMap'), + 'imgMapExtras': kw('imgMapExtras'), + 'imgMax': kw('imgMax'), + 'imgNameNotRandom': kw('imgNameNotRandom'), + 'imgNamePrefix': kw('imgNamePrefix'), + 'imgObjNum': kw('imgObjNum'), + 'imgParams': kw('imgParams'), + 'imgPath': kw('imgPath'), + 'imgResource': A, + 'imgStart': kw('imgStart'), + 'IMGTEXT': kw('IMGTEXT'), + 'imgText': A, + 'import': kw('import'), + 'inBranch': B, + 'inc': kw('inc'), + 'INCLUDE_TYPOSCRIPT': kw('INCLUDE_TYPOSCRIPT'), + 'includeCSS': kw('includeCSS'), + 'includeLibrary': kw('includeLibrary'), + 'includeNotInMenu': kw('includeNotInMenu'), + 'index': kw('index'), + 'index_descrLgd': kw('index_descrLgd'), + 'index_enable': kw('index_enable'), + 'index_externals': kw('index_externals'), + 'info': A, + 'inlineStyle2TempFile': kw('inlineStyle2TempFile'), + 'innerStdWrap': kw('innerStdWrap'), + 'innerStdWrap_all': kw('innerStdWrap_all'), + 'innerWrap': kw('innerWrap'), + 'innerWrap2': kw('innerWrap2'), + 'input': kw('input'), + 'inputLevels': kw('inputLevels'), + 'insertData': kw('insertData'), + 'intensity': kw('intensity'), + 'intTarget': kw('intTarget'), + 'intval': kw('intval'), + 'invert': kw('invert'), + 'IP': A, + 'IProcFunc': kw('IProcFunc'), + 'isFalse': B, + 'isGreaterThan': B, + 'isInList': B, + 'isLessThan': B, + 'isPositive': B, + 'isTrue': B, + 'itemArrayProcFunc': kw('itemArrayProcFunc'), + 'itemH': kw('itemH'), + 'items': kw('items'), + 'itemsProcFunc': kw('itemsProcFunc'), + 'iterations': kw('iterations'), + 'join': kw('join'), + 'JSwindow': A, + 'JSWindow': kw('JSWindow'), + 'JSwindow_params': kw('JSwindow_params'), + 'keep': kw('keep'), + 'keepEntries': kw('keepEntries'), + 'keepNonMatchedTags': kw('keepNonMatchedTags'), + 'key': kw('key'), + 'keyword3': B, + 'LABEL': A, + 'label': kw('label'), + 'labelStdWrap': kw('labelStdWrap'), + 'labelWrap': kw('labelWrap'), + 'lang': kw('lang'), + 'languageField': kw('languageField'), + 'layout': A, + 'left': kw('left'), + 'leftjoin': kw('leftjoin'), + 'levels': kw('levels'), + 'leveltitle': B, + 'leveluid': kw('leveluid'), + 'lib': A, + 'limit': kw('limit'), + 'line': kw('line'), + 'lineColor': kw('lineColor'), + 'lineThickness': kw('lineThickness'), + 'linkPrefix': kw('linkPrefix'), + 'linkTitleToSelf': kw('linkTitleToSelf'), + 'linkVars': kw('linkVars'), + 'linkWrap': kw('linkWrap'), + 'list': B, + 'listNum': kw('listNum'), + 'listOnlyInSingleTableView': kw('listOnlyInSingleTableView'), + 'LIT': kw('LIT'), + 'lm': kw('lm'), + 'LOAD_REGISTER': kw('LOAD_REGISTER'), + 'locale_all': kw('locale_all'), + 'localNesting': kw('localNesting'), + 'locationData': kw('locationData'), + 'login': B, + 'loginUser': A, + 'lowColor': kw('lowColor'), + 'lower': kw('lower'), + 'LR': kw('LR'), + 'mailform': B, + 'mailto': kw('mailto'), + 'main': kw('main'), + 'makelinks': kw('makelinks'), + 'markerWrap': kw('markerWrap'), + 'marks': A, + 'mask': kw('mask'), + 'max': kw('max'), + 'maxAge': kw('maxAge'), + 'maxChars': kw('maxChars'), + 'maxH': kw('maxH'), + 'maxHeight': kw('maxHeight'), + 'maxItems': kw('maxItems'), + 'maxW': kw('maxW'), + 'maxWidth': kw('maxWidth'), + 'maxWInText': kw('maxWInText'), + 'media': B, + 'menu': B, + 'menuHeight': kw('menuHeight'), + 'menuName': kw('menuName'), + 'menuOffset': kw('menuOffset'), + 'menuWidth': kw('menuWidth'), + 'message_preview': kw('message_preview'), + 'META': kw('META'), + 'meta': kw('meta'), + 'method': kw('method'), + 'min': kw('min'), + 'minH': kw('minH'), + 'minItems': kw('minItems'), + 'minute': A, + 'minW': kw('minW'), + 'mod': B, + 'mode': kw('mode'), + 'module': A, + 'month': A, + 'move_wizard': A, + 'MP_defaults': kw('MP_defaults'), + 'MP_disableTypolinkClosestMPvalue': kw('MP_disableTypolinkClosestMPvalue'), + 'MP_mapRootPoints': kw('MP_mapRootPoints'), + 'MULTIMEDIA': kw('MULTIMEDIA'), + 'multimedia': B, + 'name': kw('name'), + 'negate': B, + 'nesting': kw('nesting'), + 'neverHideAtCopy': kw('neverHideAtCopy'), + 'new': A, + 'NEW': B, + 'new_wizard': A, + 'newPageWiz': kw('newPageWiz'), + 'newRecordFromTable': kw('newRecordFromTable'), + 'newWindow': kw('newWindow'), + 'newWizards': kw('newWizards'), + 'next': kw('next'), + 'niceText': kw('niceText'), + 'nicetext': kw('nicetext'), + 'NO': B, + 'no_cache': kw('no_cache'), + 'no_search': kw('no_search'), + 'noAttrib': kw('noAttrib'), + 'noCache': kw('noCache'), + 'noCreateRecordsLink': kw('noCreateRecordsLink'), + 'noLink': kw('noLink'), + 'noMatchingValue_label': kw('noMatchingValue_label'), + 'nonCachedSubst': kw('nonCachedSubst'), + 'none': B, + 'nonTypoTagStdWrap': kw('nonTypoTagStdWrap'), + 'nonTypoTagUserFunc': kw('nonTypoTagUserFunc'), + 'nonWrappedTag': kw('nonWrappedTag'), + 'noOrderBy': kw('noOrderBy'), + 'noPageTitle': kw('noPageTitle'), + 'noResultObj': A, + 'noThumbsInEB': kw('noThumbsInEB'), + 'noTrimWrap': kw('noTrimWrap'), + 'noValueInsert': kw('noValueInsert'), + 'numRows': A, + 'obj': kw('obj'), + 'offset': kw('offset'), + 'onlineWorkspaceInfo': kw('onlineWorkspaceInfo'), + 'onlyCurrentPid': kw('onlyCurrentPid'), + 'opacity': kw('opacity'), + 'options': A, + 'orderBy': kw('orderBy'), + 'outerWrap': kw('outerWrap'), + 'outline': kw('outline'), + 'outputLevels': kw('outputLevels'), + 'override': kw('override'), + 'overrideAttribs': kw('overrideAttribs'), + 'overrideId': kw('overrideId'), + 'overridePageModule': kw('overridePageModule'), + 'PAGE': kw('PAGE'), + 'page': A, + 'PAGE_TARGET': kw('PAGE_TARGET'), + 'PAGE_TSCONFIG_ID': kw('PAGE_TSCONFIG_ID'), + 'PAGE_TSCONFIG_IDLIST': kw('PAGE_TSCONFIG_IDLIST'), + 'PAGE_TSCONFIG_STR': kw('PAGE_TSCONFIG_STR'), + 'pageFrameObj': kw('pageFrameObj'), + 'pages': B, + 'pageTitleFirst': kw('pageTitleFirst'), + 'pageTree': A, + 'parameter': kw('parameter'), + 'params': kw('params'), + 'parseFunc': kw('parseFunc'), + 'parseFunc_RTE': B, + 'parser': kw('parser'), + 'password': kw('password'), + 'paste': A, + 'path': kw('path'), + 'permissions': kw('permissions'), + 'perms': A, + 'pid': B, + 'pid_list': kw('pid_list'), + 'pidInList': kw('pidInList'), + 'PIDinRootline': A, + 'PIDupinRootline': A, + 'pixelSpaceFontSizeRef': kw('pixelSpaceFontSizeRef'), + 'plaintextLib': kw('plaintextLib'), + 'plainTextStdWrap': kw('plainTextStdWrap'), + 'plugin': A, + 'postCObject': kw('postCObject'), + 'postLineBlanks': kw('postLineBlanks'), + 'postLineChar': kw('postLineChar'), + 'postLineLen': kw('postLineLen'), + 'postUserFunc': kw('postUserFunc'), + 'postUserFuncInt': kw('postUserFuncInt'), + 'preBlanks': kw('preBlanks'), + 'preCObject': kw('preCObject'), + 'prefix': kw('prefix'), + 'prefixComment': kw('prefixComment'), + 'prefixRelPathWith': kw('prefixRelPathWith'), + 'preIfEmptyListNum': kw('preIfEmptyListNum'), + 'preLineBlanks': kw('preLineBlanks'), + 'preLineChar': kw('preLineChar'), + 'preLineLen': kw('preLineLen'), + 'prepend': kw('prepend'), + 'preserveEntities': kw('preserveEntities'), + 'preUserFunc': kw('preUserFunc'), + 'prev': kw('prev'), + 'preview': A, + 'previewBorder': kw('previewBorder'), + 'prevnextToSection': kw('prevnextToSection'), + 'prioriCalc': kw('prioriCalc'), + 'proc': kw('proc'), + 'processor_allowUpscaling': kw('processor_allowUpscaling'), + 'properties': kw('properties'), + 'protect': kw('protect'), + 'protectLvar': kw('protectLvar'), + 'publish': A, + 'publish_levels': kw('publish_levels'), + 'quality': kw('quality'), + 'RADIO': A, + 'radio': kw('radio'), + 'radioWrap': kw('radioWrap'), + 'range': kw('range'), + 'rawUrlEncode': kw('rawUrlEncode'), + 'recipient': kw('recipient'), + 'RECORDS': kw('RECORDS'), + 'recursive': kw('recursive'), + 'redirect': kw('redirect'), + 'redirectToURL': kw('redirectToURL'), + 'reduceColors': kw('reduceColors'), + 'references': kw('references'), + 'register': kw('register'), + 'relPathPrefix': kw('relPathPrefix'), + 'remap': kw('remap'), + 'remapTag': kw('remapTag'), + 'REMOTE_ADDR': kw('REMOTE_ADDR'), + 'removeDefaultJS': kw('removeDefaultJS'), + 'removeIfEquals': kw('removeIfEquals'), + 'removeIfFalse': kw('removeIfFalse'), + 'removeItems': kw('removeItems'), + 'removeObjectsOfDummy': kw('removeObjectsOfDummy'), + 'removePrependedNumbers': kw('removePrependedNumbers'), + 'removeTags': kw('removeTags'), + 'removeWrapping': kw('removeWrapping'), + 'renderObj': A, + 'renderWrap': kw('renderWrap'), + 'REQ': A, + 'required': B, + 'reset': kw('reset'), + 'resources': kw('resources'), + 'RESTORE_REGISTER': kw('RESTORE_REGISTER'), + 'resultObj': kw('resultObj'), + 'returnLast': kw('returnLast'), + 'returnUrl': kw('returnUrl'), + 'rightjoin': kw('rightjoin'), + 'rm': kw('rm'), + 'rmTagIfNoAttrib': kw('rmTagIfNoAttrib'), + 'RO': B, + 'rootline': B, + 'rotate': kw('rotate'), + 'rows': kw('rows'), + 'rowSpace': kw('rowSpace'), + 'RTE': A, + 'RTE_compliant': A, + 'rules': kw('rules'), + 'sample': kw('sample'), + 'saveClipboard': kw('saveClipboard'), + 'saveDocNew': kw('saveDocNew'), + 'script': B, + 'search': B, + 'SEARCHRESULT': kw('SEARCHRESULT'), + 'secondRow': kw('secondRow'), + 'section': kw('section'), + 'sectionIndex': kw('sectionIndex'), + 'select': A, + 'selectFields': kw('selectFields'), + 'separator': kw('separator'), + 'set': kw('set'), + 'setContentToCurrent': kw('setContentToCurrent'), + 'setCurrent': kw('setCurrent'), + 'setfixed': kw('setfixed'), + 'setOnly': kw('setOnly'), + 'setup': A, + 'shadow': kw('shadow'), + 'SHARED': kw('SHARED'), + 'sharpen': kw('sharpen'), + 'shear': kw('shear'), + 'short': kw('short'), + 'shortcut': B, + 'shortcutFrame': kw('shortcutFrame'), + 'shortcutIcon': kw('shortcutIcon'), + 'show': kw('show'), + 'showAccessRestrictedPages': kw('showAccessRestrictedPages'), + 'showActive': kw('showActive'), + 'showFirst': kw('showFirst'), + 'showHiddenPages': kw('showHiddenPages'), + 'showHiddenRecords': kw('showHiddenRecords'), + 'showHistory': kw('showHistory'), + 'showPageIdWithTitle': kw('showPageIdWithTitle'), + 'showTagFreeClasses': kw('showTagFreeClasses'), + 'showWebsiteTitle': kw('showWebsiteTitle'), + 'simulateDate': kw('simulateDate'), + 'simulateUserGroup': kw('simulateUserGroup'), + 'singlePid': kw('singlePid'), + 'site_author': kw('site_author'), + 'site_reserved': kw('site_reserved'), + 'sitemap': B, + 'siteUrl': kw('siteUrl'), + 'size': kw('size'), + 'solarize': kw('solarize'), + 'sorting': kw('sorting'), + 'source': kw('source'), + 'space': kw('space'), + 'spaceBelowAbove': kw('spaceBelowAbove'), + 'spaceLeft': kw('spaceLeft'), + 'spaceRight': kw('spaceRight'), + 'spacing': kw('spacing'), + 'spamProtectEmailAddresses': kw('spamProtectEmailAddresses'), + 'spamProtectEmailAddresses_atSubst': kw('spamProtectEmailAddresses_atSubst'), + 'spamProtectEmailAddresses_lastDotSubst': kw('spamProtectEmailAddresses_lastDotSubst'), + 'SPC': B, + 'special': kw('special'), + 'split': A, + 'splitChar': kw('splitChar'), + 'splitRendering': kw('splitRendering'), + 'src': kw('src'), + 'stdWrap': A, + 'stdWrap2': kw('stdWrap2'), + 'strftime': kw('strftime'), + 'stripHtml': kw('stripHtml'), + 'styles': kw('styles'), + 'submenuObjSuffixes': kw('submenuObjSuffixes'), + 'subMenuOffset': kw('subMenuOffset'), + 'submit': kw('submit'), + 'subparts': A, + 'subst_elementUid': kw('subst_elementUid'), + 'substMarksSeparately': kw('substMarksSeparately'), + 'substring': kw('substring'), + 'swirl': kw('swirl'), + 'sys_dmail': B, + 'sys_filemounts': B, + 'sys_note': B, + 'sys_template': B, + 'system': A, + 'table': B, + 'tableCellColor': kw('tableCellColor'), + 'tableParams': kw('tableParams'), + 'tables': kw('tables'), + 'tableStdWrap': kw('tableStdWrap'), + 'tableWidth': kw('tableWidth'), + 'tags': kw('tags'), + 'target': kw('target'), + 'TCAdefaults': kw('TCAdefaults'), + 'TCEFORM': kw('TCEFORM'), + 'TCEMAIN': kw('TCEMAIN'), + 'TDparams': kw('TDparams'), + 'temp': A, + 'template': A, + 'templateContent': kw('templateContent'), + 'templateFile': kw('templateFile'), + 'TEXT': kw('TEXT'), + 'text': B, + 'textarea': kw('textarea'), + 'textMargin': kw('textMargin'), + 'textMargin_outOfText': kw('textMargin_outOfText'), + 'textMaxLength': kw('textMaxLength'), + 'textObjNum': kw('textObjNum'), + 'textpic': B, + 'textPos': kw('textPos'), + 'thickness': kw('thickness'), + 'this': B, + 'tile': kw('tile'), + 'time_stdWrap': kw('time_stdWrap'), + 'tipafriendLib': kw('tipafriendLib'), + 'title': kw('title'), + 'titleLen': kw('titleLen'), + 'titleText': kw('titleText'), + 'tm': kw('tm'), + 'TMENU': kw('TMENU'), + 'TMENUITEM': kw('TMENUITEM'), + 'token': kw('token'), + 'top': B, + 'totalWidth': kw('totalWidth'), + 'transparentBackground': kw('transparentBackground'), + 'transparentColor': kw('transparentColor'), + 'treeLevel': A, + 'trim': kw('trim'), + 'true': B, + 'tsdebug': A, + 'tsdebug_tree': kw('tsdebug_tree'), + 'TSFE': kw('TSFE'), + 'type': kw('type'), + 'typeNum': kw('typeNum'), + 'types': kw('types'), + 'typolink': A, + 'uid': B, + 'uidInList': kw('uidInList'), + 'uniqueGlobal': B, + 'uniqueLocal': B, + 'unset': kw('unset'), + 'unsetEmpty': B, + 'updated': B, + 'uploads': B, + 'upper': kw('upper'), + 'url': A, + 'us': B, + 'useLargestItemX': kw('useLargestItemX'), + 'useLargestItemY': kw('useLargestItemY'), + 'USER': kw('USER'), + 'user': kw('user'), + 'USER_INT': kw('USER_INT'), + 'user_task': B, + 'useragent': A, + 'USERDEF1': B, + 'USERDEF1RO': B, + 'USERDEF2': B, + 'USERDEF2RO': B, + 'userdefined': kw('userdefined'), + 'userFunc': A, + 'userfunction': kw('userfunction'), + 'usergroup': B, + 'userid': kw('userid'), + 'userProc': kw('userProc'), + 'USR': B, + 'USRRO': B, + 'value': kw('value'), + 'valueArray': kw('valueArray'), + 'version': A, + 'view': A, + 'wave': kw('wave'), + 'web_func': B, + 'web_info': B, + 'web_layout': B, + 'web_list': B, + 'web_ts': kw('web_ts'), + 'where': kw('where'), + 'width': kw('width'), + 'wiz': kw('wiz'), + 'wordSpacing': kw('wordSpacing'), + 'workArea': kw('workArea'), + 'workOnSubpart': A, + 'wrap': kw('wrap'), + 'wrap1': kw('wrap1'), + 'wrap2': kw('wrap2'), + 'wrap3': kw('wrap3'), + 'wrapAfterTags': kw('wrapAfterTags'), + 'wrapAlign': kw('wrapAlign'), + 'wrapFieldName': kw('wrapFieldName'), + 'wrapItemAndSub': kw('wrapItemAndSub'), + 'wrapNonWrappedLines': kw('wrapNonWrappedLines'), + 'wraps': kw('wraps'), + 'xhtml_cleaning': kw('xhtml_cleaning'), + 'xhtml_strict': B, + 'xhtml_trans': B, + 'xmlprologue': kw('xmlprologue'), + 'XY': B + }; + }(); + + // eslint-disable-next-line no-useless-escape + const isOperatorChar = /[\+\-\*\&\%\/=<>!\?]/; + let inValue = false; + + function readRegexp(stream: StringStream) { + let escaped = false, next, inSet = false; + while ((next = stream.next()) != null) { + if (!escaped) { + if (next === '/' && !inSet) {return;} + if (next === '[') {inSet = true;} + else if (inSet && next === ']') {inSet = false;} + } + escaped = !escaped && next === '\\'; + } + } + + // Used as scratch variables to communicate multiple values without + // consing up tons of objects. + let type: string; + let content: string; + + function ret(tp: string, style?: string, cont?: string): string | undefined { + type = tp; + content = cont; + return style; + } + + function tokenBase(stream: StringStream, state: State): string | undefined { + const ch = stream.next(); + if (typeof ch !== 'string') { + return undefined; + } + + if (ch === '\n') { + inValue = false; + } + + // eslint-disable-next-line no-useless-escape + if (ch === '.' && stream.match(/^\d+(?:[eE][+\-]?\d+)?/)) { + return ret('number', 'number'); + } + if (ch === '.' && stream.match('..')) { + return ret('spread', 'meta'); + } + // eslint-disable-next-line no-useless-escape + if (ch && /[\[\]{}\(\),;\:\.]/.test(ch)) { + return ret(ch); + } + if ((ch === '<' || ch === '>' || ch === '.' || (ch === '=' && stream.peek() !== '<'))) { + inValue = true; + return ret(ch, 'operator') + } + // eslint-disable-next-line no-useless-escape + if (!inValue && ch && /[\[\]\(\),;\:\.\<\>\=]/.test(ch)) { + return ret(ch, 'operator') + } + if (ch === '0' && stream.eat(/x/i)) { + stream.eatWhile(/[\da-f]/i); + return ret('number', 'number'); + } + if (ch === '0' && stream.eat(/o/i)) { + stream.eatWhile(/[0-7]/i); + return ret('number', 'number'); + } + if (ch === '0' && stream.eat(/b/i)) { + stream.eatWhile(/[01]/i); + return ret('number', 'number'); + } + if (ch && /\d/.test(ch)) { + // eslint-disable-next-line no-useless-escape + stream.match(/^\d*(?:\.\d+)?(?:[eE][+\-]?\d+)?/); + return ret('number', 'number'); + } + if (ch === '/') { + if (stream.eat('*')) { + state.tokenize = tokenComment; + return tokenComment(stream, state); + } + if (stream.eat('/')) { + stream.skipToEnd(); + return ret('comment', 'comment'); + } + if (expressionAllowed(stream, state)) { + readRegexp(stream); + stream.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/); + return ret('regexp', 'string-2'); + } + + stream.eatWhile(isOperatorChar); + return ret('operator', 'operator', stream.current()); + } + if (ch === '#') { + stream.skipToEnd(); + return ret('comment', 'comment'); + } + if (isOperatorChar.test(ch)) { + if (ch !== '>' || !state.lexical || state.lexical.type !== '>') { + stream.eatWhile(isOperatorChar); + } + return ret('operator', 'operator', stream.current()); + } + if (wordRE.test(ch)) { + stream.eatWhile(wordRE); + const word = stream.current(); + // eslint-disable-next-line no-prototype-builtins + if (keywords.propertyIsEnumerable(word)) { + const kw = keywords[word]; + return ret(kw.type, kw.style, word); + } + if (inValue) { + return ret('string', 'string', word); + } + return ret('variable', 'other', word); + } + + return undefined; + } + + function tokenComment(stream: StringStream, state: State) { + let maybeEnd = false, ch; + while ((ch = stream.next()) !== null) { + if (ch === '/' && maybeEnd) { + state.tokenize = tokenBase; + break; + } + maybeEnd = (ch === '*'); + } + return ret('comment', 'comment'); + } + + // Parser + + const atomicTypes = { + 'atom': true, + 'number': true, + 'variable': true, + 'string': true, + 'regexp': true + }; + + function inScope(state: State, varname: string): CombinatorReturnType { + for (let v = state.localVars; v; v = v.next) { + if (v.name == varname) { + return true; + } + } + for (let cx = state.context; cx; cx = cx.prev) { + for (let v = cx.vars; v; v = v.next) { + if (v.name == varname) { + return true; + } + } + } + + return undefined; + } + + const cx: CX = { + state: null, + column: null, + marked: null, + cc: null + }; + + function parseTS(state: State, style: string, type: Type, content: string, stream: StringStream): string { + const cc = state.cc; + // Communicate our context to the combinators. + // (Less wasteful than consing up a hundred closures on every call.) + cx.state = state; + cx.stream = stream; + cx.marked = null; + cx.cc = cc; + cx.style = style; + + // eslint-disable-next-line no-prototype-builtins + if (!state.lexical.hasOwnProperty('align')) { + state.lexical.align = true; + } + + // eslint-disable-next-line no-constant-condition + while (true) { + const combinator = cc.length ? cc.pop() : statement; + if (typeof combinator === 'function' && combinator(type, content)) { + while (cc.length && cc[cc.length - 1] && (cc[cc.length - 1] as CombinatorLexFunction).lex) { + cc.pop()(); + } + if (cx.marked) { + return cx.marked; + } + if (type === 'variable' && inScope(state, content)) { + return 'variable-2'; + } + return style; + } + } + } + + // Combinator utils + + function pass(...args: CC[]): undefined { + for (let i = args.length - 1; i >= 0; i--) { + cx.cc.push(args[i]); + } + return undefined; + } + + function cont(...args: CC[]): CombinatorReturnType { + pass(...args); + return true; + } + + function register(varname: string): void { + function inList(list: LocalVars): boolean { + for (let v = list; v; v = v.next) { + if (v.name == varname) { + return true; + } + } + return false; + } + + const state = cx.state; + cx.marked = 'def'; + if (state.context) { + if (inList(state.localVars)) { + return; + } + state.localVars = { name: varname, next: state.localVars }; + } + } + + // Combinators + + function pushlex(type: Type, info?: number | string): CombinatorLexFunction { + const result: CombinatorLexFunction = function(): CombinatorReturnType { + const state = cx.state + let indent = state.indented; + if (state.lexical.type === 'stat') { + indent = state.lexical.indented; + } else { + for (let outer = state.lexical; outer && outer.type === ')' && outer.align; outer = outer.prev) { + indent = outer.indented; + } + } + state.lexical = new TSLexical(indent, cx.stream.column(), type, null, state.lexical, info); + return undefined; + }; + result.lex = true; + return result; + } + + function poplex(): CombinatorReturnType { + const state = cx.state; + if (state.lexical.prev) { + if (state.lexical.type === ')') { + state.indented = state.lexical.indented; + } + state.lexical = state.lexical.prev; + } + return undefined; + } + poplex.lex = true; + + function expect(wanted: Type): CombinatorFunction { + function exp(type: Type): CombinatorReturnType { + if (type == wanted) { + return cont(); + } else if (wanted === ';') { + return pass(); + } else { + return cont(exp); + } + } + return exp; + } + + function statement(type: Type, value: Value): CombinatorReturnType { + if (type === 'keyword a') { + return cont(pushlex('form'), parenExpr, statement, poplex); + } + if (type === 'keyword b') { + return cont(pushlex('form'), statement, poplex); + } + if (type === '{') { + return cont(pushlex('}'), block, poplex); + } + if (type === ';') { + return cont(); + } + if (type === 'variable') { + return cont(pushlex('stat'), maybelabel); + } + if (type === 'import') { + return cont(pushlex('stat'), afterImport, poplex); + } + if (value === '@') { + return cont(expression, statement) + } + return pass(pushlex('stat'), expression, expect(';'), poplex); + } + + function expression(type: Type): CombinatorReturnType { + return expressionInner(type, false); + } + + function expressionNoComma(type: Type): CombinatorReturnType { + return expressionInner(type, true); + } + + function parenExpr(type: Type): CombinatorReturnType { + if (type !== '(') { + return pass() + } + return cont(pushlex(')'), expression, expect(')'), poplex) + } + + function expressionInner(type: Type, noComma: boolean) { + const maybeop = noComma ? maybeoperatorNoComma : maybeoperatorComma; + // eslint-disable-next-line no-prototype-builtins + if (atomicTypes.hasOwnProperty(type)) { + return cont(maybeop); + } + if (type === 'keyword c') { + return cont(noComma ? maybeexpressionNoComma : maybeexpression); + } + if (type === '(') { + return cont(pushlex(')'), maybeexpression, expect(')'), poplex, maybeop); + } + if (type === 'operator') { + return cont(noComma ? expressionNoComma : expression); + } + if (type === '{') { + return contCommasep(objprop, '}', null, maybeop); + } + return cont(); + } + + function maybeexpression(type: Type): CombinatorReturnType { + // eslint-disable-next-line no-useless-escape + if (type.match(/[;\}\)\],]/)) { + return pass(); + } + return pass(expression); + } + + function maybeexpressionNoComma(type: Type): CombinatorReturnType { + // eslint-disable-next-line no-useless-escape + if (type.match(/[;\}\)\],]/)) {return pass();} + return pass(expressionNoComma); + } + + function maybeoperatorComma(type: Type, value: Value): CombinatorReturnType { + if (type === ',') {return cont(expression);} + return maybeoperatorNoComma(type, value, false); + } + + function maybeoperatorNoComma(type: Type, value: Value, noComma?: boolean): CombinatorReturnType { + const me = noComma == false ? maybeoperatorComma : maybeoperatorNoComma; + const expr = noComma == false ? expression : expressionNoComma; + if (type === 'operator') { + if (/\+\+|--/.test(value)) {return cont(me);} + if (value === '?') {return cont(expression, expect(':'), expr);} + return cont(expr); + } + if (type === ';') { + return undefined; + } + if (type === '(') { + return contCommasep(expressionNoComma, ')', 'call', me); + } + if (type === '.') { + return cont(property, me); + } + if (type === '[') { + return cont(pushlex(']'), maybeexpression, expect(']'), poplex, me); + } + return undefined; + } + + function maybelabel(type: Type): CombinatorReturnType { + if (type === ':') { + return cont(poplex, statement); + } + return pass(maybeoperatorComma, expect(';'), poplex); + } + + function property(type: Type): CombinatorReturnType { + if (type === 'variable') { + cx.marked = 'property'; + return cont(); + } + return undefined; + } + + function objprop(type: Type): CombinatorReturnType { + if (type === 'async') { + cx.marked = 'property'; + return cont(objprop); + } else if (type === 'variable' || cx.style === 'keyword') { + cx.marked = 'property'; + return cont(afterprop); + } else if (type === 'number' || type === 'string') { + cx.marked = cx.style + ' property'; + return cont(afterprop); + } else if (type === 'modifier') { + return cont(objprop) + } else if (type === ':') { + return pass(afterprop) + } + return undefined; + } + + function afterprop(type: Type): CombinatorReturnType { + if (type === ':') { + return cont(expressionNoComma); + } + return undefined; + } + + function commasep(what: CC, end: Type, sep?: string): CombinatorFunction { + function proceed(type: Type, value: Value): CombinatorReturnType { + if (sep ? sep.indexOf(type) > -1 : type === ',') { + const lex = cx.state.lexical; + if (lex.info === 'call') { + lex.pos = (lex.pos || 0) + 1; + } + return cont( + function(type: Type, value: Value): CombinatorReturnType { + if (type == end || value == end) { + return pass() + } + return pass(what) + }, + proceed + ); + } + if (type == end || value == end) { + return cont(); + } + return cont(expect(end)); + } + + return function(type, value): CombinatorReturnType { + if (type == end || value == end) { + return cont(); + } + return pass(what, proceed); + }; + } + + function contCommasep(what: CC, end: Type, info?: string, ...rest: CC[]): CombinatorReturnType { + for (const combinator of rest) { + cx.cc.push(combinator); + } + return cont(pushlex(end, info), commasep(what, end), poplex); + } + + function block(type: Type): CombinatorReturnType { + if (type === '}') { + return cont(); + } + return pass(statement, block); + } + + function pattern(type: Type, value: Value): CombinatorReturnType { + if (type === 'modifier') { + return cont(pattern); + } + if (type === 'variable') { + register(value); + return cont(); + } + if (type === '{') { + return contCommasep(proppattern, '}'); + } + return undefined; + } + + function proppattern(type: Type, value: Value): CombinatorReturnType { + if (type === 'variable' && !cx.stream.match(/^\s*:/, false)) { + register(value); + return cont(maybeAssign); + } + if (type === 'variable') { + cx.marked = 'property'; + } + if (type === '}') { + return pass(); + } + return cont(expect(':'), pattern, maybeAssign); + } + + function maybeAssign(_type: Type, value: Value): CombinatorReturnType { + if (value === '=') { + return cont(expressionNoComma); + } + return undefined; + } + + + function afterImport(type: Type): CombinatorReturnType { + if (type === 'string') { + return cont(); + } + return pass(importSpec, maybeMoreImports, maybeFrom); + } + + function importSpec(type: Type, value: Value): CombinatorReturnType { + if (type === '{') { + return contCommasep(importSpec, '}'); + } + if (type === 'variable') { + register(value); + } + if (value === '*') { + cx.marked = 'keyword'; + } + return cont(maybeAs); + } + + function maybeMoreImports(type: Type): CombinatorReturnType { + if (type === ',') { + return cont(importSpec, maybeMoreImports); + } + return undefined; + } + + function maybeAs(_type: Value, value: Value): CombinatorReturnType { + if (value === 'as') { + cx.marked = 'keyword'; + return cont(importSpec); + } + return undefined; + } + + function maybeFrom(_type: Type, value: Value): CombinatorReturnType { + if (value === 'from') { + cx.marked = 'keyword'; + return cont(expression); + } + return undefined; + } + + function isContinuedStatement(state: State, textAfter: string): CombinatorReturnType { + return state.lastType === 'operator' || state.lastType === ',' || + isOperatorChar.test(textAfter.charAt(0)) || + /[,.]/.test(textAfter.charAt(0)); + } + + // Interface + + class TypoScriptStreamParser implements StreamParser<State> { + public readonly electricInput: RegExp = /^\s*(?:case .*?:|default:|\{|\})$/; + public readonly blockCommentStart: string = '/*'; + public readonly blockCommentEnd: string = '*/'; + public readonly lineComment: string = '#'; + public readonly fold: string = 'brace'; + public readonly closeBrackets: string = '(){}\'\'""`'; + public readonly helperType: string = 'typoscript'; + + public readonly name: string = 'TypoScript'; + + public startState(indentUnit: number): State { + return { + tokenize: tokenBase, + lastType: 'sof', + cc: [], + lexical: new TSLexical(-indentUnit, 0, 'block', false), + localVars: parserConfig.localVars, + context: parserConfig.localVars && { vars: parserConfig.localVars }, + indented: 0 + }; + } + + public token(stream: StringStream, state: State): string | null { + if (stream.sol()) { + // eslint-disable-next-line no-prototype-builtins + if (!state.lexical.hasOwnProperty('align')) { + state.lexical.align = false; + } + state.indented = stream.indentation(); + } + if (state.tokenize != tokenComment && stream.eatSpace()) { + return null; + } + const style = state.tokenize(stream, state); + if (type === 'comment') { + return style; + } + state.lastType = type === 'operator' && (content === '++' || content === '--') ? 'incdec' : type; + return parseTS(state, style, type, content, stream); + } + + public indent(state: State, textAfter: string, cx: IndentContext): number | null { + if (state.tokenize == tokenComment) { + // pass + return null; + } + if (state.tokenize != tokenBase) { + return 0; + } + const firstChar = textAfter && textAfter.charAt(0) + let lexical = state.lexical; + let top; + while ( + (lexical.type === 'stat' || lexical.type === 'form') && ( + firstChar === '}' || ( + (top = state.cc[state.cc.length - 1]) && + (top == maybeoperatorComma || top == maybeoperatorNoComma) && + // eslint-disable-next-line no-useless-escape + !/^[,\.=+\-*:?[\(]/.test(textAfter) + ) + ) + ) { + lexical = lexical.prev; + } + if (statementIndent && lexical.type === ')' && lexical.prev.type === 'stat') { + lexical = lexical.prev; + } + const type = lexical.type + const closing = firstChar == type; + + if (type === 'form' && firstChar === '{') { + return lexical.indented; + } else if (type === 'form') { + return lexical.indented + cx.unit; + } else if (type === 'stat') { + return lexical.indented + (isContinuedStatement(state, textAfter) ? statementIndent || cx.unit : 0); + } else if (lexical.info === 'switch' && !closing && parserConfig.doubleIndentSwitch != false) { + return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? cx.unit : 2 * cx.unit); + } else if (lexical.align) { + return lexical.column + (closing ? 0 : 1); + } else { + return lexical.indented + (closing ? 0 : cx.unit); + } + } + + public expressionAllowed(stream: StringStream, state: State): boolean { + return expressionAllowed(stream, state); + } + } + + return new TypoScriptStreamParser(); + } +} diff --git a/Build/types/TYPO3/index.d.ts b/Build/types/TYPO3/index.d.ts index c8924a4c59f9..694e2f28f315 100644 --- a/Build/types/TYPO3/index.d.ts +++ b/Build/types/TYPO3/index.d.ts @@ -92,8 +92,6 @@ declare module '@typo3/install/chosen.jquery.min'; declare module '@typo3/dashboard/contrib/chartjs'; declare module '@typo3/backend/contrib/mark'; -declare module '@typo3/t3editor/stream-parser/typoscript'; - interface Taboverride { set(elems: HTMLElement|HTMLElement[], enable?: boolean): Taboverride } diff --git a/typo3/sysext/t3editor/Resources/Public/JavaScript/language/typoscript.js b/typo3/sysext/t3editor/Resources/Public/JavaScript/language/typoscript.js index 5b50a8b2f80f..46c8356ce913 100644 --- a/typo3/sysext/t3editor/Resources/Public/JavaScript/language/typoscript.js +++ b/typo3/sysext/t3editor/Resources/Public/JavaScript/language/typoscript.js @@ -10,4 +10,4 @@ * * The TYPO3 project - inspiring people to share! */ -import DocumentService from"@typo3/core/document-service.js";import{StreamLanguage,LanguageSupport}from"@codemirror/language";import{typoScriptStreamParser}from"@typo3/t3editor/stream-parser/typoscript.js";import{TsCodeCompletion}from"@typo3/t3editor/autocomplete/ts-code-completion.js";import{syntaxTree}from"@codemirror/language";export function typoscript(){const t=StreamLanguage.define(typoScriptStreamParser),e=t.data.of({autocomplete:complete});return new LanguageSupport(t,[e])}const tsCodeCompletionInitializer=(async()=>{await DocumentService.ready();const t=parseInt(document.querySelector('input[name="effectivePid"]')?.value,10);return new TsCodeCompletion(t)})();export async function complete(t){if(!t.explicit)return null;const e=parseCodeMirror5CompatibleCompletionState(t),o=t.pos-(e.completingAfterDot?1:0),r=syntaxTree(t.state).resolveInner(o,-1),n="Document"===r.name||e.completingAfterDot?"":t.state.sliceDoc(r.from,o),s="Document"===r.name||e.completingAfterDot?t.pos:r.from;let i={start:r.from,end:o,string:n,type:r.name};/^[\w$_]*$/.test(n)||(i={start:t.pos,end:t.pos,string:"",type:"."===n?"property":null}),e.token=i;const a=(await tsCodeCompletionInitializer).refreshCodeCompletion(e);if(("string"===r.name||"comment"===r.name)&&tokenIsSubStringOfKeywords(n,a))return null;return{from:s,options:getCompletions(n,a).map((t=>({label:t,type:"keyword"})))}}function parseCodeMirror5CompatibleCompletionState(t){const e=t.state.sliceDoc().split(t.state.lineBreak).length,o=t.state.sliceDoc(0,t.pos).split(t.state.lineBreak).length,r=t.state.sliceDoc().split(t.state.lineBreak)[o-1],n="."===t.state.sliceDoc(t.pos-1,t.pos);return{lineTokens:extractCodemirror5StyleLineTokens(e,t),currentLineNumber:o,currentLine:r,lineCount:e,completingAfterDot:n}}function extractCodemirror5StyleLineTokens(t,e){const o=Array(t).fill("").map((()=>[]));let r=0,n=1;return syntaxTree(e.state).cursor().iterate((s=>{const i=s.type.name||s.name;if("Document"===i)return;const a=s.from,l=s.to;r<a&&e.state.sliceDoc(r,a).split(e.state.lineBreak).forEach((e=>{e&&(o[Math.min(n-1,t-1)].push({type:null,string:e,start:r,end:r+e.length}),n++,r+=e.length)}));const c=e.state.sliceDoc(s.from,s.to);n=e.state.sliceDoc(0,s.from).split(e.state.lineBreak).length,o[n-1].push({type:i,string:c,start:a,end:l}),r=l})),r<e.state.doc.length&&o[n-1].push({type:null,string:e.state.sliceDoc(r),start:r,end:e.state.doc.length}),o}function tokenIsSubStringOfKeywords(t,e){const o=t.length;for(let r=0;r<e.length;++r)if(t===e[r].substr(o))return!0;return!1}function getCompletions(t,e){const o=new Set;for(let n=0,s=e.length;n<s;++n)0!==(r=e[n]).lastIndexOf(t,0)||o.has(r)||o.add(r);var r;const n=Array.from(o);return n.sort(),n} \ No newline at end of file +import DocumentService from"@typo3/core/document-service.js";import{StreamLanguage,LanguageSupport}from"@codemirror/language";import{TypoScriptStreamParserFactory}from"@typo3/t3editor/stream-parser/typoscript.js";import{TsCodeCompletion}from"@typo3/t3editor/autocomplete/ts-code-completion.js";import{syntaxTree}from"@codemirror/language";export function typoscript(){const t=StreamLanguage.define((new TypoScriptStreamParserFactory).create()),e=t.data.of({autocomplete:complete});return new LanguageSupport(t,[e])}const tsCodeCompletionInitializer=(async()=>{await DocumentService.ready();const t=parseInt(document.querySelector('input[name="effectivePid"]')?.value,10);return new TsCodeCompletion(t)})();export async function complete(t){if(!t.explicit)return null;const e=parseCodeMirror5CompatibleCompletionState(t),o=t.pos-(e.completingAfterDot?1:0),r=syntaxTree(t.state).resolveInner(o,-1),n="Document"===r.name||e.completingAfterDot?"":t.state.sliceDoc(r.from,o),s="Document"===r.name||e.completingAfterDot?t.pos:r.from;let a={start:r.from,end:o,string:n,type:r.name};/^[\w$_]*$/.test(n)||(a={start:t.pos,end:t.pos,string:"",type:"."===n?"property":null}),e.token=a;const i=(await tsCodeCompletionInitializer).refreshCodeCompletion(e);if(("string"===r.name||"comment"===r.name)&&tokenIsSubStringOfKeywords(n,i))return null;return{from:s,options:getCompletions(n,i).map((t=>({label:t,type:"keyword"})))}}function parseCodeMirror5CompatibleCompletionState(t){const e=t.state.sliceDoc().split(t.state.lineBreak).length,o=t.state.sliceDoc(0,t.pos).split(t.state.lineBreak).length,r=t.state.sliceDoc().split(t.state.lineBreak)[o-1],n="."===t.state.sliceDoc(t.pos-1,t.pos);return{lineTokens:extractCodemirror5StyleLineTokens(e,t),currentLineNumber:o,currentLine:r,lineCount:e,completingAfterDot:n}}function extractCodemirror5StyleLineTokens(t,e){const o=Array(t).fill("").map((()=>[]));let r=0,n=1;return syntaxTree(e.state).cursor().iterate((s=>{const a=s.type.name||s.name;if("Document"===a)return;const i=s.from,c=s.to;r<i&&e.state.sliceDoc(r,i).split(e.state.lineBreak).forEach((e=>{e&&(o[Math.min(n-1,t-1)].push({type:null,string:e,start:r,end:r+e.length}),n++,r+=e.length)}));const l=e.state.sliceDoc(s.from,s.to);n=e.state.sliceDoc(0,s.from).split(e.state.lineBreak).length,o[n-1].push({type:a,string:l,start:i,end:c}),r=c})),r<e.state.doc.length&&o[n-1].push({type:null,string:e.state.sliceDoc(r),start:r,end:e.state.doc.length}),o}function tokenIsSubStringOfKeywords(t,e){const o=t.length;for(let r=0;r<e.length;++r)if(t===e[r].substr(o))return!0;return!1}function getCompletions(t,e){const o=new Set;for(let n=0,s=e.length;n<s;++n)0!==(r=e[n]).lastIndexOf(t,0)||o.has(r)||o.add(r);var r;const n=Array.from(o);return n.sort(),n} \ No newline at end of file diff --git a/typo3/sysext/t3editor/Resources/Public/JavaScript/stream-parser/typoscript.js b/typo3/sysext/t3editor/Resources/Public/JavaScript/stream-parser/typoscript.js index a213dc95ccf6..72cdb48df011 100644 --- a/typo3/sysext/t3editor/Resources/Public/JavaScript/stream-parser/typoscript.js +++ b/typo3/sysext/t3editor/Resources/Public/JavaScript/stream-parser/typoscript.js @@ -1,1757 +1,13 @@ -function createTypoScriptMode() { - - function expressionAllowed(stream, state, backUp) { - return /^(?:operator|sof|keyword c|case|new|export|default|[\[{}\(,;:]|=>)$/.test(state.lastType) || - (state.lastType === "quasi" && /\{\s*$/.test(stream.string.slice(0, stream.pos - (backUp || 0)))) - } - - function doCreateTypoScriptMode() { - - var wordRE = /[\w$\xa1-\uffff]/; - var statementIndent = undefined; - var parserConfig = {name: 'typoscript'}; - - // Tokenizer - - var keywords = function() { - function kw(type) { - return {type: type, style: "keyword"}; - } - - var A = kw("keyword a"), B = kw("keyword b"); - - return { - '_CSS_DEFAULT_STYLE': kw('_CSS_DEFAULT_STYLE'), - '_LOCAL_LANG': kw('_LOCAL_LANG'), - '_offset': kw('_offset'), - 'absRefPrefix': kw('absRefPrefix'), - 'accessibility': kw('accessibility'), - 'ACT': B, - 'ACTIFSUB': B, - 'ACTIFSUBRO': kw('ACTIFSUBRO'), - 'ACTRO': B, - 'addAttributes': kw('addAttributes'), - 'addExtUrlsAndShortCuts': kw('addExtUrlsAndShortCuts'), - 'addItems': kw('addItems'), - 'additionalHeaders': kw('additionalHeaders'), - 'additionalParams': kw('additionalParams'), - 'addQueryString': kw('addQueryString'), - 'adjustItemsH': kw('adjustItemsH'), - 'adjustSubItemsH': kw('adjustSubItemsH'), - 'admPanel': A, - 'after': kw('after'), - 'afterImg': kw('afterImg'), - 'afterImgLink': kw('afterImgLink'), - 'afterImgTagParams': kw('afterImgTagParams'), - 'afterROImg': kw('afterROImg'), - 'afterWrap': kw('afterWrap'), - 'age': kw('age'), - 'alertPopups': kw('alertPopups'), - 'align': kw('align'), - 'all': B, - 'allow': kw('allow'), - 'allowCaching': kw('allowCaching'), - 'allowedAttribs': kw('allowedAttribs'), - 'allowedClasses': kw('allowedClasses'), - 'allowedCols': kw('allowedCols'), - 'allowedNewTables': kw('allowedNewTables'), - 'allowTags': kw('allowTags'), - 'allStdWrap': kw('allStdWrap'), - 'allWrap': kw('allWrap'), - 'alt_print': A, - 'alternativeSortingField': kw('alternativeSortingField'), - 'altIcons': kw('altIcons'), - 'altImgResource': kw('altImgResource'), - 'altLabels': kw('altLabels'), - 'altTarget': kw('altTarget'), - 'altText': kw('altText'), - 'altUrl': kw('altUrl'), - 'altUrl_noDefaultParams': kw('altUrl_noDefaultParams'), - 'altWrap': kw('altWrap'), - 'always': kw('always'), - 'alwaysActivePIDlist': kw('alwaysActivePIDlist'), - 'alwaysLink': kw('alwaysLink'), - 'andWhere': kw('andWhere'), - 'angle': kw('angle'), - 'antiAlias': kw('antiAlias'), - 'append': kw('append'), - 'applyTotalH': kw('applyTotalH'), - 'applyTotalW': kw('applyTotalW'), - 'archive': kw('archive'), - 'ascii': B, - 'ATagAfterWrap': kw('ATagAfterWrap'), - 'ATagBeforeWrap': kw('ATagBeforeWrap'), - 'ATagParams': kw('ATagParams'), - 'ATagTitle': kw('ATagTitle'), - 'atLeast': B, - 'atMost': B, - 'attribute': kw('attribute'), - 'auth': A, - 'autoLevels': kw('autoLevels'), - 'autonumber': kw('autonumber'), - 'backColor': kw('backColor'), - 'background': kw('background'), - 'baseURL': kw('baseURL'), - 'BE': B, - 'be_groups': B, - 'be_users': B, - 'before': kw('before'), - 'beforeImg': kw('beforeImg'), - 'beforeImgLink': kw('beforeImgLink'), - 'beforeImgTagParams': kw('beforeImgTagParams'), - 'beforeROImg': kw('beforeROImg'), - 'beforeWrap': kw('beforeWrap'), - 'begin': kw('begin'), - 'bgCol': kw('bgCol'), - 'bgImg': kw('bgImg'), - 'blur': kw('blur'), - 'bm': kw('bm'), - 'bodyTag': kw('bodyTag'), - 'bodyTagAdd': kw('bodyTagAdd'), - 'bodyTagCObject': kw('bodyTagCObject'), - 'bodytext': kw('bodytext'), - 'borderCol': kw('borderCol'), - 'borderThick': kw('borderThick'), - 'bottomBackColor': kw('bottomBackColor'), - 'bottomContent': kw('bottomContent'), - 'bottomHeight': kw('bottomHeight'), - 'bottomImg': kw('bottomImg'), - 'bottomImg_mask': kw('bottomImg_mask'), - 'BOX': B, - 'br': kw('br'), - 'browse': B, - 'browser': A, - 'brTag': kw('brTag'), - 'bullet': kw('bullet'), - 'bulletlist': kw('bulletlist'), - 'bullets': B, - 'bytes': kw('bytes'), - 'cache': A, - 'cache_clearAtMidnight': kw('cache_clearAtMidnight'), - 'cache_period': kw('cache_period'), - 'caption': kw('caption'), - 'caption_stdWrap': kw('caption_stdWrap'), - 'captionHeader': kw('captionHeader'), - 'captionSplit': kw('captionSplit'), - 'CARRAY': kw('CARRAY'), - 'CASE': kw('CASE'), - 'case': kw('case'), - 'casesensitiveComp': kw('casesensitiveComp'), - 'cellpadding': kw('cellpadding'), - 'cellspacing': kw('cellspacing'), - 'char': kw('char'), - 'charcoal': kw('charcoal'), - 'charMapConfig': kw('charMapConfig'), - 'CHECK': A, - 'check': kw('check'), - 'class': kw('class'), - 'classesAnchor': kw('classesAnchor'), - 'classesCharacter': kw('classesCharacter'), - 'classesImage': kw('classesImage'), - 'classesParagraph': kw('classesParagraph'), - 'clear': kw('clear'), - 'clearCache': kw('clearCache'), - 'clearCache_disable': kw('clearCache_disable'), - 'clearCache_pageGrandParent': kw('clearCache_pageGrandParent'), - 'clearCache_pageSiblingChildren': kw('clearCache_pageSiblingChildren'), - 'clearCacheCmd': kw('clearCacheCmd'), - 'clearCacheLevels': kw('clearCacheLevels'), - 'clearCacheOfPages': kw('clearCacheOfPages'), - 'clickTitleMode': kw('clickTitleMode'), - 'clipboardNumberPads': kw('clipboardNumberPads'), - 'cMargins': kw('cMargins'), - 'COA': kw('COA'), - 'COA_INT': kw('COA_INT'), - 'cObj': A, - 'COBJ_ARRAY': kw('COBJ_ARRAY'), - 'cObject': A, - 'cObjNum': kw('cObjNum'), - 'collapse': kw('collapse'), - 'collections': kw('collections'), - 'color': kw('color'), - 'color1': kw('color1'), - 'color2': kw('color2'), - 'color3': kw('color3'), - 'color4': kw('color4'), - 'colors': kw('colors'), - 'colour': kw('colour'), - 'colPos_list': kw('colPos_list'), - 'colRelations': kw('colRelations'), - 'cols': kw('cols'), - 'colSpace': kw('colSpace'), - 'COMMENT': A, - 'comment_auto': kw('comment_auto'), - 'commentWrap': kw('commentWrap'), - 'compX': kw('compX'), - 'compY': kw('compY'), - 'conf': kw('conf'), - 'CONFIG': kw('CONFIG'), - 'config': A, - 'CONSTANTS': kw('CONSTANTS'), - 'constants': kw('constants'), - 'CONTENT': kw('CONTENT'), - 'content': A, - 'contextMenu': kw('contextMenu'), - 'copy': A, - 'copyLevels': kw('copyLevels'), - 'count_HMENU_MENUOBJ': kw('count_HMENU_MENUOBJ'), - 'count_menuItems': kw('count_menuItems'), - 'count_MENUOBJ': kw('count_MENUOBJ'), - 'create': kw('create'), - 'crop': kw('crop'), - 'csConv': kw('csConv'), - 'CType': kw('CType'), - 'CUR': B, - 'CURIFSUB': B, - 'CURIFSUBRO': B, - 'current': kw('current'), - 'CURRO': B, - 'curUid': kw('curUid'), - 'cut': A, - 'cWidth': kw('cWidth'), - 'data': kw('data'), - 'dataArray': A, - 'dataWrap': kw('dataWrap'), - 'date': kw('date'), - 'date_stdWrap': kw('date_stdWrap'), - 'datePrefix': kw('datePrefix'), - 'dayofmonth': A, - 'dayofweek': A, - 'DB': kw('DB'), - 'db_list': A, - 'debug': kw('debug'), - 'debugData': kw('debugData'), - 'debugFunc': kw('debugFunc'), - 'debugItemConf': kw('debugItemConf'), - 'debugRenumberedObject': kw('debugRenumberedObject'), - 'default': B, - 'defaultAlign': kw('defaultAlign'), - 'defaultCmd': kw('defaultCmd'), - 'defaultHeaderType': kw('defaultHeaderType'), - 'defaultOutput': kw('defaultOutput'), - 'defaults': kw('defaults'), - 'defaultType': kw('defaultType'), - 'delete': kw('delete'), - 'denyTags': kw('denyTags'), - 'depth': kw('depth'), - 'DESC': kw('DESC'), - 'description': B, - 'dimensions': kw('dimensions'), - 'direction': kw('direction'), - 'directory': B, - 'directReturn': B, - 'disableAllHeaderCode': kw('disableAllHeaderCode'), - 'disableAltText': kw('disableAltText'), - 'disableBodyTag': kw('disableBodyTag'), - 'disabled': kw('disabled'), - 'disableDelete': kw('disableDelete'), - 'disableHideAtCopy': kw('disableHideAtCopy'), - 'disableItems': kw('disableItems'), - 'disableNoMatchingValueElement': kw('disableNoMatchingValueElement'), - 'disablePrefixComment': kw('disablePrefixComment'), - 'disablePrependAtCopy': kw('disablePrependAtCopy'), - 'disableSearchBox': kw('disableSearchBox'), - 'disableSingleTableView': kw('disableSingleTableView'), - 'displayContent': kw('displayContent'), - 'displayFieldIcons': kw('displayFieldIcons'), - 'displayIcons': kw('displayIcons'), - 'displayMessages': kw('displayMessages'), - 'displayRecord': kw('displayRecord'), - 'displayTimes': kw('displayTimes'), - 'distributeX': kw('distributeX'), - 'distributeY': kw('distributeY'), - 'div': B, - 'DIV': kw('DIV'), - 'doctype': kw('doctype'), - 'DOCUMENT_BODY': kw('DOCUMENT_BODY'), - 'doktype': kw('doktype'), - 'doNotLinkIt': kw('doNotLinkIt'), - 'doNotShowLink': kw('doNotShowLink'), - 'doNotStripHTML': kw('doNotStripHTML'), - 'dontCheckPid': kw('dontCheckPid'), - 'dontLinkIfSubmenu': kw('dontLinkIfSubmenu'), - 'dontWrapInTable': kw('dontWrapInTable'), - 'doubleBrTag': kw('doubleBrTag'), - 'dWorkArea': kw('dWorkArea'), - 'dynCSS': A, - 'edge': kw('edge'), - 'edit': A, - 'edit_access': A, - 'edit_docModuleUpload': kw('edit_docModuleUpload'), - 'EFFECT': kw('EFFECT'), - 'elements': kw('elements'), - 'else': B, - 'email': B, - 'emailMeAtLogin': kw('emailMeAtLogin'), - 'emailMess': kw('emailMess'), - 'emboss': kw('emboss'), - 'enable': kw('enable'), - 'encapsLines': kw('encapsLines'), - 'encapsLinesStdWrap': kw('encapsLinesStdWrap'), - 'encapsTagList': kw('encapsTagList'), - 'end': B, - 'entryLevel': kw('entryLevel'), - 'equalH': kw('equalH'), - 'equals': B, - 'everybody': kw('everybody'), - 'excludeDoktypes': kw('excludeDoktypes'), - 'excludeUidList': kw('excludeUidList'), - 'expAll': kw('expAll'), - 'expand': kw('expand'), - 'explode': kw('explode'), - 'ext': kw('ext'), - 'external': B, - 'externalBlocks': kw('externalBlocks'), - 'extTarget': kw('extTarget'), - 'face': kw('face'), - 'false': B, - 'FE': B, - 'fe_adminLib': kw('fe_adminLib'), - 'fe_groups': B, - 'fe_users': B, - 'feadmin': B, - 'field': kw('field'), - 'fieldName': kw('fieldName'), - 'fieldOrder': kw('fieldOrder'), - 'fieldRequired': kw('fieldRequired'), - 'fields': kw('fields'), - 'fieldWrap': kw('fieldWrap'), - 'file': kw('file'), - 'file1': kw('file1'), - 'file2': kw('file2'), - 'file3': kw('file3'), - 'file4': kw('file4'), - 'file5': kw('file5'), - 'FILES': kw('FILES'), - 'files': kw('files'), - 'firstLabel': kw('firstLabel'), - 'firstLabelGeneral': kw('firstLabelGeneral'), - 'fixAttrib': kw('fixAttrib'), - 'flip': kw('flip'), - 'flop': kw('flop'), - 'FLUIDTEMPLATE': kw('FLUIDTEMPLATE'), - 'folder': A, - 'folders': kw('folders'), - 'folderTree': A, - 'foldoutMenu': A, - 'fontColor': kw('fontColor'), - 'fontFile': kw('fontFile'), - 'fontOffset': kw('fontOffset'), - 'fontSize': kw('fontSize'), - 'fontSizeMultiplicator': kw('fontSizeMultiplicator'), - 'forceDisplayFieldIcons': kw('forceDisplayFieldIcons'), - 'forceDisplayIcons': kw('forceDisplayIcons'), - 'forceTemplateParsing': kw('forceTemplateParsing'), - 'forceTypeValue': kw('forceTypeValue'), - 'FORM': kw('FORM'), - 'format': kw('format'), - 'function': kw('function'), - 'Functions': A, - 'gamma': kw('gamma'), - 'gapBgCol': kw('gapBgCol'), - 'gapLineCol': kw('gapLineCol'), - 'gapLineThickness': kw('gapLineThickness'), - 'gapWidth': kw('gapWidth'), - 'get': kw('get'), - 'getBorder': kw('getBorder'), - 'getLeft': kw('getLeft'), - 'getRight': kw('getRight'), - 'GIFBUILDER': kw('GIFBUILDER'), - 'global': kw('global'), - 'globalNesting': kw('globalNesting'), - 'globalString': kw('globalString'), - 'globalVar': kw('globalVar'), - 'GP': kw('GP'), - 'gray': kw('gray'), - 'group': kw('group'), - 'groupBy': kw('groupBy'), - 'groupid': kw('groupid'), - 'header': B, - 'header_layout': kw('header_layout'), - 'headerComment': kw('headerComment'), - 'headerData': kw('headerData'), - 'headerSpace': kw('headerSpace'), - 'headTag': kw('headTag'), - 'height': kw('height'), - 'helpText': kw('helpText'), - 'hidden': kw('hidden'), - 'hiddenFields': kw('hiddenFields'), - 'hide': kw('hide'), - 'hideButCreateMap': kw('hideButCreateMap'), - 'hidePStyleItems': kw('hidePStyleItems'), - 'hideRecords': kw('hideRecords'), - 'highColor': kw('highColor'), - 'history': kw('history'), - 'HMENU': kw('HMENU'), - 'hostname': A, - 'hour': A, - 'HTML': kw('HTML'), - 'html': B, - 'HTMLparser': kw('HTMLparser'), - 'HTMLparser_tags': kw('HTMLparser_tags'), - 'htmlSpecialChars': kw('htmlSpecialChars'), - 'htmlTag_setParams': kw('htmlTag_setParams'), - 'http': kw('http'), - 'icon': kw('icon'), - 'icon_image_ext_list': kw('icon_image_ext_list'), - 'icon_link': kw('icon_link'), - 'iconCObject': kw('iconCObject'), - 'id': B, - 'IENV': kw('IENV'), - 'if': B, - 'ifEmpty': B, - 'IFSUB': B, - 'IFSUBRO': B, - 'IMAGE': kw('IMAGE'), - 'image': B, - 'image_frames': kw('image_frames'), - 'imageLinkWrap': kw('imageLinkWrap'), - 'imagePath': kw('imagePath'), - 'images': kw('images'), - 'imageWrapIfAny': kw('imageWrapIfAny'), - 'IMG_RESOURCE': kw('IMG_RESOURCE'), - 'imgList': A, - 'imgMap': kw('imgMap'), - 'imgMapExtras': kw('imgMapExtras'), - 'imgMax': kw('imgMax'), - 'imgNameNotRandom': kw('imgNameNotRandom'), - 'imgNamePrefix': kw('imgNamePrefix'), - 'imgObjNum': kw('imgObjNum'), - 'imgParams': kw('imgParams'), - 'imgPath': kw('imgPath'), - 'imgResource': A, - 'imgStart': kw('imgStart'), - 'IMGTEXT': kw('IMGTEXT'), - 'imgText': A, - 'import': kw('import'), - 'inBranch': B, - 'inc': kw('inc'), - 'INCLUDE_TYPOSCRIPT': kw('INCLUDE_TYPOSCRIPT'), - 'includeCSS': kw('includeCSS'), - 'includeLibrary': kw('includeLibrary'), - 'includeNotInMenu': kw('includeNotInMenu'), - 'index': kw('index'), - 'index_descrLgd': kw('index_descrLgd'), - 'index_enable': kw('index_enable'), - 'index_externals': kw('index_externals'), - 'info': A, - 'inlineStyle2TempFile': kw('inlineStyle2TempFile'), - 'innerStdWrap': kw('innerStdWrap'), - 'innerStdWrap_all': kw('innerStdWrap_all'), - 'innerWrap': kw('innerWrap'), - 'innerWrap2': kw('innerWrap2'), - 'input': kw('input'), - 'inputLevels': kw('inputLevels'), - 'insertData': kw('insertData'), - 'intensity': kw('intensity'), - 'intTarget': kw('intTarget'), - 'intval': kw('intval'), - 'invert': kw('invert'), - 'IP': A, - 'IProcFunc': kw('IProcFunc'), - 'isFalse': B, - 'isGreaterThan': B, - 'isInList': B, - 'isLessThan': B, - 'isPositive': B, - 'isTrue': B, - 'itemArrayProcFunc': kw('itemArrayProcFunc'), - 'itemH': kw('itemH'), - 'items': kw('items'), - 'itemsProcFunc': kw('itemsProcFunc'), - 'iterations': kw('iterations'), - 'join': kw('join'), - 'JSwindow': A, - 'JSWindow': kw('JSWindow'), - 'JSwindow_params': kw('JSwindow_params'), - 'keep': kw('keep'), - 'keepEntries': kw('keepEntries'), - 'keepNonMatchedTags': kw('keepNonMatchedTags'), - 'key': kw('key'), - 'keyword3': B, - 'LABEL': A, - 'label': kw('label'), - 'labelStdWrap': kw('labelStdWrap'), - 'labelWrap': kw('labelWrap'), - 'lang': kw('lang'), - 'languageField': kw('languageField'), - 'layout': A, - 'left': kw('left'), - 'leftjoin': kw('leftjoin'), - 'levels': kw('levels'), - 'leveltitle': B, - 'leveluid': kw('leveluid'), - 'lib': A, - 'limit': kw('limit'), - 'line': kw('line'), - 'lineColor': kw('lineColor'), - 'lineThickness': kw('lineThickness'), - 'linkPrefix': kw('linkPrefix'), - 'linkTitleToSelf': kw('linkTitleToSelf'), - 'linkVars': kw('linkVars'), - 'linkWrap': kw('linkWrap'), - 'list': B, - 'listNum': kw('listNum'), - 'listOnlyInSingleTableView': kw('listOnlyInSingleTableView'), - 'LIT': kw('LIT'), - 'lm': kw('lm'), - 'LOAD_REGISTER': kw('LOAD_REGISTER'), - 'locale_all': kw('locale_all'), - 'localNesting': kw('localNesting'), - 'locationData': kw('locationData'), - 'login': B, - 'loginUser': A, - 'lowColor': kw('lowColor'), - 'lower': kw('lower'), - 'LR': kw('LR'), - 'mailform': B, - 'mailto': kw('mailto'), - 'main': kw('main'), - 'makelinks': kw('makelinks'), - 'markerWrap': kw('markerWrap'), - 'marks': A, - 'mask': kw('mask'), - 'max': kw('max'), - 'maxAge': kw('maxAge'), - 'maxChars': kw('maxChars'), - 'maxH': kw('maxH'), - 'maxHeight': kw('maxHeight'), - 'maxItems': kw('maxItems'), - 'maxW': kw('maxW'), - 'maxWidth': kw('maxWidth'), - 'maxWInText': kw('maxWInText'), - 'media': B, - 'menu': B, - 'menuHeight': kw('menuHeight'), - 'menuName': kw('menuName'), - 'menuOffset': kw('menuOffset'), - 'menuWidth': kw('menuWidth'), - 'message_preview': kw('message_preview'), - 'META': kw('META'), - 'meta': kw('meta'), - 'method': kw('method'), - 'min': kw('min'), - 'minH': kw('minH'), - 'minItems': kw('minItems'), - 'minute': A, - 'minW': kw('minW'), - 'mod': B, - 'mode': kw('mode'), - 'module': A, - 'month': A, - 'move_wizard': A, - 'MP_defaults': kw('MP_defaults'), - 'MP_disableTypolinkClosestMPvalue': kw('MP_disableTypolinkClosestMPvalue'), - 'MP_mapRootPoints': kw('MP_mapRootPoints'), - 'MULTIMEDIA': kw('MULTIMEDIA'), - 'multimedia': B, - 'name': kw('name'), - 'negate': B, - 'nesting': kw('nesting'), - 'neverHideAtCopy': kw('neverHideAtCopy'), - 'new': A, - 'NEW': B, - 'new_wizard': A, - 'newPageWiz': kw('newPageWiz'), - 'newRecordFromTable': kw('newRecordFromTable'), - 'newWindow': kw('newWindow'), - 'newWizards': kw('newWizards'), - 'next': kw('next'), - 'niceText': kw('niceText'), - 'nicetext': kw('nicetext'), - 'NO': B, - 'no_cache': kw('no_cache'), - 'no_search': kw('no_search'), - 'noAttrib': kw('noAttrib'), - 'noCache': kw('noCache'), - 'noCreateRecordsLink': kw('noCreateRecordsLink'), - 'noLink': kw('noLink'), - 'noMatchingValue_label': kw('noMatchingValue_label'), - 'nonCachedSubst': kw('nonCachedSubst'), - 'none': B, - 'nonTypoTagStdWrap': kw('nonTypoTagStdWrap'), - 'nonTypoTagUserFunc': kw('nonTypoTagUserFunc'), - 'nonWrappedTag': kw('nonWrappedTag'), - 'noOrderBy': kw('noOrderBy'), - 'noPageTitle': kw('noPageTitle'), - 'noResultObj': A, - 'noThumbsInEB': kw('noThumbsInEB'), - 'noTrimWrap': kw('noTrimWrap'), - 'noValueInsert': kw('noValueInsert'), - 'numRows': A, - 'obj': kw('obj'), - 'offset': kw('offset'), - 'onlineWorkspaceInfo': kw('onlineWorkspaceInfo'), - 'onlyCurrentPid': kw('onlyCurrentPid'), - 'opacity': kw('opacity'), - 'options': A, - 'orderBy': kw('orderBy'), - 'outerWrap': kw('outerWrap'), - 'outline': kw('outline'), - 'outputLevels': kw('outputLevels'), - 'override': kw('override'), - 'overrideAttribs': kw('overrideAttribs'), - 'overrideId': kw('overrideId'), - 'overridePageModule': kw('overridePageModule'), - 'PAGE': kw('PAGE'), - 'page': A, - 'PAGE_TARGET': kw('PAGE_TARGET'), - 'PAGE_TSCONFIG_ID': kw('PAGE_TSCONFIG_ID'), - 'PAGE_TSCONFIG_IDLIST': kw('PAGE_TSCONFIG_IDLIST'), - 'PAGE_TSCONFIG_STR': kw('PAGE_TSCONFIG_STR'), - 'pageFrameObj': kw('pageFrameObj'), - 'pages': B, - 'pageTitleFirst': kw('pageTitleFirst'), - 'pageTree': A, - 'parameter': kw('parameter'), - 'params': kw('params'), - 'parseFunc': kw('parseFunc'), - 'parseFunc_RTE': B, - 'parser': kw('parser'), - 'password': kw('password'), - 'paste': A, - 'path': kw('path'), - 'permissions': kw('permissions'), - 'perms': A, - 'pid': B, - 'pid_list': kw('pid_list'), - 'pidInList': kw('pidInList'), - 'PIDinRootline': A, - 'PIDupinRootline': A, - 'pixelSpaceFontSizeRef': kw('pixelSpaceFontSizeRef'), - 'plaintextLib': kw('plaintextLib'), - 'plainTextStdWrap': kw('plainTextStdWrap'), - 'plugin': A, - 'postCObject': kw('postCObject'), - 'postLineBlanks': kw('postLineBlanks'), - 'postLineChar': kw('postLineChar'), - 'postLineLen': kw('postLineLen'), - 'postUserFunc': kw('postUserFunc'), - 'postUserFuncInt': kw('postUserFuncInt'), - 'preBlanks': kw('preBlanks'), - 'preCObject': kw('preCObject'), - 'prefix': kw('prefix'), - 'prefixComment': kw('prefixComment'), - 'prefixRelPathWith': kw('prefixRelPathWith'), - 'preIfEmptyListNum': kw('preIfEmptyListNum'), - 'preLineBlanks': kw('preLineBlanks'), - 'preLineChar': kw('preLineChar'), - 'preLineLen': kw('preLineLen'), - 'prepend': kw('prepend'), - 'preserveEntities': kw('preserveEntities'), - 'preUserFunc': kw('preUserFunc'), - 'prev': kw('prev'), - 'preview': A, - 'previewBorder': kw('previewBorder'), - 'prevnextToSection': kw('prevnextToSection'), - 'prioriCalc': kw('prioriCalc'), - 'proc': kw('proc'), - 'processor_allowUpscaling': kw('processor_allowUpscaling'), - 'properties': kw('properties'), - 'protect': kw('protect'), - 'protectLvar': kw('protectLvar'), - 'publish': A, - 'publish_levels': kw('publish_levels'), - 'quality': kw('quality'), - 'RADIO': A, - 'radio': kw('radio'), - 'radioWrap': kw('radioWrap'), - 'range': kw('range'), - 'rawUrlEncode': kw('rawUrlEncode'), - 'recipient': kw('recipient'), - 'RECORDS': kw('RECORDS'), - 'recursive': kw('recursive'), - 'redirect': kw('redirect'), - 'redirectToURL': kw('redirectToURL'), - 'reduceColors': kw('reduceColors'), - 'references': kw('references'), - 'register': kw('register'), - 'relPathPrefix': kw('relPathPrefix'), - 'remap': kw('remap'), - 'remapTag': kw('remapTag'), - 'REMOTE_ADDR': kw('REMOTE_ADDR'), - 'removeDefaultJS': kw('removeDefaultJS'), - 'removeIfEquals': kw('removeIfEquals'), - 'removeIfFalse': kw('removeIfFalse'), - 'removeItems': kw('removeItems'), - 'removeObjectsOfDummy': kw('removeObjectsOfDummy'), - 'removePrependedNumbers': kw('removePrependedNumbers'), - 'removeTags': kw('removeTags'), - 'removeWrapping': kw('removeWrapping'), - 'renderObj': A, - 'renderWrap': kw('renderWrap'), - 'REQ': A, - 'required': B, - 'reset': kw('reset'), - 'resources': kw('resources'), - 'RESTORE_REGISTER': kw('RESTORE_REGISTER'), - 'resultObj': kw('resultObj'), - 'returnLast': kw('returnLast'), - 'returnUrl': kw('returnUrl'), - 'rightjoin': kw('rightjoin'), - 'rm': kw('rm'), - 'rmTagIfNoAttrib': kw('rmTagIfNoAttrib'), - 'RO': B, - 'rootline': B, - 'rotate': kw('rotate'), - 'rows': kw('rows'), - 'rowSpace': kw('rowSpace'), - 'RTE': A, - 'RTE_compliant': A, - 'rules': kw('rules'), - 'sample': kw('sample'), - 'saveClipboard': kw('saveClipboard'), - 'saveDocNew': kw('saveDocNew'), - 'script': B, - 'search': B, - 'SEARCHRESULT': kw('SEARCHRESULT'), - 'secondRow': kw('secondRow'), - 'section': kw('section'), - 'sectionIndex': kw('sectionIndex'), - 'select': A, - 'selectFields': kw('selectFields'), - 'separator': kw('separator'), - 'set': kw('set'), - 'setContentToCurrent': kw('setContentToCurrent'), - 'setCurrent': kw('setCurrent'), - 'setfixed': kw('setfixed'), - 'setOnly': kw('setOnly'), - 'setup': A, - 'shadow': kw('shadow'), - 'SHARED': kw('SHARED'), - 'sharpen': kw('sharpen'), - 'shear': kw('shear'), - 'short': kw('short'), - 'shortcut': B, - 'shortcutFrame': kw('shortcutFrame'), - 'shortcutIcon': kw('shortcutIcon'), - 'show': kw('show'), - 'showAccessRestrictedPages': kw('showAccessRestrictedPages'), - 'showActive': kw('showActive'), - 'showFirst': kw('showFirst'), - 'showHiddenPages': kw('showHiddenPages'), - 'showHiddenRecords': kw('showHiddenRecords'), - 'showHistory': kw('showHistory'), - 'showPageIdWithTitle': kw('showPageIdWithTitle'), - 'showTagFreeClasses': kw('showTagFreeClasses'), - 'showWebsiteTitle': kw('showWebsiteTitle'), - 'simulateDate': kw('simulateDate'), - 'simulateUserGroup': kw('simulateUserGroup'), - 'singlePid': kw('singlePid'), - 'site_author': kw('site_author'), - 'site_reserved': kw('site_reserved'), - 'sitemap': B, - 'siteUrl': kw('siteUrl'), - 'size': kw('size'), - 'solarize': kw('solarize'), - 'sorting': kw('sorting'), - 'source': kw('source'), - 'space': kw('space'), - 'spaceBelowAbove': kw('spaceBelowAbove'), - 'spaceLeft': kw('spaceLeft'), - 'spaceRight': kw('spaceRight'), - 'spacing': kw('spacing'), - 'spamProtectEmailAddresses': kw('spamProtectEmailAddresses'), - 'spamProtectEmailAddresses_atSubst': kw('spamProtectEmailAddresses_atSubst'), - 'spamProtectEmailAddresses_lastDotSubst': kw('spamProtectEmailAddresses_lastDotSubst'), - 'SPC': B, - 'special': kw('special'), - 'split': A, - 'splitChar': kw('splitChar'), - 'splitRendering': kw('splitRendering'), - 'src': kw('src'), - 'stdWrap': A, - 'stdWrap2': kw('stdWrap2'), - 'strftime': kw('strftime'), - 'stripHtml': kw('stripHtml'), - 'styles': kw('styles'), - 'submenuObjSuffixes': kw('submenuObjSuffixes'), - 'subMenuOffset': kw('subMenuOffset'), - 'submit': kw('submit'), - 'subparts': A, - 'subst_elementUid': kw('subst_elementUid'), - 'substMarksSeparately': kw('substMarksSeparately'), - 'substring': kw('substring'), - 'swirl': kw('swirl'), - 'sys_dmail': B, - 'sys_filemounts': B, - 'sys_note': B, - 'sys_template': B, - 'system': A, - 'table': B, - 'tableCellColor': kw('tableCellColor'), - 'tableParams': kw('tableParams'), - 'tables': kw('tables'), - 'tableStdWrap': kw('tableStdWrap'), - 'tableWidth': kw('tableWidth'), - 'tags': kw('tags'), - 'target': kw('target'), - 'TCAdefaults': kw('TCAdefaults'), - 'TCEFORM': kw('TCEFORM'), - 'TCEMAIN': kw('TCEMAIN'), - 'TDparams': kw('TDparams'), - 'temp': A, - 'template': A, - 'templateContent': kw('templateContent'), - 'templateFile': kw('templateFile'), - 'TEXT': kw('TEXT'), - 'text': B, - 'textarea': kw('textarea'), - 'textMargin': kw('textMargin'), - 'textMargin_outOfText': kw('textMargin_outOfText'), - 'textMaxLength': kw('textMaxLength'), - 'textObjNum': kw('textObjNum'), - 'textpic': B, - 'textPos': kw('textPos'), - 'thickness': kw('thickness'), - 'this': B, - 'tile': kw('tile'), - 'time_stdWrap': kw('time_stdWrap'), - 'tipafriendLib': kw('tipafriendLib'), - 'title': kw('title'), - 'titleLen': kw('titleLen'), - 'titleText': kw('titleText'), - 'tm': kw('tm'), - 'TMENU': kw('TMENU'), - 'TMENUITEM': kw('TMENUITEM'), - 'token': kw('token'), - 'top': B, - 'totalWidth': kw('totalWidth'), - 'transparentBackground': kw('transparentBackground'), - 'transparentColor': kw('transparentColor'), - 'treeLevel': A, - 'trim': kw('trim'), - 'true': B, - 'tsdebug': A, - 'tsdebug_tree': kw('tsdebug_tree'), - 'TSFE': kw('TSFE'), - 'type': kw('type'), - 'typeNum': kw('typeNum'), - 'types': kw('types'), - 'typolink': A, - 'uid': B, - 'uidInList': kw('uidInList'), - 'uniqueGlobal': B, - 'uniqueLocal': B, - 'unset': kw('unset'), - 'unsetEmpty': B, - 'updated': B, - 'uploads': B, - 'upper': kw('upper'), - 'url': A, - 'us': B, - 'useLargestItemX': kw('useLargestItemX'), - 'useLargestItemY': kw('useLargestItemY'), - 'USER': kw('USER'), - 'user': kw('user'), - 'USER_INT': kw('USER_INT'), - 'user_task': B, - 'useragent': A, - 'USERDEF1': B, - 'USERDEF1RO': B, - 'USERDEF2': B, - 'USERDEF2RO': B, - 'userdefined': kw('userdefined'), - 'userFunc': A, - 'userfunction': kw('userfunction'), - 'usergroup': B, - 'userid': kw('userid'), - 'userProc': kw('userProc'), - 'USR': B, - 'USRRO': B, - 'value': kw('value'), - 'valueArray': kw('valueArray'), - 'version': A, - 'view': A, - 'wave': kw('wave'), - 'web_func': B, - 'web_info': B, - 'web_layout': B, - 'web_list': B, - 'web_ts': kw('web_ts'), - 'where': kw('where'), - 'width': kw('width'), - 'wiz': kw('wiz'), - 'wordSpacing': kw('wordSpacing'), - 'workArea': kw('workArea'), - 'workOnSubpart': A, - 'wrap': kw('wrap'), - 'wrap1': kw('wrap1'), - 'wrap2': kw('wrap2'), - 'wrap3': kw('wrap3'), - 'wrapAfterTags': kw('wrapAfterTags'), - 'wrapAlign': kw('wrapAlign'), - 'wrapFieldName': kw('wrapFieldName'), - 'wrapItemAndSub': kw('wrapItemAndSub'), - 'wrapNonWrappedLines': kw('wrapNonWrappedLines'), - 'wraps': kw('wraps'), - 'xhtml_cleaning': kw('xhtml_cleaning'), - 'xhtml_strict': B, - 'xhtml_trans': B, - 'xmlprologue': kw('xmlprologue'), - 'XY': B - }; - }(); - - var isOperatorChar = /[\+\-\*\&\%\/=<>!\?]/; - var inValue = false; - - function readRegexp(stream) { - var escaped = false, next, inSet = false; - while ((next = stream.next()) != null) { - if (!escaped) { - if (next === "/" && !inSet) return; - if (next === "[") inSet = true; - else if (inSet && next === "]") inSet = false; - } - escaped = !escaped && next === "\\"; - } - } - - // Used as scratch variables to communicate multiple values without - // consing up tons of objects. - var type, content; - - function ret(tp, style, cont) { - type = tp; - content = cont; - return style; - } - - function tokenBase(stream, state) { - var ch = stream.next(); - if (ch === "\n") { - inValue = false; - } - - if (ch === "." && stream.match(/^\d+(?:[eE][+\-]?\d+)?/)) { - return ret("number", "number"); - } - if (ch === "." && stream.match("..")) { - return ret("spread", "meta"); - } - if (/[\[\]{}\(\),;\:\.]/.test(ch)) { - return ret(ch); - } - if ((ch === '<' || ch === '>' || ch === '.' || (ch === '=' && stream.peek() !== '<'))) { - inValue = true; - return ret(ch, 'operator') - } - if (!inValue && /[\[\]\(\),;\:\.\<\>\=]/.test(ch)) { - return ret(ch, 'operator') - } - if (ch === "0" && stream.eat(/x/i)) { - stream.eatWhile(/[\da-f]/i); - return ret("number", "number"); - } - if (ch === "0" && stream.eat(/o/i)) { - stream.eatWhile(/[0-7]/i); - return ret("number", "number"); - } - if (ch === "0" && stream.eat(/b/i)) { - stream.eatWhile(/[01]/i); - return ret("number", "number"); - } - if (/\d/.test(ch)) { - stream.match(/^\d*(?:\.\d+)?(?:[eE][+\-]?\d+)?/); - return ret("number", "number"); - } - if (ch === "/") { - if (stream.eat("*")) { - state.tokenize = tokenComment; - return tokenComment(stream, state); - } - if (stream.eat("/")) { - stream.skipToEnd(); - return ret("comment", "comment"); - } - if (expressionAllowed(stream, state, 1)) { - readRegexp(stream); - stream.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/); - return ret("regexp", "string-2"); - } - - stream.eatWhile(isOperatorChar); - return ret("operator", "operator", stream.current()); - } - if (ch === "`") { - state.tokenize = tokenQuasi; - return tokenQuasi(stream, state); - } - if (ch === "#") { - stream.skipToEnd(); - return ret("comment", "comment"); - } - if (isOperatorChar.test(ch)) { - if (ch !== ">" || !state.lexical || state.lexical.type !== ">") { - stream.eatWhile(isOperatorChar); - } - return ret("operator", "operator", stream.current()); - } - if (wordRE.test(ch)) { - stream.eatWhile(wordRE); - var word = stream.current(); - if (keywords.propertyIsEnumerable(word)) { - var kw = keywords[word]; - return ret(kw.type, kw.style, word); - } - if (word === "async" && stream.match(/^\s*[\(\w]/, false)) { - return ret("async", "keyword", word); - } - if (inValue) { - return ret('string', 'string', word); - } - return ret("variable", "other", word); - } - } - - function tokenString(quote) { - return function(stream, state) { - var escaped = false, next; - while ((next = stream.next()) != null) { - if (next == quote && !escaped) break; - escaped = !escaped && next === "\\"; - } - if (!escaped) state.tokenize = tokenBase; - return ret("string", "string"); - }; - } - - function tokenComment(stream, state) { - var maybeEnd = false, ch; - while (ch = stream.next()) { - if (ch === "/" && maybeEnd) { - state.tokenize = tokenBase; - break; - } - maybeEnd = (ch === "*"); - } - return ret("comment", "comment"); - } - - function tokenQuasi(stream, state) { - var escaped = false, next; - while ((next = stream.next()) != null) { - if (!escaped && (next === "`" || next === "$" && stream.eat("{"))) { - state.tokenize = tokenBase; - break; - } - escaped = !escaped && next === "\\"; - } - return ret("quasi", "string-2", stream.current()); - } - - var brackets = "([{}])"; - // This is a crude lookahead trick to try and notice that we're - // parsing the argument patterns for a fat-arrow function before we - // actually hit the arrow token. It only works if the arrow is on - // the same line as the arguments and there's no strange noise - // (comments) in between. Fallback is to only notice when we hit the - // arrow, and not declare the arguments as locals for the arrow - // body. - function findFatArrow(stream, state) { - if (state.fatArrowAt) state.fatArrowAt = null; - var arrow = stream.string.indexOf("=>", stream.start); - if (arrow < 0) return; - - var depth = 0, sawSomething = false; - for (var pos = arrow - 1; pos >= 0; --pos) { - var ch = stream.string.charAt(pos); - var bracket = brackets.indexOf(ch); - if (bracket >= 0 && bracket < 3) { - if (!depth) { - ++pos; - break; - } - if (--depth == 0) { - if (ch === "(") sawSomething = true; - break; - } - } else if (bracket >= 3 && bracket < 6) { - ++depth; - } else if (wordRE.test(ch)) { - sawSomething = true; - } else if (/["'\/]/.test(ch)) { - return; - } else if (sawSomething && !depth) { - ++pos; - break; - } - } - if (sawSomething && !depth) state.fatArrowAt = pos; - } - - // Parser - - var atomicTypes = { - "atom": true, - "number": true, - "variable": true, - "string": true, - "regexp": true - }; - - function TSLexical(indented, column, type, align, prev, info) { - this.indented = indented; - this.column = column; - this.type = type; - this.prev = prev; - this.info = info; - if (align != null) this.align = align; - } - - function inScope(state, varname) { - for (var v = state.localVars; v; v = v.next) - if (v.name == varname) return true; - for (var cx = state.context; cx; cx = cx.prev) { - for (var v = cx.vars; v; v = v.next) - if (v.name == varname) return true; - } - } - - function parseTS(state, style, type, content, stream) { - var cc = state.cc; - // Communicate our context to the combinators. - // (Less wasteful than consing up a hundred closures on every call.) - cx.state = state; - cx.stream = stream; - cx.marked = null; - cx.cc = cc; - cx.style = style; - - if (!state.lexical.hasOwnProperty("align")) - state.lexical.align = true; - - while (true) { - var combinator = cc.length ? cc.pop() : statement; - if (typeof combinator === 'function' && combinator(type, content)) { - while (cc.length && cc[cc.length - 1] && cc[cc.length - 1].lex) - cc.pop()(); - if (cx.marked) return cx.marked; - if (type === "variable" && inScope(state, content)) return "variable-2"; - return style; - } - } - } - - // Combinator utils - - var cx = {state: null, column: null, marked: null, cc: null}; - - function pass() { - for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]); - } - - function cont() { - pass.apply(null, arguments); - return true; - } - - function register(varname) { - function inList(list) { - for (var v = list; v; v = v.next) - if (v.name == varname) return true; - return false; - } - - var state = cx.state; - cx.marked = "def"; - if (state.context) { - if (inList(state.localVars)) return; - state.localVars = {name: varname, next: state.localVars}; - } else { - if (inList(state.globalVars)) return; - if (parserConfig.globalVars) - state.globalVars = {name: varname, next: state.globalVars}; - } - } - - // Combinators - - var defaultVars = {name: "this", next: {name: "arguments"}}; - - function pushcontext() { - cx.state.context = {prev: cx.state.context, vars: cx.state.localVars}; - cx.state.localVars = defaultVars; - } - - function popcontext() { - cx.state.localVars = cx.state.context.vars; - cx.state.context = cx.state.context.prev; - } - - function pushlex(type, info) { - var result = function() { - var state = cx.state, indent = state.indented; - if (state.lexical.type === "stat") indent = state.lexical.indented; - else for (var outer = state.lexical; outer && outer.type === ")" && outer.align; outer = outer.prev) - indent = outer.indented; - state.lexical = new TSLexical(indent, cx.stream.column(), type, null, state.lexical, info); - }; - result.lex = true; - return result; - } - - function poplex() { - var state = cx.state; - if (state.lexical.prev) { - if (state.lexical.type === ")") - state.indented = state.lexical.indented; - state.lexical = state.lexical.prev; - } - } - - poplex.lex = true; - - function expect(wanted) { - function exp(type) { - if (type == wanted) return cont(); - else if (wanted === ";") return pass(); - else return cont(exp); - }; - return exp; - } - - function statement(type, value) { - if (type === "var") return cont(pushlex("vardef", value.length), vardef, expect(";"), poplex); - if (type === "keyword a") return cont(pushlex("form"), parenExpr, statement, poplex); - if (type === "keyword b") return cont(pushlex("form"), statement, poplex); - if (type === "{") return cont(pushlex("}"), block, poplex); - if (type === ";") return cont(); - if (type === "if") { - if (cx.state.lexical.info === "else" && cx.state.cc[cx.state.cc.length - 1] == poplex) { - cx.state.cc.pop()(); - } - return cont(pushlex("form"), parenExpr, statement, poplex, maybeelse); - } - if (type === "function") return cont(functiondef); - if (type === "for") return cont(pushlex("form"), forspec, statement, poplex); - if (type === "variable") { - return cont(pushlex("stat"), maybelabel); - } - if (type === "switch") return cont(pushlex("form"), parenExpr, expect("{"), pushlex("}", "switch"), - block, poplex, poplex); - if (type === "case") return cont(expression, expect(":")); - if (type === "default") return cont(expect(":")); - if (type === "catch") return cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"), - statement, poplex, popcontext); - if (type === "class") return cont(pushlex("form"), className, poplex); - if (type === "export") return cont(pushlex("stat"), afterExport, poplex); - if (type === "import") return cont(pushlex("stat"), afterImport, poplex); - if (type === "module") return cont(pushlex("form"), pattern, expect("{"), pushlex("}"), block, poplex, poplex) - if (type === "async") return cont(statement) - if (value === "@") return cont(expression, statement) - return pass(pushlex("stat"), expression, expect(";"), poplex); - } - - function expression(type) { - return expressionInner(type, false); - } - - function expressionNoComma(type) { - return expressionInner(type, true); - } - - function parenExpr(type) { - if (type !== "(") return pass() - return cont(pushlex(")"), expression, expect(")"), poplex) - } - - function expressionInner(type, noComma) { - var maybeop = noComma ? maybeoperatorNoComma : maybeoperatorComma; - if (atomicTypes.hasOwnProperty(type)) { - return cont(maybeop); - } - if (type === "keyword c") { - return cont(noComma ? maybeexpressionNoComma : maybeexpression); - } - if (type === "(") { - return cont(pushlex(")"), maybeexpression, expect(")"), poplex, maybeop); - } - if (type === "operator" || type === "spread") { - return cont(noComma ? expressionNoComma : expression); - } - if (type === "[") { - return cont(pushlex("]"), arrayLiteral, poplex, maybeop); - } - if (type === "{") { - return contCommasep(objprop, "}", null, maybeop); - } - return cont(); - } - - function maybeexpression(type) { - if (type.match(/[;\}\)\],]/)) return pass(); - return pass(expression); - } - - function maybeexpressionNoComma(type) { - if (type.match(/[;\}\)\],]/)) return pass(); - return pass(expressionNoComma); - } - - function maybeoperatorComma(type, value) { - if (type === ",") return cont(expression); - return maybeoperatorNoComma(type, value, false); - } - - function maybeoperatorNoComma(type, value, noComma) { - var me = noComma == false ? maybeoperatorComma : maybeoperatorNoComma; - var expr = noComma == false ? expression : expressionNoComma; - if (type === "=>") return cont(pushcontext, noComma ? arrowBodyNoComma : arrowBody, popcontext); - if (type === "operator") { - if (/\+\+|--/.test(value)) return cont(me); - if (value === "?") return cont(expression, expect(":"), expr); - return cont(expr); - } - if (type === "quasi") { - return pass(quasi, me); - } - if (type === ";") return; - if (type === "(") return contCommasep(expressionNoComma, ")", "call", me); - if (type === ".") return cont(property, me); - if (type === "[") return cont(pushlex("]"), maybeexpression, expect("]"), poplex, me); - } - - function quasi(type, value) { - if (type !== "quasi") return pass(); - if (value.slice(value.length - 2) !== "${") return cont(quasi); - return cont(expression, continueQuasi); - } - - function continueQuasi(type) { - if (type === "}") { - cx.marked = "string-2"; - cx.state.tokenize = tokenQuasi; - return cont(quasi); - } - } - - function arrowBody(type) { - findFatArrow(cx.stream, cx.state); - return pass(type === "{" ? statement : expression); - } - - function arrowBodyNoComma(type) { - findFatArrow(cx.stream, cx.state); - return pass(type === "{" ? statement : expressionNoComma); - } - - function maybeTarget(noComma) { - return function(type) { - if (type === ".") return cont(noComma ? targetNoComma : target); - else return pass(noComma ? expressionNoComma : expression); - }; - } - - function target(_, value) { - if (value === "target") { - cx.marked = "keyword"; - return cont(maybeoperatorComma); - } - } - - function targetNoComma(_, value) { - if (value === "target") { - cx.marked = "keyword"; - return cont(maybeoperatorNoComma); - } - } - - function maybelabel(type) { - if (type === ":") return cont(poplex, statement); - return pass(maybeoperatorComma, expect(";"), poplex); - } - - function property(type) { - if (type === "variable") { - cx.marked = "property"; - return cont(); - } - } - - function objprop(type, value) { - if (type === "async") { - cx.marked = "property"; - return cont(objprop); - } else if (type === "variable" || cx.style === "keyword") { - cx.marked = "property"; - if (value === "get" || value === "set") return cont(getterSetter); - return cont(afterprop); - } else if (type === "number" || type === "string") { - cx.marked = cx.style + " property"; - return cont(afterprop); - } else if (type === "jsonld-keyword") { - return cont(afterprop); - } else if (type === "modifier") { - return cont(objprop) - } else if (type === "[") { - return cont(expression, expect("]"), afterprop); - } else if (type === "spread") { - return cont(expression, afterprop); - } else if (type === ":") { - return pass(afterprop) - } - } - - function getterSetter(type) { - if (type !== "variable") return pass(afterprop); - cx.marked = "property"; - return cont(functiondef); - } - - function afterprop(type) { - if (type === ":") return cont(expressionNoComma); - if (type === "(") return pass(functiondef); - } - - function commasep(what, end, sep) { - function proceed(type, value) { - if (sep ? sep.indexOf(type) > -1 : type === ",") { - var lex = cx.state.lexical; - if (lex.info === "call") lex.pos = (lex.pos || 0) + 1; - return cont(function(type, value) { - if (type == end || value == end) return pass() - return pass(what) - }, proceed); - } - if (type == end || value == end) return cont(); - return cont(expect(end)); - } - - return function(type, value) { - if (type == end || value == end) return cont(); - return pass(what, proceed); - }; - } - - function contCommasep(what, end, info) { - for (var i = 3; i < arguments.length; i++) - cx.cc.push(arguments[i]); - return cont(pushlex(end, info), commasep(what, end), poplex); - } - - function block(type) { - if (type === "}") return cont(); - return pass(statement, block); - } - - function typeexpr(type) { - if (type === "variable") { - cx.marked = "type"; - return cont(afterType); - } - if (type === "string" || type === "number" || type === "atom") return cont(afterType); - if (type === "{") return cont(pushlex("}"), commasep(typeprop, "}", ",;"), poplex, afterType) - if (type === "(") return cont(commasep(typearg, ")"), maybeReturnType) - } - - function maybeReturnType(type) { - if (type === "=>") return cont(typeexpr) - } - - function typeprop(type, value) { - if (type === "variable" || cx.style === "keyword") { - cx.marked = "property" - return cont(typeprop) - } else if (value === "?") { - return cont(typeprop) - } else if (type === ":") { - return cont(typeexpr) - } else if (type === "[") { - return cont(expression, null, expect("]"), typeprop) - } - } - - function typearg(type) { - if (type === "variable") return cont(typearg) - else if (type === ":") return cont(typeexpr) - } - - function afterType(type, value) { - if (value === "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, afterType) - if (value === "|" || type === ".") return cont(typeexpr) - if (type === "[") return cont(expect("]"), afterType) - if (value === "extends") return cont(typeexpr) - } - - function vardef() { - return pass(pattern, null, maybeAssign, vardefCont); - } - - function pattern(type, value) { - if (type === "modifier") return cont(pattern) - if (type === "variable") { - register(value); - return cont(); - } - if (type === "spread") return cont(pattern); - if (type === "[") return contCommasep(pattern, "]"); - if (type === "{") return contCommasep(proppattern, "}"); - } - - function proppattern(type, value) { - if (type === "variable" && !cx.stream.match(/^\s*:/, false)) { - register(value); - return cont(maybeAssign); - } - if (type === "variable") cx.marked = "property"; - if (type === "spread") return cont(pattern); - if (type === "}") return pass(); - return cont(expect(":"), pattern, maybeAssign); - } - - function maybeAssign(_type, value) { - if (value === "=") return cont(expressionNoComma); - } - - function vardefCont(type) { - if (type === ",") return cont(vardef); - } - - function maybeelse(type, value) { - if (type === "keyword b" && value === "else") return cont(pushlex("form", "else"), statement, poplex); - } - - function forspec(type) { - if (type === "(") return cont(pushlex(")"), forspec1, expect(")"), poplex); - } - - function forspec1(type) { - if (type === "var") return cont(vardef, expect(";"), forspec2); - if (type === ";") return cont(forspec2); - if (type === "variable") return cont(formaybeinof); - return pass(expression, expect(";"), forspec2); - } - - function formaybeinof(_type, value) { - if (value === "in" || value === "of") { - cx.marked = "keyword"; - return cont(expression); - } - return cont(maybeoperatorComma, forspec2); - } - - function forspec2(type, value) { - if (type === ";") return cont(forspec3); - if (value === "in" || value === "of") { - cx.marked = "keyword"; - return cont(expression); - } - return pass(expression, expect(";"), forspec3); - } - - function forspec3(type) { - if (type !== ")") cont(expression); - } - - function functiondef(type, value) { - if (value === "*") { - cx.marked = "keyword"; - return cont(functiondef); - } - if (type === "variable") { - register(value); - return cont(functiondef); - } - if (type === "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, null, statement, popcontext); - } - - function funarg(type) { - if (type === "spread") return cont(funarg); - return pass(pattern, null, maybeAssign); - } - - function classExpression(type, value) { - // Class expressions may have an optional name. - if (type === "variable") return className(type, value); - return classNameAfter(type, value); - } - - function className(type, value) { - if (type === "variable") { - register(value); - return cont(classNameAfter); - } - } - - function classNameAfter(type, value) { - if (value === "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, classNameAfter) - if (value === "extends" || value === "implements") - return cont(expression, classNameAfter); - if (type === "{") return cont(pushlex("}"), classBody, poplex); - } - - function classBody(type, value) { - if (type === "variable" || cx.style === "keyword") { - if ((value === "async" || value === "static" || value === "get" || value === "set") && - cx.stream.match(/^\s+[\w$\xa1-\uffff]/, false)) { - cx.marked = "keyword"; - return cont(classBody); - } - cx.marked = "property"; - return cont(functiondef, classBody); - } - if (type === "[") - return cont(expression, expect("]"), functiondef, classBody) - if (value === "*") { - cx.marked = "keyword"; - return cont(classBody); - } - if (type === ";") return cont(classBody); - if (type === "}") return cont(); - if (value === "@") return cont(expression, classBody) - } - - function classfield(type, value) { - if (value === "?") return cont(classfield) - if (type === ":") return cont(typeexpr, maybeAssign) - if (value === "=") return cont(expressionNoComma) - return pass(functiondef) - } - - function afterExport(type, value) { - if (value === "*") { - cx.marked = "keyword"; - return cont(maybeFrom, expect(";")); - } - if (value === "default") { - cx.marked = "keyword"; - return cont(expression, expect(";")); - } - if (type === "{") return cont(commasep(exportField, "}"), maybeFrom, expect(";")); - return pass(statement); - } - - function exportField(type, value) { - if (value === "as") { - cx.marked = "keyword"; - return cont(expect("variable")); - } - if (type === "variable") return pass(expressionNoComma, exportField); - } - - function afterImport(type) { - if (type === "string") return cont(); - return pass(importSpec, maybeMoreImports, maybeFrom); - } - - function importSpec(type, value) { - if (type === "{") return contCommasep(importSpec, "}"); - if (type === "variable") register(value); - if (value === "*") cx.marked = "keyword"; - return cont(maybeAs); - } - - function maybeMoreImports(type) { - if (type === ",") return cont(importSpec, maybeMoreImports) - } - - function maybeAs(_type, value) { - if (value === "as") { - cx.marked = "keyword"; - return cont(importSpec); - } - } - - function maybeFrom(_type, value) { - if (value === "from") { - cx.marked = "keyword"; - return cont(expression); - } - } - - function arrayLiteral(type) { - if (type === "]") return cont(); - return pass(commasep(expressionNoComma, "]")); - } - - function isContinuedStatement(state, textAfter) { - return state.lastType === "operator" || state.lastType === "," || - isOperatorChar.test(textAfter.charAt(0)) || - /[,.]/.test(textAfter.charAt(0)); - } - - // Interface - - return { - startState: function(indentUnit) { - var state = { - tokenize: tokenBase, - lastType: "sof", - cc: [], - lexical: new TSLexical(-indentUnit, 0, "block", false), - localVars: parserConfig.localVars, - context: parserConfig.localVars && {vars: parserConfig.localVars}, - indented: 0 - }; - if (parserConfig.globalVars && typeof parserConfig.globalVars === "object") - state.globalVars = parserConfig.globalVars; - return state; - }, - - token: function(stream, state) { - if (stream.sol()) { - if (!state.lexical.hasOwnProperty("align")) - state.lexical.align = false; - state.indented = stream.indentation(); - findFatArrow(stream, state); - } - if (state.tokenize != tokenComment && stream.eatSpace()) return null; - var style = state.tokenize(stream, state); - if (type === "comment") return style; - state.lastType = type === "operator" && (content === "++" || content === "--") ? "incdec" : type; - return parseTS(state, style, type, content, stream); - }, - - indent: function(state, textAfter, cx) { - if (state.tokenize == tokenComment) return CodeMirror.Pass; - if (state.tokenize != tokenBase) return 0; - var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical, top - // Kludge to prevent 'maybelse' from blocking lexical scope pops - if (!/^\s*else\b/.test(textAfter)) for (var i = state.cc.length - 1; i >= 0; --i) { - var c = state.cc[i]; - if (c == poplex) lexical = lexical.prev; - else if (c != maybeelse) break; - } - while ((lexical.type === "stat" || lexical.type === "form") && - (firstChar === "}" || ((top = state.cc[state.cc.length - 1]) && - (top == maybeoperatorComma || top == maybeoperatorNoComma) && - !/^[,\.=+\-*:?[\(]/.test(textAfter)))) - lexical = lexical.prev; - if (statementIndent && lexical.type === ")" && lexical.prev.type === "stat") - lexical = lexical.prev; - var type = lexical.type, closing = firstChar == type; - - if (type === "vardef") return lexical.indented + (state.lastType === "operator" || state.lastType === "," ? lexical.info + 1 : 0); - else if (type === "form" && firstChar === "{") return lexical.indented; - else if (type === "form") return lexical.indented + cx.unit; - else if (type === "stat") - return lexical.indented + (isContinuedStatement(state, textAfter) ? statementIndent || cx.unit : 0); - else if (lexical.info === "switch" && !closing && parserConfig.doubleIndentSwitch != false) - return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit); - else if (lexical.align) return lexical.column + (closing ? 0 : 1); - else return lexical.indented + (closing ? 0 : cx.unit); - }, - - electricInput: /^\s*(?:case .*?:|default:|\{|\})$/, - blockCommentStart: "/*", - blockCommentEnd: "*/", - lineComment: "#", - fold: "brace", - closeBrackets: "()[]{}''\"\"``", - - helperType: "typoscript", - - expressionAllowed: expressionAllowed, - skipExpression: function(state) { - var top = state.cc[state.cc.length - 1]; - if (top == expression || top == expressionNoComma) state.cc.pop() - } - } - } - - return doCreateTypoScriptMode(); -} - -export const typoScriptStreamParser = createTypoScriptMode(); +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +class TSLexical{constructor(e,t,a,r,i,n){this.indented=e,this.column=t,this.type=a,this.prev=i,this.info=n,null!=r&&(this.align=r)}}function expressionAllowed(e,t){return/^(?:operator|sof|keyword c|case|new|export|default|[\[{}\(,;:]|=>)$/.test(t.lastType)}export class TypoScriptStreamParserFactory{create(){const e=/[\w$\xa1-\uffff]/,t={name:"typoscript",localVars:void 0,doubleIndentSwitch:!1},a=function(){function e(e){return{type:e,style:"keyword"}}const t=e("keyword a"),a=e("keyword b");return{_CSS_DEFAULT_STYLE:e("_CSS_DEFAULT_STYLE"),_LOCAL_LANG:e("_LOCAL_LANG"),_offset:e("_offset"),absRefPrefix:e("absRefPrefix"),accessibility:e("accessibility"),ACT:a,ACTIFSUB:a,ACTIFSUBRO:e("ACTIFSUBRO"),ACTRO:a,addAttributes:e("addAttributes"),addExtUrlsAndShortCuts:e("addExtUrlsAndShortCuts"),addItems:e("addItems"),additionalHeaders:e("additionalHeaders"),additionalParams:e("additionalParams"),addQueryString:e("addQueryString"),adjustItemsH:e("adjustItemsH"),adjustSubItemsH:e("adjustSubItemsH"),admPanel:t,after:e("after"),afterImg:e("afterImg"),afterImgLink:e("afterImgLink"),afterImgTagParams:e("afterImgTagParams"),afterROImg:e("afterROImg"),afterWrap:e("afterWrap"),age:e("age"),alertPopups:e("alertPopups"),align:e("align"),all:a,allow:e("allow"),allowCaching:e("allowCaching"),allowedAttribs:e("allowedAttribs"),allowedClasses:e("allowedClasses"),allowedCols:e("allowedCols"),allowedNewTables:e("allowedNewTables"),allowTags:e("allowTags"),allStdWrap:e("allStdWrap"),allWrap:e("allWrap"),alt_print:t,alternativeSortingField:e("alternativeSortingField"),altIcons:e("altIcons"),altImgResource:e("altImgResource"),altLabels:e("altLabels"),altTarget:e("altTarget"),altText:e("altText"),altUrl:e("altUrl"),altUrl_noDefaultParams:e("altUrl_noDefaultParams"),altWrap:e("altWrap"),always:e("always"),alwaysActivePIDlist:e("alwaysActivePIDlist"),alwaysLink:e("alwaysLink"),andWhere:e("andWhere"),angle:e("angle"),antiAlias:e("antiAlias"),append:e("append"),applyTotalH:e("applyTotalH"),applyTotalW:e("applyTotalW"),archive:e("archive"),ascii:a,ATagAfterWrap:e("ATagAfterWrap"),ATagBeforeWrap:e("ATagBeforeWrap"),ATagParams:e("ATagParams"),ATagTitle:e("ATagTitle"),atLeast:a,atMost:a,attribute:e("attribute"),auth:t,autoLevels:e("autoLevels"),autonumber:e("autonumber"),backColor:e("backColor"),background:e("background"),baseURL:e("baseURL"),BE:a,be_groups:a,be_users:a,before:e("before"),beforeImg:e("beforeImg"),beforeImgLink:e("beforeImgLink"),beforeImgTagParams:e("beforeImgTagParams"),beforeROImg:e("beforeROImg"),beforeWrap:e("beforeWrap"),begin:e("begin"),bgCol:e("bgCol"),bgImg:e("bgImg"),blur:e("blur"),bm:e("bm"),bodyTag:e("bodyTag"),bodyTagAdd:e("bodyTagAdd"),bodyTagCObject:e("bodyTagCObject"),bodytext:e("bodytext"),borderCol:e("borderCol"),borderThick:e("borderThick"),bottomBackColor:e("bottomBackColor"),bottomContent:e("bottomContent"),bottomHeight:e("bottomHeight"),bottomImg:e("bottomImg"),bottomImg_mask:e("bottomImg_mask"),BOX:a,br:e("br"),browse:a,browser:t,brTag:e("brTag"),bullet:e("bullet"),bulletlist:e("bulletlist"),bullets:a,bytes:e("bytes"),cache:t,cache_clearAtMidnight:e("cache_clearAtMidnight"),cache_period:e("cache_period"),caption:e("caption"),caption_stdWrap:e("caption_stdWrap"),captionHeader:e("captionHeader"),captionSplit:e("captionSplit"),CARRAY:e("CARRAY"),CASE:e("CASE"),case:e("case"),casesensitiveComp:e("casesensitiveComp"),cellpadding:e("cellpadding"),cellspacing:e("cellspacing"),char:e("char"),charcoal:e("charcoal"),charMapConfig:e("charMapConfig"),CHECK:t,check:e("check"),class:e("class"),classesAnchor:e("classesAnchor"),classesCharacter:e("classesCharacter"),classesImage:e("classesImage"),classesParagraph:e("classesParagraph"),clear:e("clear"),clearCache:e("clearCache"),clearCache_disable:e("clearCache_disable"),clearCache_pageGrandParent:e("clearCache_pageGrandParent"),clearCache_pageSiblingChildren:e("clearCache_pageSiblingChildren"),clearCacheCmd:e("clearCacheCmd"),clearCacheLevels:e("clearCacheLevels"),clearCacheOfPages:e("clearCacheOfPages"),clickTitleMode:e("clickTitleMode"),clipboardNumberPads:e("clipboardNumberPads"),cMargins:e("cMargins"),COA:e("COA"),COA_INT:e("COA_INT"),cObj:t,COBJ_ARRAY:e("COBJ_ARRAY"),cObject:t,cObjNum:e("cObjNum"),collapse:e("collapse"),collections:e("collections"),color:e("color"),color1:e("color1"),color2:e("color2"),color3:e("color3"),color4:e("color4"),colors:e("colors"),colour:e("colour"),colPos_list:e("colPos_list"),colRelations:e("colRelations"),cols:e("cols"),colSpace:e("colSpace"),COMMENT:t,comment_auto:e("comment_auto"),commentWrap:e("commentWrap"),compX:e("compX"),compY:e("compY"),conf:e("conf"),CONFIG:e("CONFIG"),config:t,CONSTANTS:e("CONSTANTS"),constants:e("constants"),CONTENT:e("CONTENT"),content:t,contextMenu:e("contextMenu"),copy:t,copyLevels:e("copyLevels"),count_HMENU_MENUOBJ:e("count_HMENU_MENUOBJ"),count_menuItems:e("count_menuItems"),count_MENUOBJ:e("count_MENUOBJ"),create:e("create"),crop:e("crop"),csConv:e("csConv"),CType:e("CType"),CUR:a,CURIFSUB:a,CURIFSUBRO:a,current:e("current"),CURRO:a,curUid:e("curUid"),cut:t,cWidth:e("cWidth"),data:e("data"),dataArray:t,dataWrap:e("dataWrap"),date:e("date"),date_stdWrap:e("date_stdWrap"),datePrefix:e("datePrefix"),dayofmonth:t,dayofweek:t,DB:e("DB"),db_list:t,debug:e("debug"),debugData:e("debugData"),debugFunc:e("debugFunc"),debugItemConf:e("debugItemConf"),debugRenumberedObject:e("debugRenumberedObject"),default:a,defaultAlign:e("defaultAlign"),defaultCmd:e("defaultCmd"),defaultHeaderType:e("defaultHeaderType"),defaultOutput:e("defaultOutput"),defaults:e("defaults"),defaultType:e("defaultType"),delete:e("delete"),denyTags:e("denyTags"),depth:e("depth"),DESC:e("DESC"),description:a,dimensions:e("dimensions"),direction:e("direction"),directory:a,directReturn:a,disableAllHeaderCode:e("disableAllHeaderCode"),disableAltText:e("disableAltText"),disableBodyTag:e("disableBodyTag"),disabled:e("disabled"),disableDelete:e("disableDelete"),disableHideAtCopy:e("disableHideAtCopy"),disableItems:e("disableItems"),disableNoMatchingValueElement:e("disableNoMatchingValueElement"),disablePrefixComment:e("disablePrefixComment"),disablePrependAtCopy:e("disablePrependAtCopy"),disableSearchBox:e("disableSearchBox"),disableSingleTableView:e("disableSingleTableView"),displayContent:e("displayContent"),displayFieldIcons:e("displayFieldIcons"),displayIcons:e("displayIcons"),displayMessages:e("displayMessages"),displayRecord:e("displayRecord"),displayTimes:e("displayTimes"),distributeX:e("distributeX"),distributeY:e("distributeY"),div:a,DIV:e("DIV"),doctype:e("doctype"),DOCUMENT_BODY:e("DOCUMENT_BODY"),doktype:e("doktype"),doNotLinkIt:e("doNotLinkIt"),doNotShowLink:e("doNotShowLink"),doNotStripHTML:e("doNotStripHTML"),dontCheckPid:e("dontCheckPid"),dontLinkIfSubmenu:e("dontLinkIfSubmenu"),dontWrapInTable:e("dontWrapInTable"),doubleBrTag:e("doubleBrTag"),dWorkArea:e("dWorkArea"),dynCSS:t,edge:e("edge"),edit:t,edit_access:t,edit_docModuleUpload:e("edit_docModuleUpload"),EFFECT:e("EFFECT"),elements:e("elements"),else:a,email:a,emailMeAtLogin:e("emailMeAtLogin"),emailMess:e("emailMess"),emboss:e("emboss"),enable:e("enable"),encapsLines:e("encapsLines"),encapsLinesStdWrap:e("encapsLinesStdWrap"),encapsTagList:e("encapsTagList"),end:a,entryLevel:e("entryLevel"),equalH:e("equalH"),equals:a,everybody:e("everybody"),excludeDoktypes:e("excludeDoktypes"),excludeUidList:e("excludeUidList"),expAll:e("expAll"),expand:e("expand"),explode:e("explode"),ext:e("ext"),external:a,externalBlocks:e("externalBlocks"),extTarget:e("extTarget"),face:e("face"),false:a,FE:a,fe_adminLib:e("fe_adminLib"),fe_groups:a,fe_users:a,feadmin:a,field:e("field"),fieldName:e("fieldName"),fieldOrder:e("fieldOrder"),fieldRequired:e("fieldRequired"),fields:e("fields"),fieldWrap:e("fieldWrap"),file:e("file"),file1:e("file1"),file2:e("file2"),file3:e("file3"),file4:e("file4"),file5:e("file5"),FILES:e("FILES"),files:e("files"),firstLabel:e("firstLabel"),firstLabelGeneral:e("firstLabelGeneral"),fixAttrib:e("fixAttrib"),flip:e("flip"),flop:e("flop"),FLUIDTEMPLATE:e("FLUIDTEMPLATE"),folder:t,folders:e("folders"),folderTree:t,foldoutMenu:t,fontColor:e("fontColor"),fontFile:e("fontFile"),fontOffset:e("fontOffset"),fontSize:e("fontSize"),fontSizeMultiplicator:e("fontSizeMultiplicator"),forceDisplayFieldIcons:e("forceDisplayFieldIcons"),forceDisplayIcons:e("forceDisplayIcons"),forceTemplateParsing:e("forceTemplateParsing"),forceTypeValue:e("forceTypeValue"),FORM:e("FORM"),format:e("format"),function:e("function"),Functions:t,gamma:e("gamma"),gapBgCol:e("gapBgCol"),gapLineCol:e("gapLineCol"),gapLineThickness:e("gapLineThickness"),gapWidth:e("gapWidth"),get:e("get"),getBorder:e("getBorder"),getLeft:e("getLeft"),getRight:e("getRight"),GIFBUILDER:e("GIFBUILDER"),global:e("global"),globalNesting:e("globalNesting"),globalString:e("globalString"),globalVar:e("globalVar"),GP:e("GP"),gray:e("gray"),group:e("group"),groupBy:e("groupBy"),groupid:e("groupid"),header:a,header_layout:e("header_layout"),headerComment:e("headerComment"),headerData:e("headerData"),headerSpace:e("headerSpace"),headTag:e("headTag"),height:e("height"),helpText:e("helpText"),hidden:e("hidden"),hiddenFields:e("hiddenFields"),hide:e("hide"),hideButCreateMap:e("hideButCreateMap"),hidePStyleItems:e("hidePStyleItems"),hideRecords:e("hideRecords"),highColor:e("highColor"),history:e("history"),HMENU:e("HMENU"),hostname:t,hour:t,HTML:e("HTML"),html:a,HTMLparser:e("HTMLparser"),HTMLparser_tags:e("HTMLparser_tags"),htmlSpecialChars:e("htmlSpecialChars"),htmlTag_setParams:e("htmlTag_setParams"),http:e("http"),icon:e("icon"),icon_image_ext_list:e("icon_image_ext_list"),icon_link:e("icon_link"),iconCObject:e("iconCObject"),id:a,IENV:e("IENV"),if:a,ifEmpty:a,IFSUB:a,IFSUBRO:a,IMAGE:e("IMAGE"),image:a,image_frames:e("image_frames"),imageLinkWrap:e("imageLinkWrap"),imagePath:e("imagePath"),images:e("images"),imageWrapIfAny:e("imageWrapIfAny"),IMG_RESOURCE:e("IMG_RESOURCE"),imgList:t,imgMap:e("imgMap"),imgMapExtras:e("imgMapExtras"),imgMax:e("imgMax"),imgNameNotRandom:e("imgNameNotRandom"),imgNamePrefix:e("imgNamePrefix"),imgObjNum:e("imgObjNum"),imgParams:e("imgParams"),imgPath:e("imgPath"),imgResource:t,imgStart:e("imgStart"),IMGTEXT:e("IMGTEXT"),imgText:t,import:e("import"),inBranch:a,inc:e("inc"),INCLUDE_TYPOSCRIPT:e("INCLUDE_TYPOSCRIPT"),includeCSS:e("includeCSS"),includeLibrary:e("includeLibrary"),includeNotInMenu:e("includeNotInMenu"),index:e("index"),index_descrLgd:e("index_descrLgd"),index_enable:e("index_enable"),index_externals:e("index_externals"),info:t,inlineStyle2TempFile:e("inlineStyle2TempFile"),innerStdWrap:e("innerStdWrap"),innerStdWrap_all:e("innerStdWrap_all"),innerWrap:e("innerWrap"),innerWrap2:e("innerWrap2"),input:e("input"),inputLevels:e("inputLevels"),insertData:e("insertData"),intensity:e("intensity"),intTarget:e("intTarget"),intval:e("intval"),invert:e("invert"),IP:t,IProcFunc:e("IProcFunc"),isFalse:a,isGreaterThan:a,isInList:a,isLessThan:a,isPositive:a,isTrue:a,itemArrayProcFunc:e("itemArrayProcFunc"),itemH:e("itemH"),items:e("items"),itemsProcFunc:e("itemsProcFunc"),iterations:e("iterations"),join:e("join"),JSwindow:t,JSWindow:e("JSWindow"),JSwindow_params:e("JSwindow_params"),keep:e("keep"),keepEntries:e("keepEntries"),keepNonMatchedTags:e("keepNonMatchedTags"),key:e("key"),keyword3:a,LABEL:t,label:e("label"),labelStdWrap:e("labelStdWrap"),labelWrap:e("labelWrap"),lang:e("lang"),languageField:e("languageField"),layout:t,left:e("left"),leftjoin:e("leftjoin"),levels:e("levels"),leveltitle:a,leveluid:e("leveluid"),lib:t,limit:e("limit"),line:e("line"),lineColor:e("lineColor"),lineThickness:e("lineThickness"),linkPrefix:e("linkPrefix"),linkTitleToSelf:e("linkTitleToSelf"),linkVars:e("linkVars"),linkWrap:e("linkWrap"),list:a,listNum:e("listNum"),listOnlyInSingleTableView:e("listOnlyInSingleTableView"),LIT:e("LIT"),lm:e("lm"),LOAD_REGISTER:e("LOAD_REGISTER"),locale_all:e("locale_all"),localNesting:e("localNesting"),locationData:e("locationData"),login:a,loginUser:t,lowColor:e("lowColor"),lower:e("lower"),LR:e("LR"),mailform:a,mailto:e("mailto"),main:e("main"),makelinks:e("makelinks"),markerWrap:e("markerWrap"),marks:t,mask:e("mask"),max:e("max"),maxAge:e("maxAge"),maxChars:e("maxChars"),maxH:e("maxH"),maxHeight:e("maxHeight"),maxItems:e("maxItems"),maxW:e("maxW"),maxWidth:e("maxWidth"),maxWInText:e("maxWInText"),media:a,menu:a,menuHeight:e("menuHeight"),menuName:e("menuName"),menuOffset:e("menuOffset"),menuWidth:e("menuWidth"),message_preview:e("message_preview"),META:e("META"),meta:e("meta"),method:e("method"),min:e("min"),minH:e("minH"),minItems:e("minItems"),minute:t,minW:e("minW"),mod:a,mode:e("mode"),module:t,month:t,move_wizard:t,MP_defaults:e("MP_defaults"),MP_disableTypolinkClosestMPvalue:e("MP_disableTypolinkClosestMPvalue"),MP_mapRootPoints:e("MP_mapRootPoints"),MULTIMEDIA:e("MULTIMEDIA"),multimedia:a,name:e("name"),negate:a,nesting:e("nesting"),neverHideAtCopy:e("neverHideAtCopy"),new:t,NEW:a,new_wizard:t,newPageWiz:e("newPageWiz"),newRecordFromTable:e("newRecordFromTable"),newWindow:e("newWindow"),newWizards:e("newWizards"),next:e("next"),niceText:e("niceText"),nicetext:e("nicetext"),NO:a,no_cache:e("no_cache"),no_search:e("no_search"),noAttrib:e("noAttrib"),noCache:e("noCache"),noCreateRecordsLink:e("noCreateRecordsLink"),noLink:e("noLink"),noMatchingValue_label:e("noMatchingValue_label"),nonCachedSubst:e("nonCachedSubst"),none:a,nonTypoTagStdWrap:e("nonTypoTagStdWrap"),nonTypoTagUserFunc:e("nonTypoTagUserFunc"),nonWrappedTag:e("nonWrappedTag"),noOrderBy:e("noOrderBy"),noPageTitle:e("noPageTitle"),noResultObj:t,noThumbsInEB:e("noThumbsInEB"),noTrimWrap:e("noTrimWrap"),noValueInsert:e("noValueInsert"),numRows:t,obj:e("obj"),offset:e("offset"),onlineWorkspaceInfo:e("onlineWorkspaceInfo"),onlyCurrentPid:e("onlyCurrentPid"),opacity:e("opacity"),options:t,orderBy:e("orderBy"),outerWrap:e("outerWrap"),outline:e("outline"),outputLevels:e("outputLevels"),override:e("override"),overrideAttribs:e("overrideAttribs"),overrideId:e("overrideId"),overridePageModule:e("overridePageModule"),PAGE:e("PAGE"),page:t,PAGE_TARGET:e("PAGE_TARGET"),PAGE_TSCONFIG_ID:e("PAGE_TSCONFIG_ID"),PAGE_TSCONFIG_IDLIST:e("PAGE_TSCONFIG_IDLIST"),PAGE_TSCONFIG_STR:e("PAGE_TSCONFIG_STR"),pageFrameObj:e("pageFrameObj"),pages:a,pageTitleFirst:e("pageTitleFirst"),pageTree:t,parameter:e("parameter"),params:e("params"),parseFunc:e("parseFunc"),parseFunc_RTE:a,parser:e("parser"),password:e("password"),paste:t,path:e("path"),permissions:e("permissions"),perms:t,pid:a,pid_list:e("pid_list"),pidInList:e("pidInList"),PIDinRootline:t,PIDupinRootline:t,pixelSpaceFontSizeRef:e("pixelSpaceFontSizeRef"),plaintextLib:e("plaintextLib"),plainTextStdWrap:e("plainTextStdWrap"),plugin:t,postCObject:e("postCObject"),postLineBlanks:e("postLineBlanks"),postLineChar:e("postLineChar"),postLineLen:e("postLineLen"),postUserFunc:e("postUserFunc"),postUserFuncInt:e("postUserFuncInt"),preBlanks:e("preBlanks"),preCObject:e("preCObject"),prefix:e("prefix"),prefixComment:e("prefixComment"),prefixRelPathWith:e("prefixRelPathWith"),preIfEmptyListNum:e("preIfEmptyListNum"),preLineBlanks:e("preLineBlanks"),preLineChar:e("preLineChar"),preLineLen:e("preLineLen"),prepend:e("prepend"),preserveEntities:e("preserveEntities"),preUserFunc:e("preUserFunc"),prev:e("prev"),preview:t,previewBorder:e("previewBorder"),prevnextToSection:e("prevnextToSection"),prioriCalc:e("prioriCalc"),proc:e("proc"),processor_allowUpscaling:e("processor_allowUpscaling"),properties:e("properties"),protect:e("protect"),protectLvar:e("protectLvar"),publish:t,publish_levels:e("publish_levels"),quality:e("quality"),RADIO:t,radio:e("radio"),radioWrap:e("radioWrap"),range:e("range"),rawUrlEncode:e("rawUrlEncode"),recipient:e("recipient"),RECORDS:e("RECORDS"),recursive:e("recursive"),redirect:e("redirect"),redirectToURL:e("redirectToURL"),reduceColors:e("reduceColors"),references:e("references"),register:e("register"),relPathPrefix:e("relPathPrefix"),remap:e("remap"),remapTag:e("remapTag"),REMOTE_ADDR:e("REMOTE_ADDR"),removeDefaultJS:e("removeDefaultJS"),removeIfEquals:e("removeIfEquals"),removeIfFalse:e("removeIfFalse"),removeItems:e("removeItems"),removeObjectsOfDummy:e("removeObjectsOfDummy"),removePrependedNumbers:e("removePrependedNumbers"),removeTags:e("removeTags"),removeWrapping:e("removeWrapping"),renderObj:t,renderWrap:e("renderWrap"),REQ:t,required:a,reset:e("reset"),resources:e("resources"),RESTORE_REGISTER:e("RESTORE_REGISTER"),resultObj:e("resultObj"),returnLast:e("returnLast"),returnUrl:e("returnUrl"),rightjoin:e("rightjoin"),rm:e("rm"),rmTagIfNoAttrib:e("rmTagIfNoAttrib"),RO:a,rootline:a,rotate:e("rotate"),rows:e("rows"),rowSpace:e("rowSpace"),RTE:t,RTE_compliant:t,rules:e("rules"),sample:e("sample"),saveClipboard:e("saveClipboard"),saveDocNew:e("saveDocNew"),script:a,search:a,SEARCHRESULT:e("SEARCHRESULT"),secondRow:e("secondRow"),section:e("section"),sectionIndex:e("sectionIndex"),select:t,selectFields:e("selectFields"),separator:e("separator"),set:e("set"),setContentToCurrent:e("setContentToCurrent"),setCurrent:e("setCurrent"),setfixed:e("setfixed"),setOnly:e("setOnly"),setup:t,shadow:e("shadow"),SHARED:e("SHARED"),sharpen:e("sharpen"),shear:e("shear"),short:e("short"),shortcut:a,shortcutFrame:e("shortcutFrame"),shortcutIcon:e("shortcutIcon"),show:e("show"),showAccessRestrictedPages:e("showAccessRestrictedPages"),showActive:e("showActive"),showFirst:e("showFirst"),showHiddenPages:e("showHiddenPages"),showHiddenRecords:e("showHiddenRecords"),showHistory:e("showHistory"),showPageIdWithTitle:e("showPageIdWithTitle"),showTagFreeClasses:e("showTagFreeClasses"),showWebsiteTitle:e("showWebsiteTitle"),simulateDate:e("simulateDate"),simulateUserGroup:e("simulateUserGroup"),singlePid:e("singlePid"),site_author:e("site_author"),site_reserved:e("site_reserved"),sitemap:a,siteUrl:e("siteUrl"),size:e("size"),solarize:e("solarize"),sorting:e("sorting"),source:e("source"),space:e("space"),spaceBelowAbove:e("spaceBelowAbove"),spaceLeft:e("spaceLeft"),spaceRight:e("spaceRight"),spacing:e("spacing"),spamProtectEmailAddresses:e("spamProtectEmailAddresses"),spamProtectEmailAddresses_atSubst:e("spamProtectEmailAddresses_atSubst"),spamProtectEmailAddresses_lastDotSubst:e("spamProtectEmailAddresses_lastDotSubst"),SPC:a,special:e("special"),split:t,splitChar:e("splitChar"),splitRendering:e("splitRendering"),src:e("src"),stdWrap:t,stdWrap2:e("stdWrap2"),strftime:e("strftime"),stripHtml:e("stripHtml"),styles:e("styles"),submenuObjSuffixes:e("submenuObjSuffixes"),subMenuOffset:e("subMenuOffset"),submit:e("submit"),subparts:t,subst_elementUid:e("subst_elementUid"),substMarksSeparately:e("substMarksSeparately"),substring:e("substring"),swirl:e("swirl"),sys_dmail:a,sys_filemounts:a,sys_note:a,sys_template:a,system:t,table:a,tableCellColor:e("tableCellColor"),tableParams:e("tableParams"),tables:e("tables"),tableStdWrap:e("tableStdWrap"),tableWidth:e("tableWidth"),tags:e("tags"),target:e("target"),TCAdefaults:e("TCAdefaults"),TCEFORM:e("TCEFORM"),TCEMAIN:e("TCEMAIN"),TDparams:e("TDparams"),temp:t,template:t,templateContent:e("templateContent"),templateFile:e("templateFile"),TEXT:e("TEXT"),text:a,textarea:e("textarea"),textMargin:e("textMargin"),textMargin_outOfText:e("textMargin_outOfText"),textMaxLength:e("textMaxLength"),textObjNum:e("textObjNum"),textpic:a,textPos:e("textPos"),thickness:e("thickness"),this:a,tile:e("tile"),time_stdWrap:e("time_stdWrap"),tipafriendLib:e("tipafriendLib"),title:e("title"),titleLen:e("titleLen"),titleText:e("titleText"),tm:e("tm"),TMENU:e("TMENU"),TMENUITEM:e("TMENUITEM"),token:e("token"),top:a,totalWidth:e("totalWidth"),transparentBackground:e("transparentBackground"),transparentColor:e("transparentColor"),treeLevel:t,trim:e("trim"),true:a,tsdebug:t,tsdebug_tree:e("tsdebug_tree"),TSFE:e("TSFE"),type:e("type"),typeNum:e("typeNum"),types:e("types"),typolink:t,uid:a,uidInList:e("uidInList"),uniqueGlobal:a,uniqueLocal:a,unset:e("unset"),unsetEmpty:a,updated:a,uploads:a,upper:e("upper"),url:t,us:a,useLargestItemX:e("useLargestItemX"),useLargestItemY:e("useLargestItemY"),USER:e("USER"),user:e("user"),USER_INT:e("USER_INT"),user_task:a,useragent:t,USERDEF1:a,USERDEF1RO:a,USERDEF2:a,USERDEF2RO:a,userdefined:e("userdefined"),userFunc:t,userfunction:e("userfunction"),usergroup:a,userid:e("userid"),userProc:e("userProc"),USR:a,USRRO:a,value:e("value"),valueArray:e("valueArray"),version:t,view:t,wave:e("wave"),web_func:a,web_info:a,web_layout:a,web_list:a,web_ts:e("web_ts"),where:e("where"),width:e("width"),wiz:e("wiz"),wordSpacing:e("wordSpacing"),workArea:e("workArea"),workOnSubpart:t,wrap:e("wrap"),wrap1:e("wrap1"),wrap2:e("wrap2"),wrap3:e("wrap3"),wrapAfterTags:e("wrapAfterTags"),wrapAlign:e("wrapAlign"),wrapFieldName:e("wrapFieldName"),wrapItemAndSub:e("wrapItemAndSub"),wrapNonWrappedLines:e("wrapNonWrappedLines"),wraps:e("wraps"),xhtml_cleaning:e("xhtml_cleaning"),xhtml_strict:a,xhtml_trans:a,xmlprologue:e("xmlprologue"),XY:a}}(),r=/[\+\-\*\&\%\/=<>!\?]/;let i,n,o=!1;function s(e,t,a){return i=e,n=a,t}function l(t,i){const n=t.next();if("string"==typeof n){if("\n"===n&&(o=!1),"."===n&&t.match(/^\d+(?:[eE][+\-]?\d+)?/))return s("number","number");if("."===n&&t.match(".."))return s("spread","meta");if(n&&/[\[\]{}\(\),;\:\.]/.test(n))return s(n);if("<"===n||">"===n||"."===n||"="===n&&"<"!==t.peek())return o=!0,s(n,"operator");if(!o&&n&&/[\[\]\(\),;\:\.\<\>\=]/.test(n))return s(n,"operator");if("0"===n&&t.eat(/x/i))return t.eatWhile(/[\da-f]/i),s("number","number");if("0"===n&&t.eat(/o/i))return t.eatWhile(/[0-7]/i),s("number","number");if("0"===n&&t.eat(/b/i))return t.eatWhile(/[01]/i),s("number","number");if(n&&/\d/.test(n))return t.match(/^\d*(?:\.\d+)?(?:[eE][+\-]?\d+)?/),s("number","number");if("/"===n)return t.eat("*")?(i.tokenize=d,d(t,i)):t.eat("/")?(t.skipToEnd(),s("comment","comment")):expressionAllowed(t,i)?(function(e){let t,a=!1,r=!1;for(;null!=(t=e.next());){if(!a){if("/"===t&&!r)return;"["===t?r=!0:r&&"]"===t&&(r=!1)}a=!a&&"\\"===t}}(t),t.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/),s("regexp","string-2")):(t.eatWhile(r),s("operator","operator",t.current()));if("#"===n)return t.skipToEnd(),s("comment","comment");if(r.test(n))return">"===n&&i.lexical&&">"===i.lexical.type||t.eatWhile(r),s("operator","operator",t.current());if(e.test(n)){t.eatWhile(e);const r=t.current();if(a.propertyIsEnumerable(r)){const e=a[r];return s(e.type,e.style,r)}return o?s("string","string",r):s("variable","other",r)}}}function d(e,t){let a,r=!1;for(;null!==(a=e.next());){if("/"===a&&r){t.tokenize=l;break}r="*"===a}return s("comment","comment")}const c={atom:!0,number:!0,variable:!0,string:!0,regexp:!0};function p(e,t){for(let a=e.localVars;a;a=a.next)if(a.name==t)return!0;for(let a=e.context;a;a=a.prev)for(let e=a.vars;e;e=e.next)if(e.name==t)return!0}const u={state:null,column:null,marked:null,cc:null};function m(...e){for(let t=e.length-1;t>=0;t--)u.cc.push(e[t])}function g(...e){return m(...e),!0}function f(e){const t=u.state;if(u.marked="def",t.context){if(function(t){for(let a=t;a;a=a.next)if(a.name==e)return!0;return!1}(t.localVars))return;t.localVars={name:e,next:t.localVars}}}function b(e,t){const a=function(){const a=u.state;let r=a.indented;if("stat"===a.lexical.type)r=a.lexical.indented;else for(let e=a.lexical;e&&")"===e.type&&e.align;e=e.prev)r=e.indented;a.lexical=new TSLexical(r,u.stream.column(),e,null,a.lexical,t)};return a.lex=!0,a}function h(){const e=u.state;e.lexical.prev&&(")"===e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function T(e){return function t(a){return a==e?g():";"===e?m():g(t)}}function y(e,t){return"keyword a"===e?g(b("form"),I,y,h):"keyword b"===e?g(b("form"),y,h):"{"===e?g(b("}"),W,h):";"===e?g():"variable"===e?g(b("stat"),A):"import"===e?g(b("stat"),O,h):"@"===t?g(C,y):m(b("stat"),C,T(";"),h)}function C(e){return S(e,!1)}function x(e){return S(e,!0)}function I(e){return"("!==e?m():g(b(")"),C,T(")"),h)}function S(e,t){const a=t?E:L;return c.hasOwnProperty(e)?g(a):"keyword c"===e?g(t?_:w):"("===e?g(b(")"),w,T(")"),h,a):"operator"===e?g(t?x:C):"{"===e?v(R,"}",null,a):g()}function w(e){return e.match(/[;\}\)\],]/)?m():m(C)}function _(e){return e.match(/[;\}\)\],]/)?m():m(x)}function L(e,t){return","===e?g(C):E(e,t,!1)}function E(e,t,a){const r=0==a?L:E,i=0==a?C:x;return"operator"===e?/\+\+|--/.test(t)?g(r):"?"===t?g(C,T(":"),i):g(i):";"!==e?"("===e?v(x,")","call",r):"."===e?g(k,r):"["===e?g(b("]"),w,T("]"),h,r):void 0:void 0}function A(e){return":"===e?g(h,y):m(L,T(";"),h)}function k(e){if("variable"===e)return u.marked="property",g()}function R(e){return"async"===e?(u.marked="property",g(R)):"variable"===e||"keyword"===u.style?(u.marked="property",g(P)):"number"===e||"string"===e?(u.marked=u.style+" property",g(P)):"modifier"===e?g(R):":"===e?m(P):void 0}function P(e){if(":"===e)return g(x)}function v(e,t,a,...r){for(const e of r)u.cc.push(e);return g(b(t,a),function(e,t,a){function r(i,n){if(a?a.indexOf(i)>-1:","===i){const a=u.state.lexical;return"call"===a.info&&(a.pos=(a.pos||0)+1),g((function(a,r){return a==t||r==t?m():m(e)}),r)}return i==t||n==t?g():g(T(t))}return function(a,i){return a==t||i==t?g():m(e,r)}}(e,t),h)}function W(e){return"}"===e?g():m(y,W)}function O(e){return"string"===e?g():m(M,F,U)}function M(e,t){return"{"===e?v(M,"}"):("variable"===e&&f(t),"*"===t&&(u.marked="keyword"),g(N))}function F(e){if(","===e)return g(M,F)}function N(e,t){if("as"===t)return u.marked="keyword",g(M)}function U(e,t){if("from"===t)return u.marked="keyword",g(C)}h.lex=!0;return new class{constructor(){this.electricInput=/^\s*(?:case .*?:|default:|\{|\})$/,this.blockCommentStart="/*",this.blockCommentEnd="*/",this.lineComment="#",this.fold="brace",this.closeBrackets="(){}''\"\"`",this.helperType="typoscript",this.name="TypoScript"}startState(e){return{tokenize:l,lastType:"sof",cc:[],lexical:new TSLexical(-e,0,"block",!1),localVars:t.localVars,context:t.localVars&&{vars:t.localVars},indented:0}}token(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation()),t.tokenize!=d&&e.eatSpace())return null;const a=t.tokenize(e,t);return"comment"===i?a:(t.lastType="operator"!==i||"++"!==n&&"--"!==n?i:"incdec",function(e,t,a,r,i){const n=e.cc;for(u.state=e,u.stream=i,u.marked=null,u.cc=n,u.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;){const i=n.length?n.pop():y;if("function"==typeof i&&i(a,r)){for(;n.length&&n[n.length-1]&&n[n.length-1].lex;)n.pop()();return u.marked?u.marked:"variable"===a&&p(e,r)?"variable-2":t}}}(t,a,i,n,e))}indent(e,a,i){if(e.tokenize==d)return null;if(e.tokenize!=l)return 0;const n=a&&a.charAt(0);let o,s=e.lexical;for(;("stat"===s.type||"form"===s.type)&&("}"===n||(o=e.cc[e.cc.length-1])&&(o==L||o==E)&&!/^[,\.=+\-*:?[\(]/.test(a));)s=s.prev;const c=s.type,p=n==c;return"form"===c&&"{"===n?s.indented:"form"===c?s.indented+i.unit:"stat"===c?s.indented+(function(e,t){return"operator"===e.lastType||","===e.lastType||r.test(t.charAt(0))||/[,.]/.test(t.charAt(0))}(e,a)?i.unit:0):"switch"!==s.info||p||0==t.doubleIndentSwitch?s.align?s.column+(p?0:1):s.indented+(p?0:i.unit):s.indented+(/^(?:case|default)\b/.test(a)?i.unit:2*i.unit)}expressionAllowed(e,t){return expressionAllowed(e,t)}}}} \ No newline at end of file -- GitLab