From eeff31f4c70c9c83a57789b3ec61bf4e1e1956e8 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Fri, 26 Mar 2021 16:02:20 +0100 Subject: [PATCH] Fixes microsoft/vscode#119918: Avoid using oniguruma find options since they cause freezes tokenizing minified files with the JS grammar --- benchmark/JavaScript.tmLanguage.json | 3575 ++++++++++++++++++++++++++ benchmark/benchmark.js | 3 +- benchmark/minified.js.txt | 1 + package-lock.json | 6 +- package.json | 2 +- release/main.js | 2 +- release/main.js.map | 2 +- src/debug.ts | 2 + src/grammar.ts | 32 +- src/rule.ts | 222 +- 10 files changed, 3828 insertions(+), 19 deletions(-) create mode 100644 benchmark/JavaScript.tmLanguage.json create mode 100644 benchmark/minified.js.txt diff --git a/benchmark/JavaScript.tmLanguage.json b/benchmark/JavaScript.tmLanguage.json new file mode 100644 index 0000000..3e9a33e --- /dev/null +++ b/benchmark/JavaScript.tmLanguage.json @@ -0,0 +1,3575 @@ +{ + "name": "JavaScript (with React support)", + "scopeName": "source.js", + "fileTypes": [ + ".js", + ".jsx" + ], + "uuid": "805375ec-d614-41f5-8993-5843fe63ea82", + "patterns": [ + { + "include": "#directives" + }, + { + "include": "#statements" + }, + { + "name": "comment.line.shebang.ts", + "match": "\\A(#!).*(?=$)", + "captures": { + "1": { + "name": "punctuation.definition.comment.ts" + } + } + } + ], + "repository": { + "statements": { + "patterns": [ + { + "include": "#string" + }, + { + "include": "#template" + }, + { + "include": "#comment" + }, + { + "include": "#literal" + }, + { + "include": "#declaration" + }, + { + "include": "#switch-statement" + }, + { + "include": "#for-loop" + }, + { + "include": "#after-operator-block" + }, + { + "include": "#decl-block" + }, + { + "include": "#control-statement" + }, + { + "include": "#expression" + }, + { + "include": "#punctuation-semicolon" + } + ] + }, + "var-expr": { + "name": "meta.var.expr.js", + "begin": "(?) | ((<([^<>]|\\<[^<>]+\\>)+>\\s*)?\\(([^()]|\\([^()]*\\))*\\)(\\s*:\\s*(.)*)?\\s*=>)) ) | (:\\s*( (<) | ([(]\\s*( ([)]) | (\\.\\.\\.) | ([_$[:alnum:]]+\\s*( ([:,?=])| ([)]\\s*=>) )) ))) ))", + "beginCaptures": { + "1": { + "name": "entity.name.function.js" + } + }, + "end": "(?=$|[;,=}]|(\\s+(of|in)\\s+))", + "patterns": [ + { + "include": "#type-annotation" + }, + { + "include": "#string" + }, + { + "include": "#comment" + } + ] + }, + { + "name": "meta.var-single-variable.expr.js", + "begin": "([_$[:alpha:]][_$[:alnum:]]*)", + "beginCaptures": { + "1": { + "name": "variable.other.readwrite.js" + } + }, + "end": "(?=$|[;,=}]|(\\s+(of|in)\\s+))", + "patterns": [ + { + "include": "#type-annotation" + }, + { + "include": "#string" + }, + { + "include": "#comment" + } + ] + } + ] + }, + "destructuring-variable": { + "patterns": [ + { + "name": "meta.object-binding-pattern-variable.js", + "begin": "(?) | ((<([^<>]|\\<[^<>]+\\>)+>\\s*)?\\(([^()]|\\([^()]*\\))*\\)(\\s*:\\s*(.)*)?\\s*=>)) ) | (:\\s*( (<) | ([(]\\s*( ([)]) | (\\.\\.\\.) | ([_$[:alnum:]]+\\s*( ([:,?=])| ([)]\\s*=>) )) ))) ))" + }, + { + "name": "variable.object.property.js", + "match": "[_$[:alpha:]][_$[:alnum:]]*" + }, + { + "name": "keyword.operator.optional.js", + "match": "\\?" + } + ] + } + ] + }, + "method-declaration": { + "name": "meta.method.declaration.js", + "begin": "(?) | ((<([^<>]|\\<[^<>]+\\>)+>\\s*)?\\(([^()]|\\([^()]*\\))*\\)(\\s*:\\s*(.)*)?\\s*=>)) ) | (:\\s*( (<) | ([(]\\s*( ([)]) | (\\.\\.\\.) | ([_$[:alnum:]]+\\s*( ([:,?=])| ([)]\\s*=>) )) ))) ))", + "captures": { + "1": { + "name": "storage.modifier.js" + }, + "2": { + "name": "storage.modifier.js" + }, + "3": { + "name": "keyword.operator.rest.js" + }, + "4": { + "name": "entity.name.function.js" + }, + "5": { + "name": "keyword.operator.optional.js" + } + } + }, + { + "match": "(?:\\s*\\b(readonly)\\s+)?(?:\\s*\\b(public|private|protected)\\s+)?(\\.\\.\\.)?\\s*(?])|(?<=[\\}>\\]\\)]|[_$[:alpha:]])\\s*(?=\\{)", + "patterns": [ + { + "include": "#comment" + }, + { + "include": "#type" + } + ] + }, + "type": { + "name": "meta.type.js", + "patterns": [ + { + "include": "#comment" + }, + { + "include": "#string" + }, + { + "include": "#numeric-literal" + }, + { + "include": "#type-primitive" + }, + { + "include": "#type-builtin-literals" + }, + { + "include": "#type-parameters" + }, + { + "include": "#type-tuple" + }, + { + "include": "#type-object" + }, + { + "include": "#type-operators" + }, + { + "include": "#type-fn-type-parameters" + }, + { + "include": "#type-paren-or-function-parameters" + }, + { + "include": "#type-function-return-type" + }, + { + "include": "#type-name" + } + ] + }, + "function-parameters": { + "name": "meta.parameters.js", + "begin": "\\(", + "beginCaptures": { + "0": { + "name": "punctuation.definition.parameters.begin.js" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.definition.parameters.end.js" + } + }, + "patterns": [ + { + "include": "#comment" + }, + { + "include": "#decorator" + }, + { + "include": "#destructuring-parameter" + }, + { + "include": "#parameter-name" + }, + { + "include": "#type-annotation" + }, + { + "include": "#variable-initializer" + }, + { + "name": "punctuation.separator.parameter.js", + "match": "," + } + ] + }, + "type-primitive": { + "name": "support.type.primitive.js", + "match": "(?)\\s*(?=\\()", + "end": "(?<=\\))", + "patterns": [ + { + "include": "#function-parameters" + } + ] + }, + { + "name": "meta.type.function.js", + "begin": "(?x)( (?= [(]\\s*( ([)]) | (\\.\\.\\.) | ([_$[:alnum:]]+\\s*( ([:,?=])| ([)]\\s*=>) )) ) ) )", + "end": "(?<=\\))", + "patterns": [ + { + "include": "#function-parameters" + } + ] + } + ] + }, + "type-operators": { + "patterns": [ + { + "include": "#typeof-operator" + }, + { + "name": "keyword.operator.type.js", + "match": "[&|]" + }, + { + "name": "keyword.operator.expression.keyof.js", + "match": "(?", + "beginCaptures": { + "0": { + "name": "storage.type.function.arrow.js" + } + }, + "end": "(?)(?=[,\\]\\)\\{\\}=;>]|//|$)", + "patterns": [ + { + "include": "#comment" + }, + { + "name": "meta.object.type.js", + "begin": "(?<==>)\\s*(\\{)", + "beginCaptures": { + "1": { + "name": "punctuation.definition.block.js" + } + }, + "end": "\\}", + "endCaptures": { + "0": { + "name": "punctuation.definition.block.js" + } + }, + "patterns": [ + { + "include": "#type-object-members" + } + ] + }, + { + "include": "#type-predicate-operator" + }, + { + "include": "#type" + } + ] + }, + "type-tuple": { + "name": "meta.type.tuple.js", + "begin": "\\[", + "beginCaptures": { + "0": { + "name": "meta.brace.square.js" + } + }, + "end": "\\]", + "endCaptures": { + "0": { + "name": "meta.brace.square.js" + } + }, + "patterns": [ + { + "include": "#type" + }, + { + "include": "#punctuation-comma" + } + ] + }, + "type-name": { + "patterns": [ + { + "match": "([_$[:alpha:]][_$[:alnum:]]*)\\s*(\\.)", + "captures": { + "1": { + "name": "entity.name.type.module.js" + }, + "2": { + "name": "punctuation.accessor.js" + } + } + }, + { + "name": "entity.name.type.js", + "match": "[_$[:alpha:]][_$[:alnum:]]*" + } + ] + }, + "type-parameters": { + "name": "meta.type.parameters.js", + "begin": "(<)", + "beginCaptures": { + "1": { + "name": "punctuation.definition.typeparameters.begin.js" + } + }, + "end": "(?=$)|(>)", + "endCaptures": { + "1": { + "name": "punctuation.definition.typeparameters.end.js" + } + }, + "patterns": [ + { + "include": "#comment" + }, + { + "name": "storage.modifier.js", + "match": "(?]|\\<[^<>]+\\>)+>\\s*)?\\()", + "captures": { + "1": { + "name": "punctuation.accessor.js" + }, + "2": { + "name": "support.constant.dom.js" + }, + "3": { + "name": "support.variable.property.dom.js" + } + } + }, + { + "name": "support.class.node.js", + "match": "(?x)(?]|\\<[^<>]+\\>)+>\\s*)?\\()", + "end": "(?<=\\))(?!(\\.\\s*)?([_$[:alpha:]][_$[:alnum:]]*)\\s*(<([^<>]|\\<[^<>]+\\>)+>\\s*)?\\()", + "patterns": [ + { + "include": "#support-objects" + }, + { + "name": "punctuation.accessor.js", + "match": "\\." + }, + { + "name": "entity.name.function.js", + "match": "([_$[:alpha:]][_$[:alnum:]]*)" + }, + { + "include": "#comment" + }, + { + "name": "meta.type.parameters.js", + "begin": "\\<", + "beginCaptures": { + "0": { + "name": "punctuation.definition.typeparameters.begin.js" + } + }, + "end": "\\>", + "endCaptures": { + "0": { + "name": "punctuation.definition.typeparameters.end.js" + } + }, + "patterns": [ + { + "include": "#type" + }, + { + "include": "#punctuation-comma" + } + ] + }, + { + "include": "#paren-expression" + } + ] + }, + "identifiers": { + "patterns": [ + { + "name": "support.class.js", + "match": "([_$[:alpha:]][_$[:alnum:]]*)(?=\\s*\\.\\s*prototype\\b(?!\\$))" + }, + { + "match": "(?x)(\\.)\\s*(?:\n ([[:upper:]][_$[:digit:][:upper:]]*) |\n ([_$[:alpha:]][_$[:alnum:]]*)\n)(?=\\s*\\.\\s*[_$[:alpha:]][_$[:alnum:]]*)", + "captures": { + "1": { + "name": "punctuation.accessor.js" + }, + "2": { + "name": "constant.other.object.property.js" + }, + "3": { + "name": "variable.other.object.property.js" + } + } + }, + { + "match": "(?x)(?:(\\.)\\s*)?([_$[:alpha:]][_$[:alnum:]]*)(?=\\s*=\\s*( (async\\s+)|(function\\s*[(<])|(function\\s+)| ([_$[:alpha:]][_$[:alnum:]]*\\s*=>)| ((<([^<>]|\\<[^<>]+\\>)+>\\s*)?\\(([^()]|\\([^()]*\\))*\\)(\\s*:\\s*(.)*)?\\s*=>)))", + "captures": { + "1": { + "name": "punctuation.accessor.js" + }, + "2": { + "name": "entity.name.function.js" + } + } + }, + { + "match": "(\\.)\\s*([[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])", + "captures": { + "1": { + "name": "punctuation.accessor.js" + }, + "2": { + "name": "constant.other.property.js" + } + } + }, + { + "match": "(\\.)\\s*([_$[:alpha:]][_$[:alnum:]]*)", + "captures": { + "1": { + "name": "punctuation.accessor.js" + }, + "2": { + "name": "variable.other.property.js" + } + } + }, + { + "match": "(?x)(?:\n ([[:upper:]][_$[:digit:][:upper:]]*) |\n ([_$[:alpha:]][_$[:alnum:]]*)\n)(?=\\s*\\.\\s*[_$[:alpha:]][_$[:alnum:]]*)", + "captures": { + "1": { + "name": "constant.other.object.js" + }, + "2": { + "name": "variable.other.object.js" + } + } + }, + { + "name": "constant.other.js", + "match": "([[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])" + }, + { + "name": "variable.other.readwrite.js", + "match": "[_$[:alpha:]][_$[:alnum:]]*" + } + ] + }, + "cast": { + "patterns": [ + { + "include": "#jsx" + } + ] + }, + "new-expr": { + "name": "new.expr.js", + "begin": "(?)| ((<([^<>]|\\<[^<>]+\\>)+>\\s*)?\\(([^()]|\\([^()]*\\))*\\)(\\s*:\\s*(.)*)?\\s*=>))))", + "beginCaptures": { + "0": { + "name": "meta.object-literal.key.js" + }, + "1": { + "name": "entity.name.function.js" + }, + "2": { + "name": "punctuation.separator.key-value.js" + } + }, + "end": "(?=,|\\})", + "patterns": [ + { + "include": "#expression" + } + ] + }, + { + "name": "meta.object.member.js", + "begin": "(?:[_$[:alpha:]][_$[:alnum:]]*)\\s*(:)", + "beginCaptures": { + "0": { + "name": "meta.object-literal.key.js" + }, + "1": { + "name": "punctuation.separator.key-value.js" + } + }, + "end": "(?=,|\\})", + "patterns": [ + { + "include": "#expression" + } + ] + }, + { + "name": "meta.object.member.js", + "begin": "\\.\\.\\.", + "beginCaptures": { + "0": { + "name": "keyword.operator.spread.js" + } + }, + "end": "(?=,|\\})", + "patterns": [ + { + "include": "#expression" + } + ] + }, + { + "name": "meta.object.member.js", + "match": "([_$[:alpha:]][_$[:alnum:]]*)\\s*(?=,|\\}|$)", + "captures": { + "1": { + "name": "variable.other.readwrite.js" + } + } + }, + { + "include": "#punctuation-comma" + } + ] + }, + "expression-operators": { + "patterns": [ + { + "name": "keyword.control.flow.js", + "match": "(?>=|>>>=|\\|=" + }, + { + "name": "keyword.operator.bitwise.shift.js", + "match": "<<|>>>|>>" + }, + { + "name": "keyword.operator.comparison.js", + "match": "===|!==|==|!=" + }, + { + "name": "keyword.operator.relational.js", + "match": "<=|>=|<>|<|>" + }, + { + "name": "keyword.operator.logical.js", + "match": "\\!|&&|\\|\\|" + }, + { + "name": "keyword.operator.bitwise.js", + "match": "\\&|~|\\^|\\|" + }, + { + "name": "keyword.operator.assignment.js", + "match": "\\=" + }, + { + "name": "keyword.operator.decrement.js", + "match": "--" + }, + { + "name": "keyword.operator.increment.js", + "match": "\\+\\+" + }, + { + "name": "keyword.operator.arithmetic.js", + "match": "%|\\*|/|-|\\+" + }, + { + "match": "(?<=[_$[:alnum:]])\\s*(/)(?![/*])", + "captures": { + "1": { + "name": "keyword.operator.arithmetic.js" + } + } + } + ] + }, + "typeof-operator": { + "name": "keyword.operator.expression.typeof.js", + "match": "(?)", + "captures": { + "1": { + "name": "storage.modifier.async.js" + }, + "2": { + "name": "variable.parameter.js" + } + } + }, + { + "name": "meta.arrow.js", + "begin": "(?x)\\s*(?=(<([^<>]|\\<[^<>]+\\>)+>\\s*)?\\(([^()]|\\([^()]*\\))*\\)(\\s*:\\s*(.)*)?\\s*=>)", + "end": "(?==>)", + "patterns": [ + { + "include": "#comment" + }, + { + "include": "#type-parameters" + }, + { + "include": "#function-parameters" + }, + { + "include": "#arrow-return-type" + } + ] + }, + { + "name": "meta.arrow.js", + "begin": "=>", + "beginCaptures": { + "0": { + "name": "storage.type.function.arrow.js" + } + }, + "end": "(?<=\\})|((?!\\{)(?=\\S))", + "patterns": [ + { + "include": "#decl-block" + }, + { + "include": "#expression" + } + ] + } + ] + }, + "arrow-return-type": { + "name": "meta.return.type.arrow.js", + "begin": "(?<=\\))\\s*(:)", + "beginCaptures": { + "1": { + "name": "keyword.operator.type.annotation.js" + } + }, + "end": "(?|;|//))", + "patterns": [ + { + "include": "#type-predicate-operator" + }, + { + "include": "#type" + } + ] + }, + "punctuation-comma": { + "name": "punctuation.separator.comma.js", + "match": "," + }, + "punctuation-semicolon": { + "name": "punctuation.terminator.statement.js", + "match": ";" + }, + "punctuation-accessor": { + "name": "punctuation.accessor.js", + "match": "\\." + }, + "paren-expression": { + "begin": "\\(", + "beginCaptures": { + "0": { + "name": "meta.brace.round.js" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "meta.brace.round.js" + } + }, + "patterns": [ + { + "include": "#expression" + }, + { + "include": "#punctuation-comma" + } + ] + }, + "qstring-double": { + "name": "string.quoted.double.js", + "begin": "\"", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.js" + } + }, + "end": "(\")|((?:[^\\\\\\n])$)", + "endCaptures": { + "1": { + "name": "punctuation.definition.string.end.js" + }, + "2": { + "name": "invalid.illegal.newline.js" + } + }, + "patterns": [ + { + "include": "#string-character-escape" + } + ] + }, + "qstring-single": { + "name": "string.quoted.single.js", + "begin": "'", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.js" + } + }, + "end": "(\\')|((?:[^\\\\\\n])$)", + "endCaptures": { + "1": { + "name": "punctuation.definition.string.end.js" + }, + "2": { + "name": "invalid.illegal.newline.js" + } + }, + "patterns": [ + { + "include": "#string-character-escape" + } + ] + }, + "regex": { + "patterns": [ + { + "name": "string.regex.js", + "begin": "(?<=[=(:,\\[?+!]|return|case|=>|&&|\\|\\||\\*\\/)\\s*(/)(?![/*])(?=(?:[^/\\\\\\[]|\\\\.|\\[([^\\]\\\\]|\\\\.)+\\])+/(?![/*])[gimy]*(?!\\s*[a-zA-Z0-9_$]))", + "beginCaptures": { + "1": { + "name": "punctuation.definition.string.begin.js" + } + }, + "end": "(/)([gimuy]*)", + "endCaptures": { + "1": { + "name": "punctuation.definition.string.end.js" + }, + "2": { + "name": "keyword.other.js" + } + }, + "patterns": [ + { + "include": "#regexp" + } + ] + }, + { + "name": "string.regex.js", + "begin": "/(?![/*])(?=(?:[^/\\\\\\[]|\\\\.|\\[([^\\]\\\\]|\\\\.)+\\])+/(?![/*])[gimy]*(?!\\s*[a-zA-Z0-9_$]))", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.js" + } + }, + "end": "(/)([gimuy]*)", + "endCaptures": { + "1": { + "name": "punctuation.definition.string.end.js" + }, + "2": { + "name": "keyword.other.js" + } + }, + "patterns": [ + { + "include": "#regexp" + } + ] + } + ] + }, + "regexp": { + "patterns": [ + { + "name": "keyword.control.anchor.regexp", + "match": "\\\\[bB]|\\^|\\$" + }, + { + "name": "keyword.other.back-reference.regexp", + "match": "\\\\[1-9]\\d*" + }, + { + "name": "keyword.operator.quantifier.regexp", + "match": "[?+*]|\\{(\\d+,\\d+|\\d+,|,\\d+|\\d+)\\}\\??" + }, + { + "name": "keyword.operator.or.regexp", + "match": "\\|" + }, + { + "name": "meta.group.assertion.regexp", + "begin": "(\\()((\\?=)|(\\?!))", + "beginCaptures": { + "1": { + "name": "punctuation.definition.group.regexp" + }, + "2": { + "name": "punctuation.definition.group.assertion.regexp" + }, + "3": { + "name": "meta.assertion.look-ahead.regexp" + }, + "4": { + "name": "meta.assertion.negative-look-ahead.regexp" + } + }, + "end": "(\\))", + "endCaptures": { + "1": { + "name": "punctuation.definition.group.regexp" + } + }, + "patterns": [ + { + "include": "#regexp" + } + ] + }, + { + "name": "meta.group.regexp", + "begin": "\\((\\?:)?", + "beginCaptures": { + "0": { + "name": "punctuation.definition.group.regexp" + }, + "1": { + "name": "punctuation.definition.group.capture.regexp" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.definition.group.regexp" + } + }, + "patterns": [ + { + "include": "#regexp" + } + ] + }, + { + "name": "constant.other.character-class.set.regexp", + "begin": "(\\[)(\\^)?", + "beginCaptures": { + "1": { + "name": "punctuation.definition.character-class.regexp" + }, + "2": { + "name": "keyword.operator.negation.regexp" + } + }, + "end": "(\\])", + "endCaptures": { + "1": { + "name": "punctuation.definition.character-class.regexp" + } + }, + "patterns": [ + { + "name": "constant.other.character-class.range.regexp", + "match": "(?:.|(\\\\(?:[0-7]{3}|x\\h\\h|u\\h\\h\\h\\h))|(\\\\c[A-Z])|(\\\\.))\\-(?:[^\\]\\\\]|(\\\\(?:[0-7]{3}|x\\h\\h|u\\h\\h\\h\\h))|(\\\\c[A-Z])|(\\\\.))", + "captures": { + "1": { + "name": "constant.character.numeric.regexp" + }, + "2": { + "name": "constant.character.control.regexp" + }, + "3": { + "name": "constant.character.escape.backslash.regexp" + }, + "4": { + "name": "constant.character.numeric.regexp" + }, + "5": { + "name": "constant.character.control.regexp" + }, + "6": { + "name": "constant.character.escape.backslash.regexp" + } + } + }, + { + "include": "#regex-character-class" + } + ] + }, + { + "include": "#regex-character-class" + } + ] + }, + "regex-character-class": { + "patterns": [ + { + "name": "constant.other.character-class.regexp", + "match": "\\\\[wWsSdDtrnvf]|\\." + }, + { + "name": "constant.character.numeric.regexp", + "match": "\\\\([0-7]{3}|x\\h\\h|u\\h\\h\\h\\h)" + }, + { + "name": "constant.character.control.regexp", + "match": "\\\\c[A-Z]" + }, + { + "name": "constant.character.escape.backslash.regexp", + "match": "\\\\." + } + ] + }, + "string": { + "patterns": [ + { + "include": "#qstring-single" + }, + { + "include": "#qstring-double" + } + ] + }, + "template": { + "name": "string.template.js", + "begin": "([_$[:alpha:]][_$[:alnum:]]*)?(`)", + "beginCaptures": { + "1": { + "name": "entity.name.function.tagged-template.js" + }, + "2": { + "name": "punctuation.definition.string.template.begin.js" + } + }, + "end": "`", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.template.end.js" + } + }, + "patterns": [ + { + "include": "#template-substitution-element" + }, + { + "include": "#string-character-escape" + } + ] + }, + "string-character-escape": { + "name": "constant.character.escape.js", + "match": "\\\\(x\\h{2}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.|$)" + }, + "template-substitution-element": { + "name": "meta.template.expression.js", + "begin": "\\$\\{", + "beginCaptures": { + "0": { + "name": "punctuation.definition.template-expression.begin.js" + } + }, + "end": "\\}", + "endCaptures": { + "0": { + "name": "punctuation.definition.template-expression.end.js" + } + }, + "patterns": [ + { + "include": "#expression" + } + ] + }, + "literal": { + "name": "literal.js", + "patterns": [ + { + "include": "#numeric-literal" + }, + { + "include": "#boolean-literal" + }, + { + "include": "#null-literal" + }, + { + "include": "#undefined-literal" + }, + { + "include": "#numericConstant-literal" + }, + { + "include": "#array-literal" + }, + { + "include": "#this-literal" + }, + { + "include": "#super-literal" + } + ] + }, + "array-literal": { + "name": "meta.array.literal.js", + "begin": "\\[", + "beginCaptures": { + "0": { + "name": "meta.brace.square.js" + } + }, + "end": "\\]", + "endCaptures": { + "0": { + "name": "meta.brace.square.js" + } + }, + "patterns": [ + { + "include": "#expression" + }, + { + "include": "#punctuation-comma" + } + ] + }, + "numeric-literal": { + "patterns": [ + { + "name": "constant.numeric.hex.js", + "match": "\\b(?\\s*$)", + "beginCaptures": { + "1": { + "name": "punctuation.definition.comment.js" + } + }, + "end": "(?=$)", + "patterns": [ + { + "name": "meta.tag.js", + "begin": "(<)(reference|amd-dependency|amd-module)", + "beginCaptures": { + "1": { + "name": "punctuation.definition.tag.directive.js" + }, + "2": { + "name": "entity.name.tag.directive.js" + } + }, + "end": "/>", + "endCaptures": { + "0": { + "name": "punctuation.definition.tag.directive.js" + } + }, + "patterns": [ + { + "name": "entity.other.attribute-name.directive.js", + "match": "path|types|no-default-lib|name" + }, + { + "name": "keyword.operator.assignment.js", + "match": "=" + }, + { + "include": "#string" + } + ] + } + ] + }, + "docblock": { + "patterns": [ + { + "name": "storage.type.class.jsdoc", + "match": "(? # {Array} or {Object} type application (optional .)\n )\n (?:\n [\\.|~] # {Foo.bar} namespaced, {string|number} multiple, {Foo~bar} class-specific callback\n [a-zA-Z_$]+\n (?:\n (?:\n [\\w$]*\n (?:\\[\\])? # {(string|number[])} type application, a string or an array of numbers\n ) |\n \\.?<[\\w$]+(?:,\\s+[\\w$]+)*> # {Array} or {Object} type application (optional .)\n )\n )*\n \\) |\n [a-zA-Z_$]+\n (?:\n (?:\n [\\w$]*\n (?:\\[\\])? # {string[]|number} type application, an array of strings or a number\n ) |\n \\.?<[\\w$]+(?:,\\s+[\\w$]+)*> # {Array} or {Object} type application (optional .)\n )\n (?:\n [\\.|~] # {Foo.bar} namespaced, {string|number} multiple, {Foo~bar} class-specific callback\n [a-zA-Z_$]+\n (?:\n [\\w$]* |\n \\.?<[\\w$]+(?:,\\s+[\\w$]+)*> # {Array} or {Object} type application (optional .)\n )\n )*\n )\n # Check for suffix\n (?:\\[\\])? # {string[]} type application, an array of strings\n =? # {string=} optional parameter\n)})\n\\s+\n(\n \\[ # [foo] optional parameter\n \\s*\n (?:\n [a-zA-Z_$][\\w$]*\n (?:\n (?:\\[\\])? # Foo[].bar properties within an array\n \\. # Foo.Bar namespaced parameter\n [a-zA-Z_$][\\w$]*\n )*\n (?:\n \\s*\n = # [foo=bar] Default parameter value\n \\s*\n [\\w$\\s]*\n )?\n )\n \\s*\n \\] |\n (?:\n [a-zA-Z_$][\\w$]*\n (?:\n (?:\\[\\])? # Foo[].bar properties within an array\n \\. # Foo.Bar namespaced parameter\n [a-zA-Z_$][\\w$]*\n )*\n )?\n)\n\\s+\n(?:-\\s+)? # optional hyphen before the description\n((?:(?!\\*\\/).)*) # The type description", + "captures": { + "0": { + "name": "other.meta.jsdoc" + }, + "1": { + "name": "entity.name.type.instance.jsdoc" + }, + "2": { + "name": "variable.other.jsdoc" + }, + "3": { + "name": "other.description.jsdoc" + } + } + }, + { + "match": "(?x)\n({(?:\n \\* | # {*} any type\n \\? | # {?} unknown type\n\n (?: # Check for a prefix\n \\? | # {?string} nullable type\n ! | # {!string} non-nullable type\n \\.{3} # {...string} variable number of parameters\n )?\n\n (?:\n \\( # Opening bracket of multiple types with parenthesis {(string|number)}\n [a-zA-Z_$]+\n (?:\n [\\w$]* |\n \\.?<[\\w$]+(?:,\\s+[\\w$]+)*> # {Array} or {Object} type application (optional .)\n )\n (?:\n [\\.|~] # {Foo.bar} namespaced, {string|number} multiple, {Foo~bar} class-specific callback\n [a-zA-Z_$]+\n (?:\n [\\w$]* |\n \\.?<[\\w$]+(?:,\\s+[\\w$]+)*> # {Array} or {Object} type application (optional .)\n )\n )*\n \\) |\n [a-zA-Z_$]+\n (?:\n [\\w$]* |\n \\.?<[\\w$]+(?:,\\s+[\\w$]+)*> # {Array} or {Object} type application (optional .)\n )\n (?:\n [\\.|~] # {Foo.bar} namespaced, {string|number} multiple, {Foo~bar} class-specific callback\n [a-zA-Z_$]+\n (?:\n [\\w$]* |\n \\.?<[\\w$]+(?:,\\s+[\\w$]+)*> # {Array} or {Object} type application (optional .)\n )\n )*\n )\n # Check for suffix\n (?:\\[\\])? # {string[]} type application, an array of strings\n =? # {string=} optional parameter\n)})\n\\s+\n(?:-\\s+)? # optional hyphen before the description\n((?:(?!\\*\\/).)*) # The type description", + "captures": { + "0": { + "name": "other.meta.jsdoc" + }, + "1": { + "name": "entity.name.type.instance.jsdoc" + }, + "2": { + "name": "other.description.jsdoc" + } + } + } + ] + }, + "jsx-tag-attributes": { + "patterns": [ + { + "include": "#jsx-tag-attribute-name" + }, + { + "include": "#jsx-tag-attribute-assignment" + }, + { + "include": "#jsx-string-double-quoted" + }, + { + "include": "#jsx-string-single-quoted" + }, + { + "include": "#jsx-evaluated-code" + } + ] + }, + "jsx-tag-attribute-name": { + "match": "(?x)\n \\s*\n ([_$a-zA-Z][-$\\w]*)\n (?=\\s|=|/?>|/\\*|//)", + "captures": { + "1": { + "name": "entity.other.attribute-name.js" + } + } + }, + "jsx-tag-attribute-assignment": { + "name": "keyword.operator.assignment.js", + "match": "=(?=\\s*(?:'|\"|{|/\\*|//|\\n))" + }, + "jsx-string-double-quoted": { + "name": "string.quoted.double.js", + "begin": "\"", + "end": "\"", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.js" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.js" + } + }, + "patterns": [ + { + "include": "#jsx-entities" + } + ] + }, + "jsx-string-single-quoted": { + "name": "string.quoted.single.js", + "begin": "'", + "end": "'", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.js" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.js" + } + }, + "patterns": [ + { + "include": "#jsx-entities" + } + ] + }, + "jsx-entities": { + "patterns": [ + { + "name": "constant.character.entity.js", + "match": "(&)([a-zA-Z0-9]+|#[0-9]+|#x[0-9a-fA-F]+)(;)", + "captures": { + "1": { + "name": "punctuation.definition.entity.js" + }, + "3": { + "name": "punctuation.definition.entity.js" + } + } + }, + { + "name": "invalid.illegal.bad-ampersand.js", + "match": "&" + } + ] + }, + "jsx-evaluated-code": { + "name": "meta.embedded.expression.js", + "begin": "{", + "end": "}", + "beginCaptures": { + "0": { + "name": "punctuation.section.embedded.begin.js" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.section.embedded.end.js" + } + }, + "patterns": [ + { + "include": "#expression" + } + ] + }, + "jsx-tag-attributes-illegal": { + "name": "invalid.illegal.attribute.js", + "match": "\\S+" + }, + "jsx-tag-without-attributes": { + "name": "meta.tag.without-attributes.js", + "begin": "(<)\\s*([_$a-zA-Z][-$\\w.]*(?)", + "end": "()", + "beginCaptures": { + "1": { + "name": "punctuation.definition.tag.begin.js" + }, + "2": { + "name": "entity.name.tag.js" + }, + "3": { + "name": "punctuation.definition.tag.end.js" + } + }, + "endCaptures": { + "1": { + "name": "punctuation.definition.tag.begin.js" + }, + "2": { + "name": "entity.name.tag.js" + }, + "3": { + "name": "punctuation.definition.tag.end.js" + } + }, + "contentName": "meta.jsx.children.tsx", + "patterns": [ + { + "include": "#jsx-children" + } + ] + }, + "jsx-tag-in-expression": { + "begin": "(?x)\n (?<=[({\\[,?=>]|&&|\\|\\||\\?|\\Wreturn|^return|\\Wdefault|^)\\s*\n (?!(<)\\s*([_$a-zA-Z][-$\\w.]*(?)) #look ahead is not start of tag without attributes\n (?!<\\s*[_$[:alpha:]][_$[:alnum:]]*((\\s+extends\\s+[^=>])|,)) # look ahead is not type parameter of arrow\n (?=(<)\\s*\n ([_$a-zA-Z][-$\\w.]*(?))", + "end": "(/>)|(?:())", + "endCaptures": { + "0": { + "name": "meta.tag.js" + }, + "1": { + "name": "punctuation.definition.tag.end.js" + }, + "2": { + "name": "punctuation.definition.tag.begin.js" + }, + "3": { + "name": "entity.name.tag.js" + }, + "4": { + "name": "punctuation.definition.tag.end.js" + } + }, + "patterns": [ + { + "include": "#jsx-tag" + } + ] + }, + "jsx-child-tag": { + "begin": "(?x)\n (?=(<)\\s*\n ([_$a-zA-Z][-$\\w.]*(?))", + "end": "(/>)|(?:())", + "endCaptures": { + "0": { + "name": "meta.tag.js" + }, + "1": { + "name": "punctuation.definition.tag.end.js" + }, + "2": { + "name": "punctuation.definition.tag.begin.js" + }, + "3": { + "name": "entity.name.tag.js" + }, + "4": { + "name": "punctuation.definition.tag.end.js" + } + }, + "patterns": [ + { + "include": "#jsx-tag" + } + ] + }, + "jsx-tag": { + "name": "meta.tag.js", + "begin": "(?x)\n (?=(<)\\s*\n ([_$a-zA-Z][-$\\w.]*(?))", + "end": "(?=(/>)|(?:()))", + "patterns": [ + { + "begin": "(?x)\n (<)\\s*\n ([_$a-zA-Z][-$\\w.]*(?)", + "beginCaptures": { + "1": { + "name": "punctuation.definition.tag.begin.js" + }, + "2": { + "name": "entity.name.tag.js" + } + }, + "end": "(?=[/]?>)", + "patterns": [ + { + "include": "#comment" + }, + { + "include": "#jsx-tag-attributes" + }, + { + "include": "#jsx-tag-attributes-illegal" + } + ] + }, + { + "begin": "(>)", + "beginCaptures": { + "1": { + "name": "punctuation.definition.tag.end.js" + } + }, + "end": "(?=" + }, + "jsx-children": { + "patterns": [ + { + "include": "#jsx-tag-without-attributes" + }, + { + "include": "#jsx-child-tag" + }, + { + "include": "#jsx-tag-invalid" + }, + { + "include": "#jsx-evaluated-code" + }, + { + "include": "#jsx-entities" + } + ] + }, + "jsx": { + "patterns": [ + { + "include": "#jsx-tag-without-attributes" + }, + { + "include": "#jsx-tag-in-expression" + }, + { + "include": "#jsx-tag-invalid" + } + ] + } + }, + "version": "https://github.com/Microsoft/TypeScript-TmLanguage/commit/4d0bdebb93aadc25ecbb903ebc897e9cd5fab69c" +} \ No newline at end of file diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js index 1e38e9d..0876cfa 100644 --- a/benchmark/benchmark.js +++ b/benchmark/benchmark.js @@ -33,7 +33,7 @@ async function tokenizeFile(filePath, scope, message) { function loadGrammar(scopeName) { let grammarPath = null; if (scopeName === 'source.js') { - grammarPath = path.resolve(__dirname, '..', 'test-cases/first-mate/fixtures/javascript.json'); + grammarPath = path.resolve(__dirname, 'JavaScript.tmLanguage.json'); } else if (scopeName === 'source.ts') { grammarPath = path.resolve(__dirname, '..', 'test-cases/themes/syntaxes/TypeScript.tmLanguage.json'); } else if (scopeName === 'source.css') { @@ -54,6 +54,7 @@ async function test() { await tokenizeFile(path.join(__dirname, 'bootstrap.min.css.txt'), 'source.css', 'Bootstrap CSS v3.1.1 minified') await tokenizeFile(path.join(__dirname, 'large.min.js.txt'), 'source.js', 'jQuery v2.0.3 minified'); await tokenizeFile(path.join(__dirname, 'main.08642f99.css.txt'), 'source.css', 'Bootstrap with multi-byte minified') + await tokenizeFile(path.join(__dirname, 'minified.js.txt'), 'source.js', 'Simple minified file'); }; test(); diff --git a/benchmark/minified.js.txt b/benchmark/minified.js.txt new file mode 100644 index 0000000..e1efff4 --- /dev/null +++ b/benchmark/minified.js.txt @@ -0,0 +1 @@ +!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.onig=n():t.onig=n()}(this,(function(){return t={770:function(t,n,e){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(n,"__esModule",{value:!0}),n.setDefaultDebugCall=n.createOnigScanner=n.createOnigString=n.loadWASM=n.OnigScanner=n.OnigString=void 0;const i=r(e(418));let o=null,a=!1;class f{constructor(t){const n=t.length,e=f._utf8ByteLength(t),r=e!==n,i=r?new Uint32Array(n+1):null;r&&(i[n]=e);const o=r?new Uint32Array(e+1):null;r&&(o[e]=n);const a=new Uint8Array(e);let s=0;for(let e=0;e=55296&&f<=56319&&e+1=56320&&n<=57343&&(u=65536+(f-55296<<10)|n-56320,c=!0)}r&&(i[e]=s,c&&(i[e+1]=s),u<=127?o[s+0]=e:u<=2047?(o[s+0]=e,o[s+1]=e):u<=65535?(o[s+0]=e,o[s+1]=e,o[s+2]=e):(o[s+0]=e,o[s+1]=e,o[s+2]=e,o[s+3]=e)),u<=127?a[s++]=u:u<=2047?(a[s++]=192|(1984&u)>>>6,a[s++]=128|(63&u)>>>0):u<=65535?(a[s++]=224|(61440&u)>>>12,a[s++]=128|(4032&u)>>>6,a[s++]=128|(63&u)>>>0):(a[s++]=240|(1835008&u)>>>18,a[s++]=128|(258048&u)>>>12,a[s++]=128|(4032&u)>>>6,a[s++]=128|(63&u)>>>0),c&&e++}this.utf16Length=n,this.utf8Length=e,this.utf16Value=t,this.utf8Value=a,this.utf16OffsetToUtf8=i,this.utf8OffsetToUtf16=o}static _utf8ByteLength(t){let n=0;for(let e=0,r=t.length;e=55296&&i<=56319&&e+1=56320&&n<=57343&&(o=65536+(i-55296<<10)|n-56320,a=!0)}n+=o<=127?1:o<=2047?2:o<=65535?3:4,a&&e++}return n}createString(t){const n=t._omalloc(this.utf8Length);return t.HEAPU8.set(this.utf8Value,n),n}}class s{constructor(t){if(this.id=++s.LAST_ID,!o)throw new Error("Must invoke loadWASM first.");this._onigBinding=o,this.content=t;const n=new f(t);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!s._sharedPtrInUse?(s._sharedPtr||(s._sharedPtr=o._omalloc(1e4)),s._sharedPtrInUse=!0,o.HEAPU8.set(n.utf8Value,s._sharedPtr),this.ptr=s._sharedPtr):this.ptr=n.createString(o)}convertUtf8OffsetToUtf16(t){return this.utf8OffsetToUtf16?t<0?0:t>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[t]:t}convertUtf16OffsetToUtf8(t){return this.utf16OffsetToUtf8?t<0?0:t>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[t]:t}dispose(){this.ptr===s._sharedPtr?s._sharedPtrInUse=!1:this._onigBinding._ofree(this.ptr)}}n.OnigString=s,s.LAST_ID=0,s._sharedPtr=0,s._sharedPtrInUse=!1;class u{constructor(t){if(!o)throw new Error("Must invoke loadWASM first.");const n=[],e=[];for(let r=0,i=t.length;r{r=t,a=n})),f=n instanceof ArrayBuffer?function(t){return n=>WebAssembly.instantiate(t,n)}(n):n instanceof Response&&"function"==typeof WebAssembly.instantiateStreaming?function(t){return n=>WebAssembly.instantiateStreaming(t,n)}(n):function(t){return async n=>{const e=await t.arrayBuffer();return WebAssembly.instantiate(e,n)}}(n),function(t,n,e,r){i.default({print:n,instantiateWasm:(n,e)=>{if("undefined"==typeof performance){const t=()=>Date.now();n.env.emscripten_get_now=t,n.wasi_snapshot_preview1.emscripten_get_now=t}return t(n).then((t=>e(t.instance)),r),{}}}).then((t=>{o=t,e()}))}(f,e,r,a),l},n.createOnigString=function(t){return new s(t)},n.createOnigScanner=function(t){return new u(t)},n.setDefaultDebugCall=function(t){a=t}},418:t=>{var n=("undefined"!=typeof document&&document.currentScript&&document.currentScript.src,function(t){var n,e,r=void 0!==(t=t||{})?t:{};r.ready=new Promise((function(t,r){n=t,e=r}));var i,o={};for(i in r)r.hasOwnProperty(i)&&(o[i]=r[i]);var a,f=[],s=!1,u=!1,c=!0,l="";function h(t){return r.locateFile?r.locateFile(t,l):l+t}c&&(a=function(t){var n;return"function"==typeof readbuffer?new Uint8Array(readbuffer(t)):(v("object"==typeof(n=read(t,"binary"))),n)},"undefined"!=typeof scriptArgs?f=scriptArgs:void 0!==arguments&&(f=arguments),"undefined"!=typeof onig_print&&("undefined"==typeof console&&(console={}),console.log=onig_print,console.warn=console.error="undefined"!=typeof printErr?printErr:onig_print));var p=r.print||console.log.bind(console),g=r.printErr||console.warn.bind(console);for(i in o)o.hasOwnProperty(i)&&(r[i]=o[i]);o=null,r.arguments&&(f=r.arguments),r.thisProgram&&r.thisProgram,r.quit&&r.quit;var d,_,m=function(t){};r.wasmBinary&&(d=r.wasmBinary),r.noExitRuntime,"object"!=typeof WebAssembly&&z("no native wasm support detected");var y=!1;function v(t,n){t||z("Assertion failed: "+n)}var w,S,A,b="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function O(t,n,e){for(var r=n+e,i=n;t[i]&&!(i>=r);)++i;if(i-n>16&&t.subarray&&b)return b.decode(t.subarray(n,i));for(var o="";n>10,56320|1023&u)}}else o+=String.fromCharCode((31&a)<<6|f)}else o+=String.fromCharCode(a)}return o}function U(t,n){return t?O(S,t,n):""}function x(t,n){return t%n>0&&(t+=n-t%n),t}function P(t){w=t,r.HEAP8=new Int8Array(t),r.HEAP16=new Int16Array(t),r.HEAP32=A=new Int32Array(t),r.HEAPU8=S=new Uint8Array(t),r.HEAPU16=new Uint16Array(t),r.HEAPU32=new Uint32Array(t),r.HEAPF32=new Float32Array(t),r.HEAPF64=new Float64Array(t)}"undefined"!=typeof TextDecoder&&new TextDecoder("utf-16le"),r.INITIAL_MEMORY;var T,R=[],E=[],M=[],L=[];function I(){if(r.preRun)for("function"==typeof r.preRun&&(r.preRun=[r.preRun]);r.preRun.length;)N(r.preRun.shift());$(R)}function D(){$(E)}function W(){$(M)}function C(){if(r.postRun)for("function"==typeof r.postRun&&(r.postRun=[r.postRun]);r.postRun.length;)B(r.postRun.shift());$(L)}function N(t){R.unshift(t)}function B(t){L.unshift(t)}E.push({func:function(){ut()}});var k=0,H=null,j=null;function F(t){k++,r.monitorRunDependencies&&r.monitorRunDependencies(k)}function V(t){if(k--,r.monitorRunDependencies&&r.monitorRunDependencies(k),0==k&&(null!==H&&(clearInterval(H),H=null),j)){var n=j;j=null,n()}}function z(t){r.onAbort&&r.onAbort(t),g(t+=""),y=!0,t="abort("+t+"). Build with -s ASSERTIONS=1 for more info.";var n=new WebAssembly.RuntimeError(t);throw e(n),n}function q(t,n){return String.prototype.startsWith?t.startsWith(n):0===t.indexOf(n)}r.preloadedImages={},r.preloadedAudios={};var Y="data:application/octet-stream;base64,";function G(t){return q(t,Y)}var J,K="onig.wasm";function Q(t){try{if(t==K&&d)return new Uint8Array(d);if(a)return a(t);throw"both async and sync fetching of the wasm failed"}catch(t){z(t)}}function X(){return d||!s&&!u||"function"!=typeof fetch?Promise.resolve().then((function(){return Q(K)})):fetch(K,{credentials:"same-origin"}).then((function(t){if(!t.ok)throw"failed to load wasm binary file at '"+K+"'";return t.arrayBuffer()})).catch((function(){return Q(K)}))}function Z(){var t={env:st,wasi_snapshot_preview1:st};function n(t,n){var e=t.exports;r.asm=e,P((_=r.asm.memory).buffer),T=r.asm.__indirect_function_table,V()}function i(t){n(t.instance)}function o(n){return X().then((function(n){return WebAssembly.instantiate(n,t)})).then(n,(function(t){g("failed to asynchronously prepare wasm: "+t),z(t)}))}if(F(),r.instantiateWasm)try{return r.instantiateWasm(t,n)}catch(t){return g("Module.instantiateWasm callback failed with error: "+t),!1}return(d||"function"!=typeof WebAssembly.instantiateStreaming||G(K)||"function"!=typeof fetch?o(i):fetch(K,{credentials:"same-origin"}).then((function(n){return WebAssembly.instantiateStreaming(n,t).then(i,(function(t){return g("wasm streaming compile failed: "+t),g("falling back to ArrayBuffer instantiation"),o(i)}))}))).catch(e),{}}function $(t){for(;t.length>0;){var n=t.shift();if("function"!=typeof n){var e=n.func;"number"==typeof e?void 0===n.arg?T.get(e)():T.get(e)(n.arg):e(void 0===n.arg?null:n.arg)}else n(r)}}function tt(t,n,e){S.copyWithin(t,n,n+e)}function nt(){return S.length}function et(t){try{return _.grow(t-w.byteLength+65535>>>16),P(_.buffer),1}catch(t){}}function rt(t){var n=nt(),e=2147483648;if(t>e)return!1;for(var r=1;r<=4;r*=2){var i=n*(1+.2/r);if(i=Math.min(i,t+100663296),et(Math.min(e,x(Math.max(t,i),65536))))return!0}return!1}G(K)||(K=h(K)),J="undefined"!=typeof dateNow?dateNow:function(){return performance.now()};var it={mappings:{},buffers:[null,[],[]],printChar:function(t,n){var e=it.buffers[t];0===n||10===n?((1===t?p:g)(O(e,0)),e.length=0):e.push(n)},varargs:void 0,get:function(){return it.varargs+=4,A[it.varargs-4>>2]},getStr:function(t){return U(t)},get64:function(t,n){return t}};function ot(t,n,e,r){for(var i=0,o=0;o>2],f=A[n+(8*o+4)>>2],s=0;s>2]=i,0}function at(t){m(0|t)}var ft,st={emscripten_get_now:J,emscripten_memcpy_big:tt,emscripten_resize_heap:rt,fd_write:ot,setTempRet0:at},ut=(Z(),r.___wasm_call_ctors=function(){return(ut=r.___wasm_call_ctors=r.asm.__wasm_call_ctors).apply(null,arguments)});function ct(t){function e(){ft||(ft=!0,r.calledRun=!0,y||(D(),W(),n(r),r.onRuntimeInitialized&&r.onRuntimeInitialized(),C()))}t=t||f,k>0||(I(),k>0||(r.setStatus?(r.setStatus("Running..."),setTimeout((function(){setTimeout((function(){r.setStatus("")}),1),e()}),1)):e()))}if(r.___errno_location=function(){return(r.___errno_location=r.asm.__errno_location).apply(null,arguments)},r._omalloc=function(){return(r._omalloc=r.asm.omalloc).apply(null,arguments)},r._ofree=function(){return(r._ofree=r.asm.ofree).apply(null,arguments)},r._getLastOnigError=function(){return(r._getLastOnigError=r.asm.getLastOnigError).apply(null,arguments)},r._createOnigScanner=function(){return(r._createOnigScanner=r.asm.createOnigScanner).apply(null,arguments)},r._freeOnigScanner=function(){return(r._freeOnigScanner=r.asm.freeOnigScanner).apply(null,arguments)},r._findNextOnigScannerMatch=function(){return(r._findNextOnigScannerMatch=r.asm.findNextOnigScannerMatch).apply(null,arguments)},r._findNextOnigScannerMatchDbg=function(){return(r._findNextOnigScannerMatchDbg=r.asm.findNextOnigScannerMatchDbg).apply(null,arguments)},r.stackSave=function(){return(r.stackSave=r.asm.stackSave).apply(null,arguments)},r.stackRestore=function(){return(r.stackRestore=r.asm.stackRestore).apply(null,arguments)},r.stackAlloc=function(){return(r.stackAlloc=r.asm.stackAlloc).apply(null,arguments)},r.dynCall_jiji=function(){return(r.dynCall_jiji=r.asm.dynCall_jiji).apply(null,arguments)},r.UTF8ToString=U,j=function t(){ft||ct(),ft||(j=t)},r.run=ct,r.preInit)for("function"==typeof r.preInit&&(r.preInit=[r.preInit]);r.preInit.length>0;)r.preInit.pop()();return ct(),t.ready});t.exports=n}},n={},function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{}};return t[r].call(i.exports,i,i.exports,e),i.exports}(770);var t,n})); diff --git a/package-lock.json b/package-lock.json index e75fcc6..8b2e440 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1445,9 +1445,9 @@ "dev": true }, "vscode-oniguruma": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.5.0.tgz", - "integrity": "sha512-5MgXSXvwy2GBy8BRi1Pegk+60LAHiY184cW93Fe1SmA9oPu8fRV3G9Yurbhkh/0hrb0E0/VK4JPieBX66gkftQ==", + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.5.1.tgz", + "integrity": "sha512-JrBZH8DCC262TEYcYdeyZusiETu0Vli0xFgdRwNJjDcObcRjbmJP+IFcA3ScBwIXwgFHYKbAgfxtM/Cl+3Spjw==", "dev": true }, "watchpack": { diff --git a/package.json b/package.json index 8405265..f6078a4 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "@types/tape": "^4.13.0", "tape": "^5.2.2", "typescript": "^4.2.3", - "vscode-oniguruma": "^1.5.0", + "vscode-oniguruma": "^1.5.1", "webpack": "^5.24.4", "webpack-cli": "^4.5.0" } diff --git a/release/main.js b/release/main.js index cd968ad..b0ca75d 100644 --- a/release/main.js +++ b/release/main.js @@ -1,2 +1,2 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.vscodetextmate=t():e.vscodetextmate=t()}(this,(function(){return(()=>{"use strict";var e={350:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebugFlags=void 0,t.DebugFlags={InDebugMode:"undefined"!=typeof process&&!!process.env.VSCODE_TEXTMATE_DEBUG}},527:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LocalStackElement=t.StackElement=t.ScopeListElement=t.StackElementMetadata=t.Grammar=t.ScopeMetadata=t.collectDependencies=t.collectSpecificDependencies=t.ScopeDependencyCollector=t.PartialScopeDependency=t.FullScopeDependency=t.createGrammar=void 0;var r=n(878),i=n(792),o=n(736),s=n(350),a="undefined"==typeof performance?function(){return Date.now()}:function(){return performance.now()};t.createGrammar=function(e,t,n,r,i,o){return new v(e,t,n,r,i,o)};var c=function(e){this.scopeName=e};t.FullScopeDependency=c;var u=function(){function e(e,t){this.scopeName=e,this.include=t}return e.prototype.toKey=function(){return this.scopeName+"#"+this.include},e}();t.PartialScopeDependency=u;var l=function(){function e(){this.full=[],this.partial=[],this.visitedRule=new Set,this._seenFull=new Set,this._seenPartial=new Set}return e.prototype.add=function(e){e instanceof c?this._seenFull.has(e.scopeName)||(this._seenFull.add(e.scopeName),this.full.push(e)):this._seenPartial.has(e.toKey())||(this._seenPartial.add(e.toKey()),this.partial.push(e))},e}();function p(e,t,n,i,o){for(var s=0,a=i;s=0){var _=g.substring(0,m),y=g.substring(m+1);_===t.scopeName?h(e,t,t,y,f):_===n.scopeName?h(e,t,n,y,f):e.add(new u(_,g.substring(m+1)))}else e.add(new c(g))}}}}function h(e,t,n,r,i){void 0===i&&(i=n.repository),i&&i[r]&&p(e,t,n,[i[r]],i)}function d(e,t,n){if(n.patterns&&Array.isArray(n.patterns)&&p(e,t,n,n.patterns,n.repository),n.injections){var r=[];for(var i in n.injections)r.push(n.injections[i]);p(e,t,n,r,n.repository)}}function f(e,t){if(!e)return!1;if(e===t)return!0;var n=t.length;return e.length>n&&e.substr(0,n)===t&&"."===e[n]}function g(e,t){if(t.length>")}var u=Object.keys(this._embeddedLanguages).map((function(t){return e._escapeRegExpCharacters(t)}));0===u.length?this._embeddedLanguagesRegex=null:(u.sort(),u.reverse(),this._embeddedLanguagesRegex=new RegExp("^(("+u.join(")|(")+"))($|\\.)",""))}return e.prototype.onDidChangeTheme=function(){this._cache=new Map,this._defaultMetaData=new _("",this._initialLanguage,0,[this._themeProvider.getDefaults()])},e.prototype.getDefaultMetadata=function(){return this._defaultMetaData},e._escapeRegExpCharacters=function(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")},e.prototype.getMetadataForScope=function(t){if(null===t)return e._NULL_SCOPE_METADATA;var n=this._cache.get(t);return n||(n=this._doGetMetadataForScope(t),this._cache.set(t,n),n)},e.prototype._doGetMetadataForScope=function(e){var t=this._scopeToLanguage(e),n=this._toStandardTokenType(e),r=this._themeProvider.themeMatch(e);return new _(e,t,n,r)},e.prototype._scopeToLanguage=function(e){if(!e)return 0;if(!this._embeddedLanguagesRegex)return 0;var t=e.match(this._embeddedLanguagesRegex);return t&&(this._embeddedLanguages[t[1]]||0)||0},e.prototype._toStandardTokenType=function(t){var n=t.match(e.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 0;switch(n[1]){case"comment":return 1;case"string":return 2;case"regex":return 4;case"meta.embedded":return 8}throw new Error("Unexpected match for standard token type!")},e._NULL_SCOPE_METADATA=new _("",0,0,null),e.STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/,e}(),v=function(){function e(e,t,n,r,i,s){if(this._scopeMetadataProvider=new y(t,i,n),this._onigLib=s,this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=i,this._grammar=R(e,null),this._injections=null,this._tokenTypeMatchers=[],r)for(var a=0,c=Object.keys(r);al)break;for(;u.length>0&&u[u.length-1].endPos<=d.start;)i.produceFromScopes(u[u.length-1].scopes,u[u.length-1].endPos),u.pop();if(u.length>0?i.produceFromScopes(u[u.length-1].scopes,d.start):i.produce(r,d.start),h.retokenizeCapturedWithRuleId){var f=h.getName(a,s),g=r.contentNameScopesList.push(e,f),m=h.getContentName(a,s),_=g.push(e,m),y=r.push(h.retokenizeCapturedWithRuleId,d.start,-1,!1,null,g,_),v=e.createOnigString(a.substring(0,d.end));C(e,v,n&&0===d.start,d.start,y,i,!1),b(v)}else{var R=h.getName(a,s);if(null!==R){var k=(u.length>0?u[u.length-1].scopes:r.contentNameScopesList).push(e,R);u.push(new T(k,d.end))}}}}}for(;u.length>0;)i.produceFromScopes(u[u.length-1].scopes,u[u.length-1].endPos),u.pop()}}function S(e){for(var t=[],n=0,r=e.rules.length;nr&&(r=g.captureIndices[0].end,n=!1))}return{stack:o,linePos:r,anchorPosition:c,isFirstLine:n}}(e,t,n,r,o,c);o=d.stack,r=d.linePos,n=d.isFirstLine,h=d.anchorPosition}for(;!p;)f();function f(){s.DebugFlags.InDebugMode&&(console.log(""),console.log("@@scanNext "+r+": |"+t.content.substr(r).replace(/\n$/,"\\n")+"|"));var u=function(e,t,n,r,i,o){var c=function(e,t,n,r,i,o){var c=i.getRule(e),u=c.compile(e,i.endRule),l=w(n,r===o),p=0;s.DebugFlags.InDebugMode&&(p=a());var h=u.scanner.findNextMatchSync(t,r,l);if(s.DebugFlags.InDebugMode){var d=a()-p;d>5&&console.warn("Rule "+c.debugName+" ("+c.id+") matching took "+d+" against '"+t+"'"),h&&console.log("matched rule id: "+u.rules[h.index]+" from "+h.captureIndices[0].start+" to "+h.captureIndices[0].end)}return h?{captureIndices:h.captureIndices,matchedRuleId:u.rules[h.index]}:null}(e,t,n,r,i,o),u=e.getInjections();if(0===u.length)return c;var l=function(e,t,n,r,i,o,a){for(var c,u=Number.MAX_VALUE,l=null,p=0,h=o.contentNameScopesList.generateScopes(),d=0,f=e.length;d=u)&&(u=v,l=y.captureIndices,c=m.rules[y.index],p=g.priority,u===i))break}}}return l?{priorityMatch:-1===p,captureIndices:l,matchedRuleId:c}:null}(u,e,t,n,r,i,o);if(!l)return c;if(!c)return l;var p=c.captureIndices[0].start,h=l.captureIndices[0].start;return h0)&&d[0].end>r;if(-1===f){var m=o.getRule(e);s.DebugFlags.InDebugMode&&console.log(" popping "+m.debugName+" - "+m.debugEndRegExp),c.produce(o,d[0].start),o=o.setContentNameScopesList(o.nameScopesList),k(e,t,n,o,c,m.endCaptures,d),c.produce(o,d[0].end);var _=o;if(o=o.pop(),h=_.getAnchorPos(),!g&&_.getEnterPos()===r)return s.DebugFlags.InDebugMode&&console.error("[1] - Grammar is in an endless loop - Grammar pushed & popped a rule without advancing"),o=_,c.produce(o,l),void(p=!0)}else{var y=e.getRule(f);c.produce(o,d[0].start);var v=o,b=y.getName(t.content,d),R=o.contentNameScopesList.push(e,b);if(o=o.push(f,r,h,d[0].end===l,null,R,R),y instanceof i.BeginEndRule){var C=y;s.DebugFlags.InDebugMode&&console.log(" pushing "+C.debugName+" - "+C.debugBeginRegExp),k(e,t,n,o,c,C.beginCaptures,d),c.produce(o,d[0].end),h=d[0].end;var P=C.getContentName(t.content,d),I=R.push(e,P);if(o=o.setContentNameScopesList(I),C.endHasBackReferences&&(o=o.setEndRule(C.getEndWithResolvedBackReferences(t.content,d))),!g&&v.hasSameRuleAs(o))return s.DebugFlags.InDebugMode&&console.error("[2] - Grammar is in an endless loop - Grammar pushed the same rule without advancing"),o=o.pop(),c.produce(o,l),void(p=!0)}else if(y instanceof i.BeginWhileRule){if(C=y,s.DebugFlags.InDebugMode&&console.log(" pushing "+C.debugName),k(e,t,n,o,c,C.beginCaptures,d),c.produce(o,d[0].end),h=d[0].end,P=C.getContentName(t.content,d),I=R.push(e,P),o=o.setContentNameScopesList(I),C.whileHasBackReferences&&(o=o.setEndRule(C.getWhileWithResolvedBackReferences(t.content,d))),!g&&v.hasSameRuleAs(o))return s.DebugFlags.InDebugMode&&console.error("[3] - Grammar is in an endless loop - Grammar pushed the same rule without advancing"),o=o.pop(),c.produce(o,l),void(p=!0)}else{var x=y;if(s.DebugFlags.InDebugMode&&console.log(" matched "+x.debugName+" - "+x.debugMatchRegExp),k(e,t,n,o,c,x.captures,d),c.produce(o,d[0].end),o=o.pop(),!g)return s.DebugFlags.InDebugMode&&console.error("[4] - Grammar is in an endless loop - Grammar is not advancing, nor is it pushing/popping"),o=o.safePop(),c.produce(o,l),void(p=!0)}}d[0].end>r&&(r=d[0].end,n=!1)}return o}t.Grammar=v;var P=function(){function e(){}return e.toBinaryStr=function(e){for(var t=e.toString(2);t.length<32;)t="0"+t;return t},e.printMetadata=function(t){var n=e.getLanguageId(t),r=e.getTokenType(t),i=e.getFontStyle(t),o=e.getForeground(t),s=e.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:i,foreground:o,background:s})},e.getLanguageId=function(e){return(255&e)>>>0},e.getTokenType=function(e){return(1792&e)>>>8},e.getFontStyle=function(e){return(14336&e)>>>11},e.getForeground=function(e){return(8372224&e)>>>14},e.getBackground=function(e){return(4286578688&e)>>>23},e.set=function(t,n,r,i,o,s){var a=e.getLanguageId(t),c=e.getTokenType(t),u=e.getFontStyle(t),l=e.getForeground(t),p=e.getBackground(t);return 0!==n&&(a=n),0!==r&&(c=8===r?0:r),-1!==i&&(u=i),0!==o&&(l=o),0!==s&&(p=s),(a<<0|c<<8|u<<11|l<<14|p<<23)>>>0},e}();t.StackElementMetadata=P;var I=function(){function e(e,t,n){this.parent=e,this.scope=t,this.metadata=n}return e._equals=function(e,t){for(;;){if(e===t)return!0;if(!e&&!t)return!0;if(!e||!t)return!1;if(e.scope!==t.scope||e.metadata!==t.metadata)return!1;e=e.parent,t=t.parent}},e.prototype.equals=function(t){return e._equals(this,t)},e._matchesScope=function(e,t,n){return t===e||e.substring(0,n.length)===n},e._matches=function(e,t){if(null===t)return!0;for(var n=t.length,r=0,i=t[r],o=i+".";e;){if(this._matchesScope(e.scope,i,o)){if(++r===n)return!0;o=(i=t[r])+"."}e=e.parent}return!1},e.mergeMetadata=function(e,t,n){if(null===n)return e;var r=-1,i=0,o=0;if(null!==n.themeData)for(var s=0,a=n.themeData.length;s=0?e._push(this,t,n.split(/ /g)):e._push(this,t,[n])},e._generateScopes=function(e){for(var t=[],n=0;e;)t[n++]=e.scope,e=e.parent;return t.reverse(),t},e.prototype.generateScopes=function(){return e._generateScopes(this)},e}();t.ScopeListElement=I;var x=function(){function e(e,t,n,r,i,o,s,a){this.parent=e,this.depth=this.parent?this.parent.depth+1:1,this.ruleId=t,this._enterPos=n,this._anchorPos=r,this.beginRuleCapturedEOL=i,this.endRule=o,this.nameScopesList=s,this.contentNameScopesList=a}return e._structuralEquals=function(e,t){for(;;){if(e===t)return!0;if(!e&&!t)return!0;if(!e||!t)return!1;if(e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}},e._equals=function(e,t){return e===t||!!this._structuralEquals(e,t)&&e.contentNameScopesList.equals(t.contentNameScopesList)},e.prototype.clone=function(){return this},e.prototype.equals=function(t){return null!==t&&e._equals(this,t)},e._reset=function(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent},e.prototype.reset=function(){e._reset(this)},e.prototype.pop=function(){return this.parent},e.prototype.safePop=function(){return this.parent?this.parent:this},e.prototype.push=function(t,n,r,i,o,s,a){return new e(this,t,n,r,i,o,s,a)},e.prototype.getEnterPos=function(){return this._enterPos},e.prototype.getAnchorPos=function(){return this._anchorPos},e.prototype.getRule=function(e){return e.getRule(this.ruleId)},e.prototype._writeString=function(e,t){return this.parent&&(t=this.parent._writeString(e,t)),e[t++]="("+this.ruleId+", TODO-"+this.nameScopesList+", TODO-"+this.contentNameScopesList+")",t},e.prototype.toString=function(){var e=[];return this._writeString(e,0),"["+e.join(",")+"]"},e.prototype.setContentNameScopesList=function(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)},e.prototype.setEndRule=function(t){return this.endRule===t?this:new e(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)},e.prototype.hasSameRuleAs=function(e){for(var t=this;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.parent}return!1},e.NULL=new e(null,0,0,0,!1,null,null,null),e}();t.StackElement=x;var T=function(e,t){this.scopes=e,this.endPos=t};t.LocalStackElement=T;var L=function(){function e(e,t,n){this._emitBinaryTokens=e,this._tokenTypeOverrides=n,s.DebugFlags.InDebugMode?this._lineText=t:this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}return e.prototype.produce=function(e,t){this.produceFromScopes(e.contentNameScopesList,t)},e.prototype.produceFromScopes=function(e,t){if(!(this._lastTokenEndIndex>=t)){if(this._emitBinaryTokens){for(var n=e.metadata,r=0,i=this._tokenTypeOverrides;r0&&this._binaryTokens[this._binaryTokens.length-1]===n||(this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(n)),void(this._lastTokenEndIndex=t)}var a=e.generateScopes();if(s.DebugFlags.InDebugMode){console.log(" token: |"+this._lineText.substring(this._lastTokenEndIndex,t).replace(/\n$/,"\\n")+"|");for(var c=0;c0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),0===this._tokens.length&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens},e.prototype.getBinaryResult=function(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),0===this._binaryTokens.length&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);for(var n=new Uint32Array(this._binaryTokens.length),r=0,i=this._binaryTokens.length;r{Object.defineProperty(t,"__esModule",{value:!0}),t.parseRawGrammar=void 0;var r=n(69),i=n(350),o=n(974);t.parseRawGrammar=function(e,t){return void 0===t&&(t=null),null!==t&&/\.json$/.test(t)?(n=e,s=t,i.DebugFlags.InDebugMode?o.parse(n,s,!0):JSON.parse(n)):function(e,t){return i.DebugFlags.InDebugMode?r.parseWithLocation(e,t,"$vscodeTextmateLocation"):r.parse(e)}(e,t);var n,s}},974:(e,t)=>{function n(e,t){throw new Error("Near offset "+e.pos+": "+t+" ~~~"+e.source.substr(e.pos,50)+"~~~")}Object.defineProperty(t,"__esModule",{value:!0}),t.parse=void 0,t.parse=function(e,t,s){var a=new r(e),c=new i,u=0,l=null,p=[],h=[];function d(){p.push(u),h.push(l)}function f(){u=p.pop(),l=h.pop()}function g(e){n(a,e)}for(;o(a,c);){if(0===u){if(null!==l&&g("too many constructs in root"),3===c.type){l={},s&&(l.$vscodeTextmateLocation=c.toLocation(t)),d(),u=1;continue}if(2===c.type){l=[],d(),u=4;continue}g("unexpected token in root")}if(2===u){if(5===c.type){f();continue}if(7===c.type){u=3;continue}g("expected , or }")}if(1===u||3===u){if(1===u&&5===c.type){f();continue}if(1===c.type){var m=c.value;if(o(a,c)&&6===c.type||g("expected colon"),o(a,c)||g("expected value"),u=2,1===c.type){l[m]=c.value;continue}if(8===c.type){l[m]=null;continue}if(9===c.type){l[m]=!0;continue}if(10===c.type){l[m]=!1;continue}if(11===c.type){l[m]=parseFloat(c.value);continue}if(2===c.type){var _=[];l[m]=_,d(),u=4,l=_;continue}if(3===c.type){var y={};s&&(y.$vscodeTextmateLocation=c.toLocation(t)),l[m]=y,d(),u=1,l=y;continue}}g("unexpected token in dict")}if(5===u){if(4===c.type){f();continue}if(7===c.type){u=6;continue}g("expected , or ]")}if(4===u||6===u){if(4===u&&4===c.type){f();continue}if(u=5,1===c.type){l.push(c.value);continue}if(8===c.type){l.push(null);continue}if(9===c.type){l.push(!0);continue}if(10===c.type){l.push(!1);continue}if(11===c.type){l.push(parseFloat(c.value));continue}if(2===c.type){_=[],l.push(_),d(),u=4,l=_;continue}if(3===c.type){y={},s&&(y.$vscodeTextmateLocation=c.toLocation(t)),l.push(y),d(),u=1,l=y;continue}g("unexpected token in array")}g("unknown state")}return 0!==h.length&&g("unclosed constructs"),l};var r=function(e){this.source=e,this.pos=0,this.len=e.length,this.line=1,this.char=0},i=function(){function e(){this.value=null,this.type=0,this.offset=-1,this.len=-1,this.line=-1,this.char=-1}return e.prototype.toLocation=function(e){return{filename:e,line:this.line,char:this.char}},e}();function o(e,t){t.value=null,t.type=0,t.offset=-1,t.len=-1,t.line=-1,t.char=-1;for(var r,i=e.source,o=e.pos,s=e.len,a=e.line,c=e.char;;){if(o>=s)return!1;if(32!==(r=i.charCodeAt(o))&&9!==r&&13!==r){if(10!==r)break;o++,a++,c=0}else o++,c++}if(t.offset=o,t.line=a,t.char=c,34===r){for(t.type=1,o++,c++;;){if(o>=s)return!1;if(r=i.charCodeAt(o),o++,c++,92!==r){if(34===r)break}else o++,c++}t.value=i.substring(t.offset+1,o-1).replace(/\\u([0-9A-Fa-f]{4})/g,(function(e,t){return String.fromCodePoint(parseInt(t,16))})).replace(/\\(.)/g,(function(t,r){switch(r){case'"':return'"';case"\\":return"\\";case"/":return"/";case"b":return"\b";case"f":return"\f";case"n":return"\n";case"r":return"\r";case"t":return"\t";default:n(e,"invalid escape sequence")}throw new Error("unreachable")}))}else if(91===r)t.type=2,o++,c++;else if(123===r)t.type=3,o++,c++;else if(93===r)t.type=4,o++,c++;else if(125===r)t.type=5,o++,c++;else if(58===r)t.type=6,o++,c++;else if(44===r)t.type=7,o++,c++;else if(110===r){if(t.type=8,o++,c++,117!==(r=i.charCodeAt(o)))return!1;if(o++,c++,108!==(r=i.charCodeAt(o)))return!1;if(o++,c++,108!==(r=i.charCodeAt(o)))return!1;o++,c++}else if(116===r){if(t.type=9,o++,c++,114!==(r=i.charCodeAt(o)))return!1;if(o++,c++,117!==(r=i.charCodeAt(o)))return!1;if(o++,c++,101!==(r=i.charCodeAt(o)))return!1;o++,c++}else if(102===r){if(t.type=10,o++,c++,97!==(r=i.charCodeAt(o)))return!1;if(o++,c++,108!==(r=i.charCodeAt(o)))return!1;if(o++,c++,115!==(r=i.charCodeAt(o)))return!1;if(o++,c++,101!==(r=i.charCodeAt(o)))return!1;o++,c++}else for(t.type=11;;){if(o>=s)return!1;if(!(46===(r=i.charCodeAt(o))||r>=48&&r<=57||101===r||69===r||45===r||43===r))break;o++,c++}return t.len=o-t.offset,null===t.value&&(t.value=i.substr(t.offset,t.len)),e.pos=o,e.line=a,e.char=c,!0}},787:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)},o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]")},e.prototype._loadGrammar=function(e,t,n,r){return o(this,void 0,void 0,(function(){var i,o,a,c,u,p,h,d,f,g,m,_,y=this;return s(this,(function(s){switch(s.label){case 0:i=new Set,o=new Set,i.add(e),a=[new l.FullScopeDependency(e)],s.label=1;case 1:return a.length>0?(c=a,a=[],[4,Promise.all(c.map((function(e){return y._loadSingleGrammar(e.scopeName)})))]):[3,3];case 2:for(s.sent(),u=new l.ScopeDependencyCollector,p=0,h=c;p{function n(e){return!!e&&!!e.match(/[\w\.:]+/)}Object.defineProperty(t,"__esModule",{value:!0}),t.createMatchers=void 0,t.createMatchers=function(e,t){for(var r,i,o,s=[],a=(o=(i=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g).exec(r=e),{next:function(){if(!o)return null;var e=o[0];return o=i.exec(r),e}}),c=a.next();null!==c;){var u=0;if(2===c.length&&":"===c.charAt(1)){switch(c.charAt(0)){case"R":u=1;break;case"L":u=-1;break;default:console.log("Unknown priority "+c+" in scope selector")}c=a.next()}var l=h();if(s.push({matcher:l,priority:u}),","!==c)break;c=a.next()}return s;function p(){if("-"===c){c=a.next();var e=p();return function(t){return!!e&&!e(t)}}if("("===c){c=a.next();var r=function(){for(var e=[],t=h();t&&(e.push(t),"|"===c||","===c);){do{c=a.next()}while("|"===c||","===c);t=h()}return function(t){return e.some((function(e){return e(t)}))}}();return")"===c&&(c=a.next()),r}if(n(c)){var i=[];do{i.push(c),c=a.next()}while(n(c));return function(e){return t(i,e)}}return null}function h(){for(var e=[],t=p();t;)e.push(t),t=p();return function(t){return e.every((function(e){return e(t)}))}}}},69:(e,t)=>{function n(e,t,n){var r=e.length,i=0,o=1,s=0;function a(t){if(null===n)i+=t;else for(;t>0;)10===e.charCodeAt(i)?(i++,o++,s=0):(i++,s++),t--}function c(e){null===n?i=e:a(e-i)}function u(){for(;i0&&65279===e.charCodeAt(0)&&(i=1);var d=0,f=null,g=[],m=[],_=null;function y(e,t){g.push(d),m.push(f),d=e,f=t}function v(){if(0===g.length)return b("illegal state stack");d=g.pop(),f=m.pop()}function b(t){throw new Error("Near offset "+i+": "+t+" ~~~"+e.substr(i,50)+"~~~")}var R,k,S,w,C,P=function(){if(null===_)return b("missing ");var e={};null!==n&&(e[n]={filename:t,line:o,char:s}),f[_]=e,_=null,y(1,e)},I=function(){if(null===_)return b("missing ");var e=[];f[_]=e,_=null,y(2,e)};function x(){if(1!==d)return b("unexpected ");v()}function T(){return 1===d||2!==d?b("unexpected "):void v()}function L(e){if(1===d){if(null===_)return b("missing ");f[_]=e,_=null}else 2===d?f.push(e):f=e}function M(e){if(isNaN(e))return b("cannot parse float");if(1===d){if(null===_)return b("missing ");f[_]=e,_=null}else 2===d?f.push(e):f=e}function D(e){if(isNaN(e))return b("cannot parse integer");if(1===d){if(null===_)return b("missing ");f[_]=e,_=null}else 2===d?f.push(e):f=e}function E(e){if(1===d){if(null===_)return b("missing ");f[_]=e,_=null}else 2===d?f.push(e):f=e}function N(e){if(1===d){if(null===_)return b("missing ");f[_]=e,_=null}else 2===d?f.push(e):f=e}function O(e){if(1===d){if(null===_)return b("missing ");f[_]=e,_=null}else 2===d?f.push(e):f=e}function F(e){if(e.isClosed)return"";var t=h(""),t.replace(/&#([0-9]+);/g,(function(e,t){return String.fromCodePoint(parseInt(t,10))})).replace(/&#x([0-9a-f]+);/g,(function(e,t){return String.fromCodePoint(parseInt(t,16))})).replace(/&|<|>|"|'/g,(function(e){switch(e){case"&":return"&";case"<":return"<";case">":return">";case""":return'"';case"'":return"'"}return e}))}for(;i=r));){var j=e.charCodeAt(i);if(a(1),60!==j)return b("expected <");if(i>=r)return b("unexpected end of input");var A=e.charCodeAt(i);if(63!==A)if(33!==A){if(47===A){if(a(1),u(),l("plist")){p(">");continue}if(l("dict")){p(">"),x();continue}if(l("array")){p(">"),T();continue}return b("unexpected closed tag")}var G=(k=void 0,S=void 0,S=!1,47===(k=h(">")).charCodeAt(k.length-1)&&(S=!0,k=k.substring(0,k.length-1)),{name:k.trim(),isClosed:S});switch(G.name){case"dict":1===d?P():2===d?(C=void 0,C={},null!==n&&(C[n]={filename:t,line:o,char:s}),f.push(C),y(1,C)):(f={},null!==n&&(f[n]={filename:t,line:o,char:s}),y(1,f)),G.isClosed&&x();continue;case"array":1===d?I():2===d?(w=void 0,w=[],f.push(w),y(2,w)):y(2,f=[]),G.isClosed&&T();continue;case"key":R=F(G),1!==d?b("unexpected "):null!==_?b("too many "):_=R;continue;case"string":L(F(G));continue;case"real":M(parseFloat(F(G)));continue;case"integer":D(parseInt(F(G),10));continue;case"date":E(new Date(F(G)));continue;case"data":N(F(G));continue;case"true":F(G),O(!0);continue;case"false":F(G),O(!1);continue}if(!/^plist/.test(G.name))return b("unexpected opened tag "+G.name)}else{if(a(1),l("--")){p("--\x3e");continue}p(">")}else a(1),p("?>")}return f}Object.defineProperty(t,"__esModule",{value:!0}),t.parse=t.parseWithLocation=void 0,t.parseWithLocation=function(e,t,r){return n(e,t,r)},t.parse=function(e){return n(e,null,null)}},652:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]o&&(o=c);for(var a=0;a<=o;a++)i[a]=null;for(var s in t)if("$vscodeTextmateLocation"!==s){var c=parseInt(s,10),u=0;t[s].patterns&&(u=e.getCompiledRuleId(t[s],n,r)),i[c]=e.createCaptureRule(n,t[s].$vscodeTextmateLocation,t[s].name,t[s].contentName,u)}}return i},e._compilePatterns=function(t,n,r){var i=[];if(t)for(var o=0,s=t.length;o=0?(l=a.include.substring(0,h),p=a.include.substring(h+1)):l=a.include;var d=n.getExternalGrammar(l,r);if(d)if(p){var _=d.repository[p];_&&(c=e.getCompiledRuleId(_,n,d.repository))}else c=e.getCompiledRuleId(d.repository.$self,n,d.repository)}else c=e.getCompiledRuleId(a,n,r);if(-1!==c){var y=n.getRule(c),v=!1;if((y instanceof f||y instanceof g||y instanceof m)&&y.hasMissingPatterns&&0===y.patterns.length&&(v=!0),v)continue;i.push(c)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}},e}();t.RuleFactory=_},583:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ThemeTrieElement=t.ThemeTrieElementRule=t.strArrCmp=t.strcmp=t.Theme=t.ColorMap=t.parseTheme=t.ParsedThemeRule=void 0;var n=function(e,t,n,r,i,o){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=i,this.background=o};function r(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function i(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];for(var t=e.settings,i=[],o=0,s=0,a=t.length;s1&&(_=g.slice(0,g.length-1)).reverse(),i[o++]=new n(m,_,s,l,d,f)}}}return i}function o(e,t){e.sort((function(e,t){var n=c(e.scope,t.scope);return 0!==n||0!==(n=u(e.parentScopes,t.parentScopes))?n:e.index-t.index}));for(var n=0,r="#000000",i="#ffffff";e.length>=1&&""===e[0].scope;){var o=e.shift();-1!==o.fontStyle&&(n=o.fontStyle),null!==o.foreground&&(r=o.foreground),null!==o.background&&(i=o.background)}for(var h=new s(t),d=new l(0,null,n,h.getId(r),h.getId(i)),f=new p(new l(0,null,-1,0,0),[]),g=0,m=e.length;gt?1:0}function u(e,t){if(null===e&&null===t)return 0;if(!e)return-1;if(!t)return 1;var n=e.length,r=t.length;if(n===r){for(var i=0;ie?console.log("how did this happen?"):this.scopeDepth=e,-1!==t&&(this.fontStyle=t),0!==n&&(this.foreground=n),0!==r&&(this.background=r)},e}();t.ThemeTrieElementRule=l;var p=function(){function e(e,t,n){void 0===t&&(t=[]),void 0===n&&(n={}),this._mainRule=e,this._rulesWithParentScopes=t,this._children=n}return e._sortBySpecificity=function(e){return 1===e.length||e.sort(this._cmpBySpecificity),e},e._cmpBySpecificity=function(e,t){if(e.scopeDepth===t.scopeDepth){var n=e.parentScopes,r=t.parentScopes,i=null===n?0:n.length,o=null===r?0:r.length;if(i===o)for(var s=0;s{Object.defineProperty(t,"__esModule",{value:!0})},878:(e,t)=>{function n(e){return Array.isArray(e)?function(e){for(var t=[],r=0,i=e.length;r{"use strict";var e={350:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UseOnigurumaFindOptions=t.DebugFlags=void 0,t.DebugFlags={InDebugMode:"undefined"!=typeof process&&!!process.env.VSCODE_TEXTMATE_DEBUG},t.UseOnigurumaFindOptions=!1},527:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LocalStackElement=t.StackElement=t.ScopeListElement=t.StackElementMetadata=t.Grammar=t.ScopeMetadata=t.collectDependencies=t.collectSpecificDependencies=t.ScopeDependencyCollector=t.PartialScopeDependency=t.FullScopeDependency=t.createGrammar=void 0;var r=n(878),i=n(792),o=n(736),s=n(350),a="undefined"==typeof performance?function(){return Date.now()}:function(){return performance.now()};t.createGrammar=function(e,t,n,r,i,o){return new v(e,t,n,r,i,o)};var c=function(e){this.scopeName=e};t.FullScopeDependency=c;var u=function(){function e(e,t){this.scopeName=e,this.include=t}return e.prototype.toKey=function(){return this.scopeName+"#"+this.include},e}();t.PartialScopeDependency=u;var l=function(){function e(){this.full=[],this.partial=[],this.visitedRule=new Set,this._seenFull=new Set,this._seenPartial=new Set}return e.prototype.add=function(e){e instanceof c?this._seenFull.has(e.scopeName)||(this._seenFull.add(e.scopeName),this.full.push(e)):this._seenPartial.has(e.toKey())||(this._seenPartial.add(e.toKey()),this.partial.push(e))},e}();function h(e,t,n,i,o){for(var s=0,a=i;s=0){var _=g.substring(0,m),y=g.substring(m+1);_===t.scopeName?p(e,t,t,y,f):_===n.scopeName?p(e,t,n,y,f):e.add(new u(_,g.substring(m+1)))}else e.add(new c(g))}}}}function p(e,t,n,r,i){void 0===i&&(i=n.repository),i&&i[r]&&h(e,t,n,[i[r]],i)}function d(e,t,n){if(n.patterns&&Array.isArray(n.patterns)&&h(e,t,n,n.patterns,n.repository),n.injections){var r=[];for(var i in n.injections)r.push(n.injections[i]);h(e,t,n,r,n.repository)}}function f(e,t){if(!e)return!1;if(e===t)return!0;var n=t.length;return e.length>n&&e.substr(0,n)===t&&"."===e[n]}function g(e,t){if(t.length>")}var u=Object.keys(this._embeddedLanguages).map((function(t){return e._escapeRegExpCharacters(t)}));0===u.length?this._embeddedLanguagesRegex=null:(u.sort(),u.reverse(),this._embeddedLanguagesRegex=new RegExp("^(("+u.join(")|(")+"))($|\\.)",""))}return e.prototype.onDidChangeTheme=function(){this._cache=new Map,this._defaultMetaData=new _("",this._initialLanguage,0,[this._themeProvider.getDefaults()])},e.prototype.getDefaultMetadata=function(){return this._defaultMetaData},e._escapeRegExpCharacters=function(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")},e.prototype.getMetadataForScope=function(t){if(null===t)return e._NULL_SCOPE_METADATA;var n=this._cache.get(t);return n||(n=this._doGetMetadataForScope(t),this._cache.set(t,n),n)},e.prototype._doGetMetadataForScope=function(e){var t=this._scopeToLanguage(e),n=this._toStandardTokenType(e),r=this._themeProvider.themeMatch(e);return new _(e,t,n,r)},e.prototype._scopeToLanguage=function(e){if(!e)return 0;if(!this._embeddedLanguagesRegex)return 0;var t=e.match(this._embeddedLanguagesRegex);return t&&(this._embeddedLanguages[t[1]]||0)||0},e.prototype._toStandardTokenType=function(t){var n=t.match(e.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 0;switch(n[1]){case"comment":return 1;case"string":return 2;case"regex":return 4;case"meta.embedded":return 8}throw new Error("Unexpected match for standard token type!")},e._NULL_SCOPE_METADATA=new _("",0,0,null),e.STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/,e}(),v=function(){function e(e,t,n,r,i,s){if(this._scopeMetadataProvider=new y(t,i,n),this._onigLib=s,this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=i,this._grammar=C(e,null),this._injections=null,this._tokenTypeMatchers=[],r)for(var a=0,c=Object.keys(r);al)break;for(;u.length>0&&u[u.length-1].endPos<=d.start;)i.produceFromScopes(u[u.length-1].scopes,u[u.length-1].endPos),u.pop();if(u.length>0?i.produceFromScopes(u[u.length-1].scopes,d.start):i.produce(r,d.start),p.retokenizeCapturedWithRuleId){var f=p.getName(a,s),g=r.contentNameScopesList.push(e,f),m=p.getContentName(a,s),_=g.push(e,m),y=r.push(p.retokenizeCapturedWithRuleId,d.start,-1,!1,null,g,_),v=e.createOnigString(a.substring(0,d.end));A(e,v,n&&0===d.start,d.start,y,i,!1),b(v)}else{var C=p.getName(a,s);if(null!==C){var R=(u.length>0?u[u.length-1].scopes:r.contentNameScopesList).push(e,C);u.push(new G(R,d.end))}}}}}for(;u.length>0;)i.produceFromScopes(u[u.length-1].scopes,u[u.length-1].endPos),u.pop()}}function S(e){for(var t=[],n=0,r=e.rules.length;nr&&(r=m.captureIndices[0].end,n=!1))}return{stack:o,linePos:r,anchorPosition:c,isFirstLine:n}}(e,t,n,r,o,c);o=d.stack,r=d.linePos,n=d.isFirstLine,p=d.anchorPosition}for(;!h;)f();function f(){s.DebugFlags.InDebugMode&&(console.log(""),console.log("@@scanNext "+r+": |"+t.content.substr(r).replace(/\n$/,"\\n")+"|"));var u=function(e,t,n,r,i,o){var c=function(e,t,n,r,i,o){var c=i.getRule(e),u=k(c,e,i.endRule,n,r===o),l=u.ruleScanner,h=u.findOptions,p=0;s.DebugFlags.InDebugMode&&(p=a());var d=l.scanner.findNextMatchSync(t,r,h);if(s.DebugFlags.InDebugMode){var f=a()-p;f>5&&console.warn("Rule "+c.debugName+" ("+c.id+") matching took "+f+" against '"+t+"'"),d&&console.log("matched rule id: "+l.rules[d.index]+" from "+d.captureIndices[0].start+" to "+d.captureIndices[0].end)}return d?{captureIndices:d.captureIndices,matchedRuleId:l.rules[d.index]}:null}(e,t,n,r,i,o),u=e.getInjections();if(0===u.length)return c;var l=function(e,t,n,r,i,o,a){for(var c,u=Number.MAX_VALUE,l=null,h=0,p=o.contentNameScopesList.generateScopes(),d=0,f=e.length;d=u)&&(u=b,l=v.captureIndices,c=_.rules[v.index],h=g.priority,u===i))break}}}return l?{priorityMatch:-1===h,captureIndices:l,matchedRuleId:c}:null}(u,e,t,n,r,i,o);if(!l)return c;if(!c)return l;var h=c.captureIndices[0].start,p=l.captureIndices[0].start;return p0)&&d[0].end>r;if(-1===f){var m=o.getRule(e);s.DebugFlags.InDebugMode&&console.log(" popping "+m.debugName+" - "+m.debugEndRegExp),c.produce(o,d[0].start),o=o.setContentNameScopesList(o.nameScopesList),R(e,t,n,o,c,m.endCaptures,d),c.produce(o,d[0].end);var _=o;if(o=o.pop(),p=_.getAnchorPos(),!g&&_.getEnterPos()===r)return s.DebugFlags.InDebugMode&&console.error("[1] - Grammar is in an endless loop - Grammar pushed & popped a rule without advancing"),o=_,c.produce(o,l),void(h=!0)}else{var y=e.getRule(f);c.produce(o,d[0].start);var v=o,b=y.getName(t.content,d),C=o.contentNameScopesList.push(e,b);if(o=o.push(f,r,p,d[0].end===l,null,C,C),y instanceof i.BeginEndRule){var P=y;s.DebugFlags.InDebugMode&&console.log(" pushing "+P.debugName+" - "+P.debugBeginRegExp),R(e,t,n,o,c,P.beginCaptures,d),c.produce(o,d[0].end),p=d[0].end;var w=P.getContentName(t.content,d),A=C.push(e,w);if(o=o.setContentNameScopesList(A),P.endHasBackReferences&&(o=o.setEndRule(P.getEndWithResolvedBackReferences(t.content,d))),!g&&v.hasSameRuleAs(o))return s.DebugFlags.InDebugMode&&console.error("[2] - Grammar is in an endless loop - Grammar pushed the same rule without advancing"),o=o.pop(),c.produce(o,l),void(h=!0)}else if(y instanceof i.BeginWhileRule){if(P=y,s.DebugFlags.InDebugMode&&console.log(" pushing "+P.debugName),R(e,t,n,o,c,P.beginCaptures,d),c.produce(o,d[0].end),p=d[0].end,w=P.getContentName(t.content,d),A=C.push(e,w),o=o.setContentNameScopesList(A),P.whileHasBackReferences&&(o=o.setEndRule(P.getWhileWithResolvedBackReferences(t.content,d))),!g&&v.hasSameRuleAs(o))return s.DebugFlags.InDebugMode&&console.error("[3] - Grammar is in an endless loop - Grammar pushed the same rule without advancing"),o=o.pop(),c.produce(o,l),void(h=!0)}else{var I=y;if(s.DebugFlags.InDebugMode&&console.log(" matched "+I.debugName+" - "+I.debugMatchRegExp),R(e,t,n,o,c,I.captures,d),c.produce(o,d[0].end),o=o.pop(),!g)return s.DebugFlags.InDebugMode&&console.error("[4] - Grammar is in an endless loop - Grammar is not advancing, nor is it pushing/popping"),o=o.safePop(),c.produce(o,l),void(h=!0)}}d[0].end>r&&(r=d[0].end,n=!1)}return o}t.Grammar=v;var I=function(){function e(){}return e.toBinaryStr=function(e){for(var t=e.toString(2);t.length<32;)t="0"+t;return t},e.printMetadata=function(t){var n=e.getLanguageId(t),r=e.getTokenType(t),i=e.getFontStyle(t),o=e.getForeground(t),s=e.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:i,foreground:o,background:s})},e.getLanguageId=function(e){return(255&e)>>>0},e.getTokenType=function(e){return(1792&e)>>>8},e.getFontStyle=function(e){return(14336&e)>>>11},e.getForeground=function(e){return(8372224&e)>>>14},e.getBackground=function(e){return(4286578688&e)>>>23},e.set=function(t,n,r,i,o,s){var a=e.getLanguageId(t),c=e.getTokenType(t),u=e.getFontStyle(t),l=e.getForeground(t),h=e.getBackground(t);return 0!==n&&(a=n),0!==r&&(c=8===r?0:r),-1!==i&&(u=i),0!==o&&(l=o),0!==s&&(h=s),(a<<0|c<<8|u<<11|l<<14|h<<23)>>>0},e}();t.StackElementMetadata=I;var x=function(){function e(e,t,n){this.parent=e,this.scope=t,this.metadata=n}return e._equals=function(e,t){for(;;){if(e===t)return!0;if(!e&&!t)return!0;if(!e||!t)return!1;if(e.scope!==t.scope||e.metadata!==t.metadata)return!1;e=e.parent,t=t.parent}},e.prototype.equals=function(t){return e._equals(this,t)},e._matchesScope=function(e,t,n){return t===e||e.substring(0,n.length)===n},e._matches=function(e,t){if(null===t)return!0;for(var n=t.length,r=0,i=t[r],o=i+".";e;){if(this._matchesScope(e.scope,i,o)){if(++r===n)return!0;o=(i=t[r])+"."}e=e.parent}return!1},e.mergeMetadata=function(e,t,n){if(null===n)return e;var r=-1,i=0,o=0;if(null!==n.themeData)for(var s=0,a=n.themeData.length;s=0?e._push(this,t,n.split(/ /g)):e._push(this,t,[n])},e._generateScopes=function(e){for(var t=[],n=0;e;)t[n++]=e.scope,e=e.parent;return t.reverse(),t},e.prototype.generateScopes=function(){return e._generateScopes(this)},e}();t.ScopeListElement=x;var T=function(){function e(e,t,n,r,i,o,s,a){this.parent=e,this.depth=this.parent?this.parent.depth+1:1,this.ruleId=t,this._enterPos=n,this._anchorPos=r,this.beginRuleCapturedEOL=i,this.endRule=o,this.nameScopesList=s,this.contentNameScopesList=a}return e._structuralEquals=function(e,t){for(;;){if(e===t)return!0;if(!e&&!t)return!0;if(!e||!t)return!1;if(e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}},e._equals=function(e,t){return e===t||!!this._structuralEquals(e,t)&&e.contentNameScopesList.equals(t.contentNameScopesList)},e.prototype.clone=function(){return this},e.prototype.equals=function(t){return null!==t&&e._equals(this,t)},e._reset=function(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent},e.prototype.reset=function(){e._reset(this)},e.prototype.pop=function(){return this.parent},e.prototype.safePop=function(){return this.parent?this.parent:this},e.prototype.push=function(t,n,r,i,o,s,a){return new e(this,t,n,r,i,o,s,a)},e.prototype.getEnterPos=function(){return this._enterPos},e.prototype.getAnchorPos=function(){return this._anchorPos},e.prototype.getRule=function(e){return e.getRule(this.ruleId)},e.prototype._writeString=function(e,t){return this.parent&&(t=this.parent._writeString(e,t)),e[t++]="("+this.ruleId+", TODO-"+this.nameScopesList+", TODO-"+this.contentNameScopesList+")",t},e.prototype.toString=function(){var e=[];return this._writeString(e,0),"["+e.join(",")+"]"},e.prototype.setContentNameScopesList=function(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)},e.prototype.setEndRule=function(t){return this.endRule===t?this:new e(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)},e.prototype.hasSameRuleAs=function(e){for(var t=this;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.parent}return!1},e.NULL=new e(null,0,0,0,!1,null,null,null),e}();t.StackElement=T;var G=function(e,t){this.scopes=e,this.endPos=t};t.LocalStackElement=G;var L=function(){function e(e,t,n){this._emitBinaryTokens=e,this._tokenTypeOverrides=n,s.DebugFlags.InDebugMode?this._lineText=t:this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}return e.prototype.produce=function(e,t){this.produceFromScopes(e.contentNameScopesList,t)},e.prototype.produceFromScopes=function(e,t){if(!(this._lastTokenEndIndex>=t)){if(this._emitBinaryTokens){for(var n=e.metadata,r=0,i=this._tokenTypeOverrides;r0&&this._binaryTokens[this._binaryTokens.length-1]===n||(this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(n)),void(this._lastTokenEndIndex=t)}var a=e.generateScopes();if(s.DebugFlags.InDebugMode){console.log(" token: |"+this._lineText.substring(this._lastTokenEndIndex,t).replace(/\n$/,"\\n")+"|");for(var c=0;c0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),0===this._tokens.length&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens},e.prototype.getBinaryResult=function(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),0===this._binaryTokens.length&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);for(var n=new Uint32Array(this._binaryTokens.length),r=0,i=this._binaryTokens.length;r{Object.defineProperty(t,"__esModule",{value:!0}),t.parseRawGrammar=void 0;var r=n(69),i=n(350),o=n(974);t.parseRawGrammar=function(e,t){return void 0===t&&(t=null),null!==t&&/\.json$/.test(t)?(n=e,s=t,i.DebugFlags.InDebugMode?o.parse(n,s,!0):JSON.parse(n)):function(e,t){return i.DebugFlags.InDebugMode?r.parseWithLocation(e,t,"$vscodeTextmateLocation"):r.parse(e)}(e,t);var n,s}},974:(e,t)=>{function n(e,t){throw new Error("Near offset "+e.pos+": "+t+" ~~~"+e.source.substr(e.pos,50)+"~~~")}Object.defineProperty(t,"__esModule",{value:!0}),t.parse=void 0,t.parse=function(e,t,s){var a=new r(e),c=new i,u=0,l=null,h=[],p=[];function d(){h.push(u),p.push(l)}function f(){u=h.pop(),l=p.pop()}function g(e){n(a,e)}for(;o(a,c);){if(0===u){if(null!==l&&g("too many constructs in root"),3===c.type){l={},s&&(l.$vscodeTextmateLocation=c.toLocation(t)),d(),u=1;continue}if(2===c.type){l=[],d(),u=4;continue}g("unexpected token in root")}if(2===u){if(5===c.type){f();continue}if(7===c.type){u=3;continue}g("expected , or }")}if(1===u||3===u){if(1===u&&5===c.type){f();continue}if(1===c.type){var m=c.value;if(o(a,c)&&6===c.type||g("expected colon"),o(a,c)||g("expected value"),u=2,1===c.type){l[m]=c.value;continue}if(8===c.type){l[m]=null;continue}if(9===c.type){l[m]=!0;continue}if(10===c.type){l[m]=!1;continue}if(11===c.type){l[m]=parseFloat(c.value);continue}if(2===c.type){var _=[];l[m]=_,d(),u=4,l=_;continue}if(3===c.type){var y={};s&&(y.$vscodeTextmateLocation=c.toLocation(t)),l[m]=y,d(),u=1,l=y;continue}}g("unexpected token in dict")}if(5===u){if(4===c.type){f();continue}if(7===c.type){u=6;continue}g("expected , or ]")}if(4===u||6===u){if(4===u&&4===c.type){f();continue}if(u=5,1===c.type){l.push(c.value);continue}if(8===c.type){l.push(null);continue}if(9===c.type){l.push(!0);continue}if(10===c.type){l.push(!1);continue}if(11===c.type){l.push(parseFloat(c.value));continue}if(2===c.type){_=[],l.push(_),d(),u=4,l=_;continue}if(3===c.type){y={},s&&(y.$vscodeTextmateLocation=c.toLocation(t)),l.push(y),d(),u=1,l=y;continue}g("unexpected token in array")}g("unknown state")}return 0!==p.length&&g("unclosed constructs"),l};var r=function(e){this.source=e,this.pos=0,this.len=e.length,this.line=1,this.char=0},i=function(){function e(){this.value=null,this.type=0,this.offset=-1,this.len=-1,this.line=-1,this.char=-1}return e.prototype.toLocation=function(e){return{filename:e,line:this.line,char:this.char}},e}();function o(e,t){t.value=null,t.type=0,t.offset=-1,t.len=-1,t.line=-1,t.char=-1;for(var r,i=e.source,o=e.pos,s=e.len,a=e.line,c=e.char;;){if(o>=s)return!1;if(32!==(r=i.charCodeAt(o))&&9!==r&&13!==r){if(10!==r)break;o++,a++,c=0}else o++,c++}if(t.offset=o,t.line=a,t.char=c,34===r){for(t.type=1,o++,c++;;){if(o>=s)return!1;if(r=i.charCodeAt(o),o++,c++,92!==r){if(34===r)break}else o++,c++}t.value=i.substring(t.offset+1,o-1).replace(/\\u([0-9A-Fa-f]{4})/g,(function(e,t){return String.fromCodePoint(parseInt(t,16))})).replace(/\\(.)/g,(function(t,r){switch(r){case'"':return'"';case"\\":return"\\";case"/":return"/";case"b":return"\b";case"f":return"\f";case"n":return"\n";case"r":return"\r";case"t":return"\t";default:n(e,"invalid escape sequence")}throw new Error("unreachable")}))}else if(91===r)t.type=2,o++,c++;else if(123===r)t.type=3,o++,c++;else if(93===r)t.type=4,o++,c++;else if(125===r)t.type=5,o++,c++;else if(58===r)t.type=6,o++,c++;else if(44===r)t.type=7,o++,c++;else if(110===r){if(t.type=8,o++,c++,117!==(r=i.charCodeAt(o)))return!1;if(o++,c++,108!==(r=i.charCodeAt(o)))return!1;if(o++,c++,108!==(r=i.charCodeAt(o)))return!1;o++,c++}else if(116===r){if(t.type=9,o++,c++,114!==(r=i.charCodeAt(o)))return!1;if(o++,c++,117!==(r=i.charCodeAt(o)))return!1;if(o++,c++,101!==(r=i.charCodeAt(o)))return!1;o++,c++}else if(102===r){if(t.type=10,o++,c++,97!==(r=i.charCodeAt(o)))return!1;if(o++,c++,108!==(r=i.charCodeAt(o)))return!1;if(o++,c++,115!==(r=i.charCodeAt(o)))return!1;if(o++,c++,101!==(r=i.charCodeAt(o)))return!1;o++,c++}else for(t.type=11;;){if(o>=s)return!1;if(!(46===(r=i.charCodeAt(o))||r>=48&&r<=57||101===r||69===r||45===r||43===r))break;o++,c++}return t.len=o-t.offset,null===t.value&&(t.value=i.substr(t.offset,t.len)),e.pos=o,e.line=a,e.char=c,!0}},787:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)},o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]")},e.prototype._loadGrammar=function(e,t,n,r){return o(this,void 0,void 0,(function(){var i,o,a,c,u,h,p,d,f,g,m,_,y=this;return s(this,(function(s){switch(s.label){case 0:i=new Set,o=new Set,i.add(e),a=[new l.FullScopeDependency(e)],s.label=1;case 1:return a.length>0?(c=a,a=[],[4,Promise.all(c.map((function(e){return y._loadSingleGrammar(e.scopeName)})))]):[3,3];case 2:for(s.sent(),u=new l.ScopeDependencyCollector,h=0,p=c;h{function n(e){return!!e&&!!e.match(/[\w\.:]+/)}Object.defineProperty(t,"__esModule",{value:!0}),t.createMatchers=void 0,t.createMatchers=function(e,t){for(var r,i,o,s=[],a=(o=(i=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g).exec(r=e),{next:function(){if(!o)return null;var e=o[0];return o=i.exec(r),e}}),c=a.next();null!==c;){var u=0;if(2===c.length&&":"===c.charAt(1)){switch(c.charAt(0)){case"R":u=1;break;case"L":u=-1;break;default:console.log("Unknown priority "+c+" in scope selector")}c=a.next()}var l=p();if(s.push({matcher:l,priority:u}),","!==c)break;c=a.next()}return s;function h(){if("-"===c){c=a.next();var e=h();return function(t){return!!e&&!e(t)}}if("("===c){c=a.next();var r=function(){for(var e=[],t=p();t&&(e.push(t),"|"===c||","===c);){do{c=a.next()}while("|"===c||","===c);t=p()}return function(t){return e.some((function(e){return e(t)}))}}();return")"===c&&(c=a.next()),r}if(n(c)){var i=[];do{i.push(c),c=a.next()}while(n(c));return function(e){return t(i,e)}}return null}function p(){for(var e=[],t=h();t;)e.push(t),t=h();return function(t){return e.every((function(e){return e(t)}))}}}},69:(e,t)=>{function n(e,t,n){var r=e.length,i=0,o=1,s=0;function a(t){if(null===n)i+=t;else for(;t>0;)10===e.charCodeAt(i)?(i++,o++,s=0):(i++,s++),t--}function c(e){null===n?i=e:a(e-i)}function u(){for(;i0&&65279===e.charCodeAt(0)&&(i=1);var d=0,f=null,g=[],m=[],_=null;function y(e,t){g.push(d),m.push(f),d=e,f=t}function v(){if(0===g.length)return b("illegal state stack");d=g.pop(),f=m.pop()}function b(t){throw new Error("Near offset "+i+": "+t+" ~~~"+e.substr(i,50)+"~~~")}var C,R,S,P,k,w=function(){if(null===_)return b("missing ");var e={};null!==n&&(e[n]={filename:t,line:o,char:s}),f[_]=e,_=null,y(1,e)},A=function(){if(null===_)return b("missing ");var e=[];f[_]=e,_=null,y(2,e)};function I(){if(1!==d)return b("unexpected ");v()}function x(){return 1===d||2!==d?b("unexpected "):void v()}function T(e){if(1===d){if(null===_)return b("missing ");f[_]=e,_=null}else 2===d?f.push(e):f=e}function G(e){if(isNaN(e))return b("cannot parse float");if(1===d){if(null===_)return b("missing ");f[_]=e,_=null}else 2===d?f.push(e):f=e}function L(e){if(isNaN(e))return b("cannot parse integer");if(1===d){if(null===_)return b("missing ");f[_]=e,_=null}else 2===d?f.push(e):f=e}function M(e){if(1===d){if(null===_)return b("missing ");f[_]=e,_=null}else 2===d?f.push(e):f=e}function D(e){if(1===d){if(null===_)return b("missing ");f[_]=e,_=null}else 2===d?f.push(e):f=e}function E(e){if(1===d){if(null===_)return b("missing ");f[_]=e,_=null}else 2===d?f.push(e):f=e}function N(e){if(e.isClosed)return"";var t=p(""),t.replace(/&#([0-9]+);/g,(function(e,t){return String.fromCodePoint(parseInt(t,10))})).replace(/&#x([0-9a-f]+);/g,(function(e,t){return String.fromCodePoint(parseInt(t,16))})).replace(/&|<|>|"|'/g,(function(e){switch(e){case"&":return"&";case"<":return"<";case">":return">";case""":return'"';case"'":return"'"}return e}))}for(;i=r));){var O=e.charCodeAt(i);if(a(1),60!==O)return b("expected <");if(i>=r)return b("unexpected end of input");var F=e.charCodeAt(i);if(63!==F)if(33!==F){if(47===F){if(a(1),u(),l("plist")){h(">");continue}if(l("dict")){h(">"),I();continue}if(l("array")){h(">"),x();continue}return b("unexpected closed tag")}var j=(R=void 0,S=void 0,S=!1,47===(R=p(">")).charCodeAt(R.length-1)&&(S=!0,R=R.substring(0,R.length-1)),{name:R.trim(),isClosed:S});switch(j.name){case"dict":1===d?w():2===d?(k=void 0,k={},null!==n&&(k[n]={filename:t,line:o,char:s}),f.push(k),y(1,k)):(f={},null!==n&&(f[n]={filename:t,line:o,char:s}),y(1,f)),j.isClosed&&I();continue;case"array":1===d?A():2===d?(P=void 0,P=[],f.push(P),y(2,P)):y(2,f=[]),j.isClosed&&x();continue;case"key":C=N(j),1!==d?b("unexpected "):null!==_?b("too many "):_=C;continue;case"string":T(N(j));continue;case"real":G(parseFloat(N(j)));continue;case"integer":L(parseInt(N(j),10));continue;case"date":M(new Date(N(j)));continue;case"data":D(N(j));continue;case"true":N(j),E(!0);continue;case"false":N(j),E(!1);continue}if(!/^plist/.test(j.name))return b("unexpected opened tag "+j.name)}else{if(a(1),l("--")){h("--\x3e");continue}h(">")}else a(1),h("?>")}return f}Object.defineProperty(t,"__esModule",{value:!0}),t.parse=t.parseWithLocation=void 0,t.parseWithLocation=function(e,t,r){return n(e,t,r)},t.parse=function(e){return n(e,null,null)}},652:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]o&&(o=c);for(var a=0;a<=o;a++)i[a]=null;for(var s in t)if("$vscodeTextmateLocation"!==s){var c=parseInt(s,10),u=0;t[s].patterns&&(u=e.getCompiledRuleId(t[s],n,r)),i[c]=e.createCaptureRule(n,t[s].$vscodeTextmateLocation,t[s].name,t[s].contentName,u)}}return i},e._compilePatterns=function(t,n,r){var i=[];if(t)for(var o=0,s=t.length;o=0?(l=a.include.substring(0,p),h=a.include.substring(p+1)):l=a.include;var d=n.getExternalGrammar(l,r);if(d)if(h){var _=d.repository[h];_&&(c=e.getCompiledRuleId(_,n,d.repository))}else c=e.getCompiledRuleId(d.repository.$self,n,d.repository)}else c=e.getCompiledRuleId(a,n,r);if(-1!==c){var y=n.getRule(c),v=!1;if((y instanceof f||y instanceof g||y instanceof m)&&y.hasMissingPatterns&&0===y.patterns.length&&(v=!0),v)continue;i.push(c)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}},e}();t.RuleFactory=_},583:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ThemeTrieElement=t.ThemeTrieElementRule=t.strArrCmp=t.strcmp=t.Theme=t.ColorMap=t.parseTheme=t.ParsedThemeRule=void 0;var n=function(e,t,n,r,i,o){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=i,this.background=o};function r(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function i(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];for(var t=e.settings,i=[],o=0,s=0,a=t.length;s1&&(_=g.slice(0,g.length-1)).reverse(),i[o++]=new n(m,_,s,l,d,f)}}}return i}function o(e,t){e.sort((function(e,t){var n=c(e.scope,t.scope);return 0!==n||0!==(n=u(e.parentScopes,t.parentScopes))?n:e.index-t.index}));for(var n=0,r="#000000",i="#ffffff";e.length>=1&&""===e[0].scope;){var o=e.shift();-1!==o.fontStyle&&(n=o.fontStyle),null!==o.foreground&&(r=o.foreground),null!==o.background&&(i=o.background)}for(var p=new s(t),d=new l(0,null,n,p.getId(r),p.getId(i)),f=new h(new l(0,null,-1,0,0),[]),g=0,m=e.length;gt?1:0}function u(e,t){if(null===e&&null===t)return 0;if(!e)return-1;if(!t)return 1;var n=e.length,r=t.length;if(n===r){for(var i=0;ie?console.log("how did this happen?"):this.scopeDepth=e,-1!==t&&(this.fontStyle=t),0!==n&&(this.foreground=n),0!==r&&(this.background=r)},e}();t.ThemeTrieElementRule=l;var h=function(){function e(e,t,n){void 0===t&&(t=[]),void 0===n&&(n={}),this._mainRule=e,this._rulesWithParentScopes=t,this._children=n}return e._sortBySpecificity=function(e){return 1===e.length||e.sort(this._cmpBySpecificity),e},e._cmpBySpecificity=function(e,t){if(e.scopeDepth===t.scopeDepth){var n=e.parentScopes,r=t.parentScopes,i=null===n?0:n.length,o=null===r?0:r.length;if(i===o)for(var s=0;s{Object.defineProperty(t,"__esModule",{value:!0})},878:(e,t)=>{function n(e){return Array.isArray(e)?function(e){for(var t=[],r=0,i=e.length;r= 0) {\n var scopeName = include.substring(0, sharpIndex);\n var includedName = include.substring(sharpIndex + 1);\n if (scopeName === baseGrammar.scopeName) {\n collectSpecificDependencies(result, baseGrammar, baseGrammar, includedName, patternRepository);\n }\n else if (scopeName === selfGrammar.scopeName) {\n collectSpecificDependencies(result, baseGrammar, selfGrammar, includedName, patternRepository);\n }\n else {\n result.add(new PartialScopeDependency(scopeName, include.substring(sharpIndex + 1)));\n }\n }\n else {\n result.add(new FullScopeDependency(include));\n }\n }\n }\n}\n/**\n * Collect a specific dependency from the grammar's repository\n */\nfunction collectSpecificDependencies(result, baseGrammar, selfGrammar, include, repository) {\n if (repository === void 0) { repository = selfGrammar.repository; }\n if (repository && repository[include]) {\n var rule = repository[include];\n _extractIncludedScopesInPatterns(result, baseGrammar, selfGrammar, [rule], repository);\n }\n}\nexports.collectSpecificDependencies = collectSpecificDependencies;\n/**\n * Collects the list of all external included scopes in `grammar`.\n */\nfunction collectDependencies(result, baseGrammar, selfGrammar) {\n if (selfGrammar.patterns && Array.isArray(selfGrammar.patterns)) {\n _extractIncludedScopesInPatterns(result, baseGrammar, selfGrammar, selfGrammar.patterns, selfGrammar.repository);\n }\n if (selfGrammar.injections) {\n var injections = [];\n for (var injection in selfGrammar.injections) {\n injections.push(selfGrammar.injections[injection]);\n }\n _extractIncludedScopesInPatterns(result, baseGrammar, selfGrammar, injections, selfGrammar.repository);\n }\n}\nexports.collectDependencies = collectDependencies;\nfunction scopesAreMatching(thisScopeName, scopeName) {\n if (!thisScopeName) {\n return false;\n }\n if (thisScopeName === scopeName) {\n return true;\n }\n var len = scopeName.length;\n return thisScopeName.length > len && thisScopeName.substr(0, len) === scopeName && thisScopeName[len] === '.';\n}\nfunction nameMatcher(identifers, scopes) {\n if (scopes.length < identifers.length) {\n return false;\n }\n var lastIndex = 0;\n return identifers.every(function (identifier) {\n for (var i = lastIndex; i < scopes.length; i++) {\n if (scopesAreMatching(scopes[i], identifier)) {\n lastIndex = i + 1;\n return true;\n }\n }\n return false;\n });\n}\nfunction collectInjections(result, selector, rule, ruleFactoryHelper, grammar) {\n var matchers = matcher_1.createMatchers(selector, nameMatcher);\n var ruleId = rule_1.RuleFactory.getCompiledRuleId(rule, ruleFactoryHelper, grammar.repository);\n for (var _i = 0, matchers_1 = matchers; _i < matchers_1.length; _i++) {\n var matcher = matchers_1[_i];\n result.push({\n matcher: matcher.matcher,\n ruleId: ruleId,\n grammar: grammar,\n priority: matcher.priority\n });\n }\n}\nvar ScopeMetadata = /** @class */ (function () {\n function ScopeMetadata(scopeName, languageId, tokenType, themeData) {\n this.scopeName = scopeName;\n this.languageId = languageId;\n this.tokenType = tokenType;\n this.themeData = themeData;\n }\n return ScopeMetadata;\n}());\nexports.ScopeMetadata = ScopeMetadata;\nvar ScopeMetadataProvider = /** @class */ (function () {\n function ScopeMetadataProvider(initialLanguage, themeProvider, embeddedLanguages) {\n this._initialLanguage = initialLanguage;\n this._themeProvider = themeProvider;\n this._cache = new Map();\n this._defaultMetaData = new ScopeMetadata('', this._initialLanguage, 0 /* Other */, [this._themeProvider.getDefaults()]);\n // embeddedLanguages handling\n this._embeddedLanguages = Object.create(null);\n if (embeddedLanguages) {\n // If embeddedLanguages are configured, fill in `this._embeddedLanguages`\n var scopes = Object.keys(embeddedLanguages);\n for (var i = 0, len = scopes.length; i < len; i++) {\n var scope = scopes[i];\n var language = embeddedLanguages[scope];\n if (typeof language !== 'number' || language === 0) {\n console.warn('Invalid embedded language found at scope ' + scope + ': <<' + language + '>>');\n // never hurts to be too careful\n continue;\n }\n this._embeddedLanguages[scope] = language;\n }\n }\n // create the regex\n var escapedScopes = Object.keys(this._embeddedLanguages).map(function (scopeName) { return ScopeMetadataProvider._escapeRegExpCharacters(scopeName); });\n if (escapedScopes.length === 0) {\n // no scopes registered\n this._embeddedLanguagesRegex = null;\n }\n else {\n escapedScopes.sort();\n escapedScopes.reverse();\n this._embeddedLanguagesRegex = new RegExp(\"^((\" + escapedScopes.join(')|(') + \"))($|\\\\.)\", '');\n }\n }\n ScopeMetadataProvider.prototype.onDidChangeTheme = function () {\n this._cache = new Map();\n this._defaultMetaData = new ScopeMetadata('', this._initialLanguage, 0 /* Other */, [this._themeProvider.getDefaults()]);\n };\n ScopeMetadataProvider.prototype.getDefaultMetadata = function () {\n return this._defaultMetaData;\n };\n /**\n * Escapes regular expression characters in a given string\n */\n ScopeMetadataProvider._escapeRegExpCharacters = function (value) {\n return value.replace(/[\\-\\\\\\{\\}\\*\\+\\?\\|\\^\\$\\.\\,\\[\\]\\(\\)\\#\\s]/g, '\\\\$&');\n };\n ScopeMetadataProvider.prototype.getMetadataForScope = function (scopeName) {\n if (scopeName === null) {\n return ScopeMetadataProvider._NULL_SCOPE_METADATA;\n }\n var value = this._cache.get(scopeName);\n if (value) {\n return value;\n }\n value = this._doGetMetadataForScope(scopeName);\n this._cache.set(scopeName, value);\n return value;\n };\n ScopeMetadataProvider.prototype._doGetMetadataForScope = function (scopeName) {\n var languageId = this._scopeToLanguage(scopeName);\n var standardTokenType = this._toStandardTokenType(scopeName);\n var themeData = this._themeProvider.themeMatch(scopeName);\n return new ScopeMetadata(scopeName, languageId, standardTokenType, themeData);\n };\n /**\n * Given a produced TM scope, return the language that token describes or null if unknown.\n * e.g. source.html => html, source.css.embedded.html => css, punctuation.definition.tag.html => null\n */\n ScopeMetadataProvider.prototype._scopeToLanguage = function (scope) {\n if (!scope) {\n return 0;\n }\n if (!this._embeddedLanguagesRegex) {\n // no scopes registered\n return 0;\n }\n var m = scope.match(this._embeddedLanguagesRegex);\n if (!m) {\n // no scopes matched\n return 0;\n }\n var language = this._embeddedLanguages[m[1]] || 0;\n if (!language) {\n return 0;\n }\n return language;\n };\n ScopeMetadataProvider.prototype._toStandardTokenType = function (tokenType) {\n var m = tokenType.match(ScopeMetadataProvider.STANDARD_TOKEN_TYPE_REGEXP);\n if (!m) {\n return 0 /* Other */;\n }\n switch (m[1]) {\n case 'comment':\n return 1 /* Comment */;\n case 'string':\n return 2 /* String */;\n case 'regex':\n return 4 /* RegEx */;\n case 'meta.embedded':\n return 8 /* MetaEmbedded */;\n }\n throw new Error('Unexpected match for standard token type!');\n };\n ScopeMetadataProvider._NULL_SCOPE_METADATA = new ScopeMetadata('', 0, 0, null);\n ScopeMetadataProvider.STANDARD_TOKEN_TYPE_REGEXP = /\\b(comment|string|regex|meta\\.embedded)\\b/;\n return ScopeMetadataProvider;\n}());\nvar Grammar = /** @class */ (function () {\n function Grammar(grammar, initialLanguage, embeddedLanguages, tokenTypes, grammarRepository, onigLib) {\n this._scopeMetadataProvider = new ScopeMetadataProvider(initialLanguage, grammarRepository, embeddedLanguages);\n this._onigLib = onigLib;\n this._rootId = -1;\n this._lastRuleId = 0;\n this._ruleId2desc = [null];\n this._includedGrammars = {};\n this._grammarRepository = grammarRepository;\n this._grammar = initGrammar(grammar, null);\n this._injections = null;\n this._tokenTypeMatchers = [];\n if (tokenTypes) {\n for (var _i = 0, _a = Object.keys(tokenTypes); _i < _a.length; _i++) {\n var selector = _a[_i];\n var matchers = matcher_1.createMatchers(selector, nameMatcher);\n for (var _b = 0, matchers_2 = matchers; _b < matchers_2.length; _b++) {\n var matcher = matchers_2[_b];\n this._tokenTypeMatchers.push({\n matcher: matcher.matcher,\n type: tokenTypes[selector]\n });\n }\n }\n }\n }\n Grammar.prototype.dispose = function () {\n for (var _i = 0, _a = this._ruleId2desc; _i < _a.length; _i++) {\n var rule = _a[_i];\n if (rule) {\n rule.dispose();\n }\n }\n };\n Grammar.prototype.createOnigScanner = function (sources) {\n return this._onigLib.createOnigScanner(sources);\n };\n Grammar.prototype.createOnigString = function (sources) {\n return this._onigLib.createOnigString(sources);\n };\n Grammar.prototype.onDidChangeTheme = function () {\n this._scopeMetadataProvider.onDidChangeTheme();\n };\n Grammar.prototype.getMetadataForScope = function (scope) {\n return this._scopeMetadataProvider.getMetadataForScope(scope);\n };\n Grammar.prototype.getInjections = function () {\n var _this = this;\n if (this._injections === null) {\n this._injections = [];\n // add injections from the current grammar\n var rawInjections = this._grammar.injections;\n if (rawInjections) {\n for (var expression in rawInjections) {\n collectInjections(this._injections, expression, rawInjections[expression], this, this._grammar);\n }\n }\n // add injection grammars contributed for the current scope\n if (this._grammarRepository) {\n var injectionScopeNames = this._grammarRepository.injections(this._grammar.scopeName);\n if (injectionScopeNames) {\n injectionScopeNames.forEach(function (injectionScopeName) {\n var injectionGrammar = _this.getExternalGrammar(injectionScopeName);\n if (injectionGrammar) {\n var selector = injectionGrammar.injectionSelector;\n if (selector) {\n collectInjections(_this._injections, selector, injectionGrammar, _this, injectionGrammar);\n }\n }\n });\n }\n }\n this._injections.sort(function (i1, i2) { return i1.priority - i2.priority; }); // sort by priority\n }\n return this._injections;\n };\n Grammar.prototype.registerRule = function (factory) {\n var id = (++this._lastRuleId);\n var result = factory(id);\n this._ruleId2desc[id] = result;\n return result;\n };\n Grammar.prototype.getRule = function (patternId) {\n return this._ruleId2desc[patternId];\n };\n Grammar.prototype.getExternalGrammar = function (scopeName, repository) {\n if (this._includedGrammars[scopeName]) {\n return this._includedGrammars[scopeName];\n }\n else if (this._grammarRepository) {\n var rawIncludedGrammar = this._grammarRepository.lookup(scopeName);\n if (rawIncludedGrammar) {\n // console.log('LOADED GRAMMAR ' + pattern.include);\n this._includedGrammars[scopeName] = initGrammar(rawIncludedGrammar, repository && repository.$base);\n return this._includedGrammars[scopeName];\n }\n }\n return null;\n };\n Grammar.prototype.tokenizeLine = function (lineText, prevState) {\n var r = this._tokenize(lineText, prevState, false);\n return {\n tokens: r.lineTokens.getResult(r.ruleStack, r.lineLength),\n ruleStack: r.ruleStack\n };\n };\n Grammar.prototype.tokenizeLine2 = function (lineText, prevState) {\n var r = this._tokenize(lineText, prevState, true);\n return {\n tokens: r.lineTokens.getBinaryResult(r.ruleStack, r.lineLength),\n ruleStack: r.ruleStack\n };\n };\n Grammar.prototype._tokenize = function (lineText, prevState, emitBinaryTokens) {\n if (this._rootId === -1) {\n this._rootId = rule_1.RuleFactory.getCompiledRuleId(this._grammar.repository.$self, this, this._grammar.repository);\n }\n var isFirstLine;\n if (!prevState || prevState === StackElement.NULL) {\n isFirstLine = true;\n var rawDefaultMetadata = this._scopeMetadataProvider.getDefaultMetadata();\n var defaultTheme = rawDefaultMetadata.themeData[0];\n var defaultMetadata = StackElementMetadata.set(0, rawDefaultMetadata.languageId, rawDefaultMetadata.tokenType, defaultTheme.fontStyle, defaultTheme.foreground, defaultTheme.background);\n var rootScopeName = this.getRule(this._rootId).getName(null, null);\n var rawRootMetadata = this._scopeMetadataProvider.getMetadataForScope(rootScopeName);\n var rootMetadata = ScopeListElement.mergeMetadata(defaultMetadata, null, rawRootMetadata);\n var scopeList = new ScopeListElement(null, rootScopeName === null ? 'unknown' : rootScopeName, rootMetadata);\n prevState = new StackElement(null, this._rootId, -1, -1, false, null, scopeList, scopeList);\n }\n else {\n isFirstLine = false;\n prevState.reset();\n }\n lineText = lineText + '\\n';\n var onigLineText = this.createOnigString(lineText);\n var lineLength = onigLineText.content.length;\n var lineTokens = new LineTokens(emitBinaryTokens, lineText, this._tokenTypeMatchers);\n var nextState = _tokenizeString(this, onigLineText, isFirstLine, 0, prevState, lineTokens, true);\n disposeOnigString(onigLineText);\n return {\n lineLength: lineLength,\n lineTokens: lineTokens,\n ruleStack: nextState\n };\n };\n return Grammar;\n}());\nexports.Grammar = Grammar;\nfunction disposeOnigString(str) {\n if (typeof str.dispose === 'function') {\n str.dispose();\n }\n}\nfunction initGrammar(grammar, base) {\n grammar = utils_1.clone(grammar);\n grammar.repository = grammar.repository || {};\n grammar.repository.$self = {\n $vscodeTextmateLocation: grammar.$vscodeTextmateLocation,\n patterns: grammar.patterns,\n name: grammar.scopeName\n };\n grammar.repository.$base = base || grammar.repository.$self;\n return grammar;\n}\nfunction handleCaptures(grammar, lineText, isFirstLine, stack, lineTokens, captures, captureIndices) {\n if (captures.length === 0) {\n return;\n }\n var lineTextContent = lineText.content;\n var len = Math.min(captures.length, captureIndices.length);\n var localStack = [];\n var maxEnd = captureIndices[0].end;\n for (var i = 0; i < len; i++) {\n var captureRule = captures[i];\n if (captureRule === null) {\n // Not interested\n continue;\n }\n var captureIndex = captureIndices[i];\n if (captureIndex.length === 0) {\n // Nothing really captured\n continue;\n }\n if (captureIndex.start > maxEnd) {\n // Capture going beyond consumed string\n break;\n }\n // pop captures while needed\n while (localStack.length > 0 && localStack[localStack.length - 1].endPos <= captureIndex.start) {\n // pop!\n lineTokens.produceFromScopes(localStack[localStack.length - 1].scopes, localStack[localStack.length - 1].endPos);\n localStack.pop();\n }\n if (localStack.length > 0) {\n lineTokens.produceFromScopes(localStack[localStack.length - 1].scopes, captureIndex.start);\n }\n else {\n lineTokens.produce(stack, captureIndex.start);\n }\n if (captureRule.retokenizeCapturedWithRuleId) {\n // the capture requires additional matching\n var scopeName = captureRule.getName(lineTextContent, captureIndices);\n var nameScopesList = stack.contentNameScopesList.push(grammar, scopeName);\n var contentName = captureRule.getContentName(lineTextContent, captureIndices);\n var contentNameScopesList = nameScopesList.push(grammar, contentName);\n var stackClone = stack.push(captureRule.retokenizeCapturedWithRuleId, captureIndex.start, -1, false, null, nameScopesList, contentNameScopesList);\n var onigSubStr = grammar.createOnigString(lineTextContent.substring(0, captureIndex.end));\n _tokenizeString(grammar, onigSubStr, (isFirstLine && captureIndex.start === 0), captureIndex.start, stackClone, lineTokens, false);\n disposeOnigString(onigSubStr);\n continue;\n }\n var captureRuleScopeName = captureRule.getName(lineTextContent, captureIndices);\n if (captureRuleScopeName !== null) {\n // push\n var base = localStack.length > 0 ? localStack[localStack.length - 1].scopes : stack.contentNameScopesList;\n var captureRuleScopesList = base.push(grammar, captureRuleScopeName);\n localStack.push(new LocalStackElement(captureRuleScopesList, captureIndex.end));\n }\n }\n while (localStack.length > 0) {\n // pop!\n lineTokens.produceFromScopes(localStack[localStack.length - 1].scopes, localStack[localStack.length - 1].endPos);\n localStack.pop();\n }\n}\nfunction debugCompiledRuleToString(ruleScanner) {\n var r = [];\n for (var i = 0, len = ruleScanner.rules.length; i < len; i++) {\n r.push(' - ' + ruleScanner.rules[i] + ': ' + ruleScanner.debugRegExps[i]);\n }\n return r.join('\\n');\n}\nfunction getFindOptions(allowA, allowG) {\n var options = 0 /* None */;\n if (!allowA) {\n options |= 1 /* NotBeginString */;\n }\n if (!allowG) {\n options |= 4 /* NotBeginPosition */;\n }\n return options;\n}\nfunction matchInjections(injections, grammar, lineText, isFirstLine, linePos, stack, anchorPosition) {\n // The lower the better\n var bestMatchRating = Number.MAX_VALUE;\n var bestMatchCaptureIndices = null;\n var bestMatchRuleId;\n var bestMatchResultPriority = 0;\n var scopes = stack.contentNameScopesList.generateScopes();\n for (var i = 0, len = injections.length; i < len; i++) {\n var injection = injections[i];\n if (!injection.matcher(scopes)) {\n // injection selector doesn't match stack\n continue;\n }\n var ruleScanner = grammar.getRule(injection.ruleId).compile(grammar, null);\n var findOptions = getFindOptions(isFirstLine, linePos === anchorPosition);\n var matchResult = ruleScanner.scanner.findNextMatchSync(lineText, linePos, findOptions);\n if (debug_1.DebugFlags.InDebugMode) {\n console.log(' scanning for injections');\n console.log(debugCompiledRuleToString(ruleScanner));\n }\n if (!matchResult) {\n continue;\n }\n var matchRating = matchResult.captureIndices[0].start;\n if (matchRating >= bestMatchRating) {\n // Injections are sorted by priority, so the previous injection had a better or equal priority\n continue;\n }\n bestMatchRating = matchRating;\n bestMatchCaptureIndices = matchResult.captureIndices;\n bestMatchRuleId = ruleScanner.rules[matchResult.index];\n bestMatchResultPriority = injection.priority;\n if (bestMatchRating === linePos) {\n // No more need to look at the rest of the injections.\n break;\n }\n }\n if (bestMatchCaptureIndices) {\n return {\n priorityMatch: bestMatchResultPriority === -1,\n captureIndices: bestMatchCaptureIndices,\n matchedRuleId: bestMatchRuleId\n };\n }\n return null;\n}\nfunction matchRule(grammar, lineText, isFirstLine, linePos, stack, anchorPosition) {\n var rule = stack.getRule(grammar);\n var ruleScanner = rule.compile(grammar, stack.endRule);\n var findOptions = getFindOptions(isFirstLine, linePos === anchorPosition);\n var perfStart = 0;\n if (debug_1.DebugFlags.InDebugMode) {\n perfStart = performanceNow();\n }\n var r = ruleScanner.scanner.findNextMatchSync(lineText, linePos, findOptions);\n if (debug_1.DebugFlags.InDebugMode) {\n var elapsedMillis = performanceNow() - perfStart;\n if (elapsedMillis > 5) {\n console.warn(\"Rule \" + rule.debugName + \" (\" + rule.id + \") matching took \" + elapsedMillis + \" against '\" + lineText + \"'\");\n }\n // console.log(` scanning for (linePos: ${linePos}, anchorPosition: ${anchorPosition})`);\n // console.log(debugCompiledRuleToString(ruleScanner));\n if (r) {\n console.log(\"matched rule id: \" + ruleScanner.rules[r.index] + \" from \" + r.captureIndices[0].start + \" to \" + r.captureIndices[0].end);\n }\n }\n if (r) {\n return {\n captureIndices: r.captureIndices,\n matchedRuleId: ruleScanner.rules[r.index]\n };\n }\n return null;\n}\nfunction matchRuleOrInjections(grammar, lineText, isFirstLine, linePos, stack, anchorPosition) {\n // Look for normal grammar rule\n var matchResult = matchRule(grammar, lineText, isFirstLine, linePos, stack, anchorPosition);\n // Look for injected rules\n var injections = grammar.getInjections();\n if (injections.length === 0) {\n // No injections whatsoever => early return\n return matchResult;\n }\n var injectionResult = matchInjections(injections, grammar, lineText, isFirstLine, linePos, stack, anchorPosition);\n if (!injectionResult) {\n // No injections matched => early return\n return matchResult;\n }\n if (!matchResult) {\n // Only injections matched => early return\n return injectionResult;\n }\n // Decide if `matchResult` or `injectionResult` should win\n var matchResultScore = matchResult.captureIndices[0].start;\n var injectionResultScore = injectionResult.captureIndices[0].start;\n if (injectionResultScore < matchResultScore || (injectionResult.priorityMatch && injectionResultScore === matchResultScore)) {\n // injection won!\n return injectionResult;\n }\n return matchResult;\n}\n/**\n * Walk the stack from bottom to top, and check each while condition in this order.\n * If any fails, cut off the entire stack above the failed while condition. While conditions\n * may also advance the linePosition.\n */\nfunction _checkWhileConditions(grammar, lineText, isFirstLine, linePos, stack, lineTokens) {\n var anchorPosition = (stack.beginRuleCapturedEOL ? 0 : -1);\n var whileRules = [];\n for (var node = stack; node; node = node.pop()) {\n var nodeRule = node.getRule(grammar);\n if (nodeRule instanceof rule_1.BeginWhileRule) {\n whileRules.push({\n rule: nodeRule,\n stack: node\n });\n }\n }\n for (var whileRule = whileRules.pop(); whileRule; whileRule = whileRules.pop()) {\n var ruleScanner = whileRule.rule.compileWhile(grammar, whileRule.stack.endRule);\n var findOptions = getFindOptions(isFirstLine, anchorPosition === linePos);\n var r = ruleScanner.scanner.findNextMatchSync(lineText, linePos, findOptions);\n if (debug_1.DebugFlags.InDebugMode) {\n console.log(' scanning for while rule');\n console.log(debugCompiledRuleToString(ruleScanner));\n }\n if (r) {\n var matchedRuleId = ruleScanner.rules[r.index];\n if (matchedRuleId !== -2) {\n // we shouldn't end up here\n stack = whileRule.stack.pop();\n break;\n }\n if (r.captureIndices && r.captureIndices.length) {\n lineTokens.produce(whileRule.stack, r.captureIndices[0].start);\n handleCaptures(grammar, lineText, isFirstLine, whileRule.stack, lineTokens, whileRule.rule.whileCaptures, r.captureIndices);\n lineTokens.produce(whileRule.stack, r.captureIndices[0].end);\n anchorPosition = r.captureIndices[0].end;\n if (r.captureIndices[0].end > linePos) {\n linePos = r.captureIndices[0].end;\n isFirstLine = false;\n }\n }\n }\n else {\n if (debug_1.DebugFlags.InDebugMode) {\n console.log(' popping ' + whileRule.rule.debugName + ' - ' + whileRule.rule.debugWhileRegExp);\n }\n stack = whileRule.stack.pop();\n break;\n }\n }\n return { stack: stack, linePos: linePos, anchorPosition: anchorPosition, isFirstLine: isFirstLine };\n}\nfunction _tokenizeString(grammar, lineText, isFirstLine, linePos, stack, lineTokens, checkWhileConditions) {\n var lineLength = lineText.content.length;\n var STOP = false;\n var anchorPosition = -1;\n if (checkWhileConditions) {\n var whileCheckResult = _checkWhileConditions(grammar, lineText, isFirstLine, linePos, stack, lineTokens);\n stack = whileCheckResult.stack;\n linePos = whileCheckResult.linePos;\n isFirstLine = whileCheckResult.isFirstLine;\n anchorPosition = whileCheckResult.anchorPosition;\n }\n while (!STOP) {\n scanNext(); // potentially modifies linePos && anchorPosition\n }\n function scanNext() {\n if (debug_1.DebugFlags.InDebugMode) {\n console.log('');\n console.log(\"@@scanNext \" + linePos + \": |\" + lineText.content.substr(linePos).replace(/\\n$/, '\\\\n') + \"|\");\n }\n var r = matchRuleOrInjections(grammar, lineText, isFirstLine, linePos, stack, anchorPosition);\n if (!r) {\n if (debug_1.DebugFlags.InDebugMode) {\n console.log(' no more matches.');\n }\n // No match\n lineTokens.produce(stack, lineLength);\n STOP = true;\n return;\n }\n var captureIndices = r.captureIndices;\n var matchedRuleId = r.matchedRuleId;\n var hasAdvanced = (captureIndices && captureIndices.length > 0) ? (captureIndices[0].end > linePos) : false;\n if (matchedRuleId === -1) {\n // We matched the `end` for this rule => pop it\n var poppedRule = stack.getRule(grammar);\n if (debug_1.DebugFlags.InDebugMode) {\n console.log(' popping ' + poppedRule.debugName + ' - ' + poppedRule.debugEndRegExp);\n }\n lineTokens.produce(stack, captureIndices[0].start);\n stack = stack.setContentNameScopesList(stack.nameScopesList);\n handleCaptures(grammar, lineText, isFirstLine, stack, lineTokens, poppedRule.endCaptures, captureIndices);\n lineTokens.produce(stack, captureIndices[0].end);\n // pop\n var popped = stack;\n stack = stack.pop();\n anchorPosition = popped.getAnchorPos();\n if (!hasAdvanced && popped.getEnterPos() === linePos) {\n // Grammar pushed & popped a rule without advancing\n if (debug_1.DebugFlags.InDebugMode) {\n console.error('[1] - Grammar is in an endless loop - Grammar pushed & popped a rule without advancing');\n }\n // See https://github.com/Microsoft/vscode-textmate/issues/12\n // Let's assume this was a mistake by the grammar author and the intent was to continue in this state\n stack = popped;\n lineTokens.produce(stack, lineLength);\n STOP = true;\n return;\n }\n }\n else {\n // We matched a rule!\n var _rule = grammar.getRule(matchedRuleId);\n lineTokens.produce(stack, captureIndices[0].start);\n var beforePush = stack;\n // push it on the stack rule\n var scopeName = _rule.getName(lineText.content, captureIndices);\n var nameScopesList = stack.contentNameScopesList.push(grammar, scopeName);\n stack = stack.push(matchedRuleId, linePos, anchorPosition, captureIndices[0].end === lineLength, null, nameScopesList, nameScopesList);\n if (_rule instanceof rule_1.BeginEndRule) {\n var pushedRule = _rule;\n if (debug_1.DebugFlags.InDebugMode) {\n console.log(' pushing ' + pushedRule.debugName + ' - ' + pushedRule.debugBeginRegExp);\n }\n handleCaptures(grammar, lineText, isFirstLine, stack, lineTokens, pushedRule.beginCaptures, captureIndices);\n lineTokens.produce(stack, captureIndices[0].end);\n anchorPosition = captureIndices[0].end;\n var contentName = pushedRule.getContentName(lineText.content, captureIndices);\n var contentNameScopesList = nameScopesList.push(grammar, contentName);\n stack = stack.setContentNameScopesList(contentNameScopesList);\n if (pushedRule.endHasBackReferences) {\n stack = stack.setEndRule(pushedRule.getEndWithResolvedBackReferences(lineText.content, captureIndices));\n }\n if (!hasAdvanced && beforePush.hasSameRuleAs(stack)) {\n // Grammar pushed the same rule without advancing\n if (debug_1.DebugFlags.InDebugMode) {\n console.error('[2] - Grammar is in an endless loop - Grammar pushed the same rule without advancing');\n }\n stack = stack.pop();\n lineTokens.produce(stack, lineLength);\n STOP = true;\n return;\n }\n }\n else if (_rule instanceof rule_1.BeginWhileRule) {\n var pushedRule = _rule;\n if (debug_1.DebugFlags.InDebugMode) {\n console.log(' pushing ' + pushedRule.debugName);\n }\n handleCaptures(grammar, lineText, isFirstLine, stack, lineTokens, pushedRule.beginCaptures, captureIndices);\n lineTokens.produce(stack, captureIndices[0].end);\n anchorPosition = captureIndices[0].end;\n var contentName = pushedRule.getContentName(lineText.content, captureIndices);\n var contentNameScopesList = nameScopesList.push(grammar, contentName);\n stack = stack.setContentNameScopesList(contentNameScopesList);\n if (pushedRule.whileHasBackReferences) {\n stack = stack.setEndRule(pushedRule.getWhileWithResolvedBackReferences(lineText.content, captureIndices));\n }\n if (!hasAdvanced && beforePush.hasSameRuleAs(stack)) {\n // Grammar pushed the same rule without advancing\n if (debug_1.DebugFlags.InDebugMode) {\n console.error('[3] - Grammar is in an endless loop - Grammar pushed the same rule without advancing');\n }\n stack = stack.pop();\n lineTokens.produce(stack, lineLength);\n STOP = true;\n return;\n }\n }\n else {\n var matchingRule = _rule;\n if (debug_1.DebugFlags.InDebugMode) {\n console.log(' matched ' + matchingRule.debugName + ' - ' + matchingRule.debugMatchRegExp);\n }\n handleCaptures(grammar, lineText, isFirstLine, stack, lineTokens, matchingRule.captures, captureIndices);\n lineTokens.produce(stack, captureIndices[0].end);\n // pop rule immediately since it is a MatchRule\n stack = stack.pop();\n if (!hasAdvanced) {\n // Grammar is not advancing, nor is it pushing/popping\n if (debug_1.DebugFlags.InDebugMode) {\n console.error('[4] - Grammar is in an endless loop - Grammar is not advancing, nor is it pushing/popping');\n }\n stack = stack.safePop();\n lineTokens.produce(stack, lineLength);\n STOP = true;\n return;\n }\n }\n }\n if (captureIndices[0].end > linePos) {\n // Advance stream\n linePos = captureIndices[0].end;\n isFirstLine = false;\n }\n }\n return stack;\n}\nvar StackElementMetadata = /** @class */ (function () {\n function StackElementMetadata() {\n }\n StackElementMetadata.toBinaryStr = function (metadata) {\n var r = metadata.toString(2);\n while (r.length < 32) {\n r = '0' + r;\n }\n return r;\n };\n StackElementMetadata.printMetadata = function (metadata) {\n var languageId = StackElementMetadata.getLanguageId(metadata);\n var tokenType = StackElementMetadata.getTokenType(metadata);\n var fontStyle = StackElementMetadata.getFontStyle(metadata);\n var foreground = StackElementMetadata.getForeground(metadata);\n var background = StackElementMetadata.getBackground(metadata);\n console.log({\n languageId: languageId,\n tokenType: tokenType,\n fontStyle: fontStyle,\n foreground: foreground,\n background: background,\n });\n };\n StackElementMetadata.getLanguageId = function (metadata) {\n return (metadata & 255 /* LANGUAGEID_MASK */) >>> 0 /* LANGUAGEID_OFFSET */;\n };\n StackElementMetadata.getTokenType = function (metadata) {\n return (metadata & 1792 /* TOKEN_TYPE_MASK */) >>> 8 /* TOKEN_TYPE_OFFSET */;\n };\n StackElementMetadata.getFontStyle = function (metadata) {\n return (metadata & 14336 /* FONT_STYLE_MASK */) >>> 11 /* FONT_STYLE_OFFSET */;\n };\n StackElementMetadata.getForeground = function (metadata) {\n return (metadata & 8372224 /* FOREGROUND_MASK */) >>> 14 /* FOREGROUND_OFFSET */;\n };\n StackElementMetadata.getBackground = function (metadata) {\n return (metadata & 4286578688 /* BACKGROUND_MASK */) >>> 23 /* BACKGROUND_OFFSET */;\n };\n StackElementMetadata.set = function (metadata, languageId, tokenType, fontStyle, foreground, background) {\n var _languageId = StackElementMetadata.getLanguageId(metadata);\n var _tokenType = StackElementMetadata.getTokenType(metadata);\n var _fontStyle = StackElementMetadata.getFontStyle(metadata);\n var _foreground = StackElementMetadata.getForeground(metadata);\n var _background = StackElementMetadata.getBackground(metadata);\n if (languageId !== 0) {\n _languageId = languageId;\n }\n if (tokenType !== 0 /* Other */) {\n _tokenType = tokenType === 8 /* MetaEmbedded */ ? 0 /* Other */ : tokenType;\n }\n if (fontStyle !== -1 /* NotSet */) {\n _fontStyle = fontStyle;\n }\n if (foreground !== 0) {\n _foreground = foreground;\n }\n if (background !== 0) {\n _background = background;\n }\n return ((_languageId << 0 /* LANGUAGEID_OFFSET */)\n | (_tokenType << 8 /* TOKEN_TYPE_OFFSET */)\n | (_fontStyle << 11 /* FONT_STYLE_OFFSET */)\n | (_foreground << 14 /* FOREGROUND_OFFSET */)\n | (_background << 23 /* BACKGROUND_OFFSET */)) >>> 0;\n };\n return StackElementMetadata;\n}());\nexports.StackElementMetadata = StackElementMetadata;\nvar ScopeListElement = /** @class */ (function () {\n function ScopeListElement(parent, scope, metadata) {\n this.parent = parent;\n this.scope = scope;\n this.metadata = metadata;\n }\n ScopeListElement._equals = function (a, b) {\n do {\n if (a === b) {\n return true;\n }\n if (!a && !b) {\n // End of list reached for both\n return true;\n }\n if (!a || !b) {\n // End of list reached only for one\n return false;\n }\n if (a.scope !== b.scope || a.metadata !== b.metadata) {\n return false;\n }\n // Go to previous pair\n a = a.parent;\n b = b.parent;\n } while (true);\n };\n ScopeListElement.prototype.equals = function (other) {\n return ScopeListElement._equals(this, other);\n };\n ScopeListElement._matchesScope = function (scope, selector, selectorWithDot) {\n return (selector === scope || scope.substring(0, selectorWithDot.length) === selectorWithDot);\n };\n ScopeListElement._matches = function (target, parentScopes) {\n if (parentScopes === null) {\n return true;\n }\n var len = parentScopes.length;\n var index = 0;\n var selector = parentScopes[index];\n var selectorWithDot = selector + '.';\n while (target) {\n if (this._matchesScope(target.scope, selector, selectorWithDot)) {\n index++;\n if (index === len) {\n return true;\n }\n selector = parentScopes[index];\n selectorWithDot = selector + '.';\n }\n target = target.parent;\n }\n return false;\n };\n ScopeListElement.mergeMetadata = function (metadata, scopesList, source) {\n if (source === null) {\n return metadata;\n }\n var fontStyle = -1 /* NotSet */;\n var foreground = 0;\n var background = 0;\n if (source.themeData !== null) {\n // Find the first themeData that matches\n for (var i = 0, len = source.themeData.length; i < len; i++) {\n var themeData = source.themeData[i];\n if (this._matches(scopesList, themeData.parentScopes)) {\n fontStyle = themeData.fontStyle;\n foreground = themeData.foreground;\n background = themeData.background;\n break;\n }\n }\n }\n return StackElementMetadata.set(metadata, source.languageId, source.tokenType, fontStyle, foreground, background);\n };\n ScopeListElement._push = function (target, grammar, scopes) {\n for (var i = 0, len = scopes.length; i < len; i++) {\n var scope = scopes[i];\n var rawMetadata = grammar.getMetadataForScope(scope);\n var metadata = ScopeListElement.mergeMetadata(target.metadata, target, rawMetadata);\n target = new ScopeListElement(target, scope, metadata);\n }\n return target;\n };\n ScopeListElement.prototype.push = function (grammar, scope) {\n if (scope === null) {\n return this;\n }\n if (scope.indexOf(' ') >= 0) {\n // there are multiple scopes to push\n return ScopeListElement._push(this, grammar, scope.split(/ /g));\n }\n // there is a single scope to push\n return ScopeListElement._push(this, grammar, [scope]);\n };\n ScopeListElement._generateScopes = function (scopesList) {\n var result = [];\n var resultLen = 0;\n while (scopesList) {\n result[resultLen++] = scopesList.scope;\n scopesList = scopesList.parent;\n }\n result.reverse();\n return result;\n };\n ScopeListElement.prototype.generateScopes = function () {\n return ScopeListElement._generateScopes(this);\n };\n return ScopeListElement;\n}());\nexports.ScopeListElement = ScopeListElement;\n/**\n * Represents a \"pushed\" state on the stack (as a linked list element).\n */\nvar StackElement = /** @class */ (function () {\n function StackElement(parent, ruleId, enterPos, anchorPos, beginRuleCapturedEOL, endRule, nameScopesList, contentNameScopesList) {\n this.parent = parent;\n this.depth = (this.parent ? this.parent.depth + 1 : 1);\n this.ruleId = ruleId;\n this._enterPos = enterPos;\n this._anchorPos = anchorPos;\n this.beginRuleCapturedEOL = beginRuleCapturedEOL;\n this.endRule = endRule;\n this.nameScopesList = nameScopesList;\n this.contentNameScopesList = contentNameScopesList;\n }\n /**\n * A structural equals check. Does not take into account `scopes`.\n */\n StackElement._structuralEquals = function (a, b) {\n do {\n if (a === b) {\n return true;\n }\n if (!a && !b) {\n // End of list reached for both\n return true;\n }\n if (!a || !b) {\n // End of list reached only for one\n return false;\n }\n if (a.depth !== b.depth || a.ruleId !== b.ruleId || a.endRule !== b.endRule) {\n return false;\n }\n // Go to previous pair\n a = a.parent;\n b = b.parent;\n } while (true);\n };\n StackElement._equals = function (a, b) {\n if (a === b) {\n return true;\n }\n if (!this._structuralEquals(a, b)) {\n return false;\n }\n return a.contentNameScopesList.equals(b.contentNameScopesList);\n };\n StackElement.prototype.clone = function () {\n return this;\n };\n StackElement.prototype.equals = function (other) {\n if (other === null) {\n return false;\n }\n return StackElement._equals(this, other);\n };\n StackElement._reset = function (el) {\n while (el) {\n el._enterPos = -1;\n el._anchorPos = -1;\n el = el.parent;\n }\n };\n StackElement.prototype.reset = function () {\n StackElement._reset(this);\n };\n StackElement.prototype.pop = function () {\n return this.parent;\n };\n StackElement.prototype.safePop = function () {\n if (this.parent) {\n return this.parent;\n }\n return this;\n };\n StackElement.prototype.push = function (ruleId, enterPos, anchorPos, beginRuleCapturedEOL, endRule, nameScopesList, contentNameScopesList) {\n return new StackElement(this, ruleId, enterPos, anchorPos, beginRuleCapturedEOL, endRule, nameScopesList, contentNameScopesList);\n };\n StackElement.prototype.getEnterPos = function () {\n return this._enterPos;\n };\n StackElement.prototype.getAnchorPos = function () {\n return this._anchorPos;\n };\n StackElement.prototype.getRule = function (grammar) {\n return grammar.getRule(this.ruleId);\n };\n StackElement.prototype._writeString = function (res, outIndex) {\n if (this.parent) {\n outIndex = this.parent._writeString(res, outIndex);\n }\n res[outIndex++] = \"(\" + this.ruleId + \", TODO-\" + this.nameScopesList + \", TODO-\" + this.contentNameScopesList + \")\";\n return outIndex;\n };\n StackElement.prototype.toString = function () {\n var r = [];\n this._writeString(r, 0);\n return '[' + r.join(',') + ']';\n };\n StackElement.prototype.setContentNameScopesList = function (contentNameScopesList) {\n if (this.contentNameScopesList === contentNameScopesList) {\n return this;\n }\n return this.parent.push(this.ruleId, this._enterPos, this._anchorPos, this.beginRuleCapturedEOL, this.endRule, this.nameScopesList, contentNameScopesList);\n };\n StackElement.prototype.setEndRule = function (endRule) {\n if (this.endRule === endRule) {\n return this;\n }\n return new StackElement(this.parent, this.ruleId, this._enterPos, this._anchorPos, this.beginRuleCapturedEOL, endRule, this.nameScopesList, this.contentNameScopesList);\n };\n StackElement.prototype.hasSameRuleAs = function (other) {\n var el = this;\n while (el && el._enterPos === other._enterPos) {\n if (el.ruleId === other.ruleId) {\n return true;\n }\n el = el.parent;\n }\n return false;\n };\n StackElement.NULL = new StackElement(null, 0, 0, 0, false, null, null, null);\n return StackElement;\n}());\nexports.StackElement = StackElement;\nvar LocalStackElement = /** @class */ (function () {\n function LocalStackElement(scopes, endPos) {\n this.scopes = scopes;\n this.endPos = endPos;\n }\n return LocalStackElement;\n}());\nexports.LocalStackElement = LocalStackElement;\nvar LineTokens = /** @class */ (function () {\n function LineTokens(emitBinaryTokens, lineText, tokenTypeOverrides) {\n this._emitBinaryTokens = emitBinaryTokens;\n this._tokenTypeOverrides = tokenTypeOverrides;\n if (debug_1.DebugFlags.InDebugMode) {\n this._lineText = lineText;\n }\n else {\n this._lineText = null;\n }\n this._tokens = [];\n this._binaryTokens = [];\n this._lastTokenEndIndex = 0;\n }\n LineTokens.prototype.produce = function (stack, endIndex) {\n this.produceFromScopes(stack.contentNameScopesList, endIndex);\n };\n LineTokens.prototype.produceFromScopes = function (scopesList, endIndex) {\n if (this._lastTokenEndIndex >= endIndex) {\n return;\n }\n if (this._emitBinaryTokens) {\n var metadata = scopesList.metadata;\n for (var _i = 0, _a = this._tokenTypeOverrides; _i < _a.length; _i++) {\n var tokenType = _a[_i];\n if (tokenType.matcher(scopesList.generateScopes())) {\n metadata = StackElementMetadata.set(metadata, 0, toTemporaryType(tokenType.type), -1 /* NotSet */, 0, 0);\n }\n }\n if (this._binaryTokens.length > 0 && this._binaryTokens[this._binaryTokens.length - 1] === metadata) {\n // no need to push a token with the same metadata\n this._lastTokenEndIndex = endIndex;\n return;\n }\n this._binaryTokens.push(this._lastTokenEndIndex);\n this._binaryTokens.push(metadata);\n this._lastTokenEndIndex = endIndex;\n return;\n }\n var scopes = scopesList.generateScopes();\n if (debug_1.DebugFlags.InDebugMode) {\n console.log(' token: |' + this._lineText.substring(this._lastTokenEndIndex, endIndex).replace(/\\n$/, '\\\\n') + '|');\n for (var k = 0; k < scopes.length; k++) {\n console.log(' * ' + scopes[k]);\n }\n }\n this._tokens.push({\n startIndex: this._lastTokenEndIndex,\n endIndex: endIndex,\n // value: lineText.substring(lastTokenEndIndex, endIndex),\n scopes: scopes\n });\n this._lastTokenEndIndex = endIndex;\n };\n LineTokens.prototype.getResult = function (stack, lineLength) {\n if (this._tokens.length > 0 && this._tokens[this._tokens.length - 1].startIndex === lineLength - 1) {\n // pop produced token for newline\n this._tokens.pop();\n }\n if (this._tokens.length === 0) {\n this._lastTokenEndIndex = -1;\n this.produce(stack, lineLength);\n this._tokens[this._tokens.length - 1].startIndex = 0;\n }\n return this._tokens;\n };\n LineTokens.prototype.getBinaryResult = function (stack, lineLength) {\n if (this._binaryTokens.length > 0 && this._binaryTokens[this._binaryTokens.length - 2] === lineLength - 1) {\n // pop produced token for newline\n this._binaryTokens.pop();\n this._binaryTokens.pop();\n }\n if (this._binaryTokens.length === 0) {\n this._lastTokenEndIndex = -1;\n this.produce(stack, lineLength);\n this._binaryTokens[this._binaryTokens.length - 2] = 0;\n }\n var result = new Uint32Array(this._binaryTokens.length);\n for (var i = 0, len = this._binaryTokens.length; i < len; i++) {\n result[i] = this._binaryTokens[i];\n }\n return result;\n };\n return LineTokens;\n}());\nfunction toTemporaryType(standardType) {\n switch (standardType) {\n case 4 /* RegEx */:\n return 4 /* RegEx */;\n case 2 /* String */:\n return 2 /* String */;\n case 1 /* Comment */:\n return 1 /* Comment */;\n case 0 /* Other */:\n default:\n // `MetaEmbedded` is the same scope as `Other`\n // but it overwrites existing token types in the stack.\n return 8 /* MetaEmbedded */;\n }\n}\n//# sourceMappingURL=grammar.js.map","\"use strict\";\n/*---------------------------------------------------------\n * Copyright (C) Microsoft Corporation. All rights reserved.\n *--------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.parseRawGrammar = void 0;\nvar plist = require(\"./plist\");\nvar debug_1 = require(\"./debug\");\nvar json_1 = require(\"./json\");\nfunction parseRawGrammar(content, filePath) {\n if (filePath === void 0) { filePath = null; }\n if (filePath !== null && /\\.json$/.test(filePath)) {\n return parseJSONGrammar(content, filePath);\n }\n return parsePLISTGrammar(content, filePath);\n}\nexports.parseRawGrammar = parseRawGrammar;\nfunction parseJSONGrammar(contents, filename) {\n if (debug_1.DebugFlags.InDebugMode) {\n return json_1.parse(contents, filename, true);\n }\n return JSON.parse(contents);\n}\nfunction parsePLISTGrammar(contents, filename) {\n if (debug_1.DebugFlags.InDebugMode) {\n return plist.parseWithLocation(contents, filename, '$vscodeTextmateLocation');\n }\n return plist.parse(contents);\n}\n//# sourceMappingURL=grammarReader.js.map","\"use strict\";\n/*---------------------------------------------------------\n * Copyright (C) Microsoft Corporation. All rights reserved.\n *--------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.parse = void 0;\nfunction doFail(streamState, msg) {\n // console.log('Near offset ' + streamState.pos + ': ' + msg + ' ~~~' + streamState.source.substr(streamState.pos, 50) + '~~~');\n throw new Error('Near offset ' + streamState.pos + ': ' + msg + ' ~~~' + streamState.source.substr(streamState.pos, 50) + '~~~');\n}\nfunction parse(source, filename, withMetadata) {\n var streamState = new JSONStreamState(source);\n var token = new JSONToken();\n var state = 0 /* ROOT_STATE */;\n var cur = null;\n var stateStack = [];\n var objStack = [];\n function pushState() {\n stateStack.push(state);\n objStack.push(cur);\n }\n function popState() {\n state = stateStack.pop();\n cur = objStack.pop();\n }\n function fail(msg) {\n doFail(streamState, msg);\n }\n while (nextJSONToken(streamState, token)) {\n if (state === 0 /* ROOT_STATE */) {\n if (cur !== null) {\n fail('too many constructs in root');\n }\n if (token.type === 3 /* LEFT_CURLY_BRACKET */) {\n cur = {};\n if (withMetadata) {\n cur.$vscodeTextmateLocation = token.toLocation(filename);\n }\n pushState();\n state = 1 /* DICT_STATE */;\n continue;\n }\n if (token.type === 2 /* LEFT_SQUARE_BRACKET */) {\n cur = [];\n pushState();\n state = 4 /* ARR_STATE */;\n continue;\n }\n fail('unexpected token in root');\n }\n if (state === 2 /* DICT_STATE_COMMA */) {\n if (token.type === 5 /* RIGHT_CURLY_BRACKET */) {\n popState();\n continue;\n }\n if (token.type === 7 /* COMMA */) {\n state = 3 /* DICT_STATE_NO_CLOSE */;\n continue;\n }\n fail('expected , or }');\n }\n if (state === 1 /* DICT_STATE */ || state === 3 /* DICT_STATE_NO_CLOSE */) {\n if (state === 1 /* DICT_STATE */ && token.type === 5 /* RIGHT_CURLY_BRACKET */) {\n popState();\n continue;\n }\n if (token.type === 1 /* STRING */) {\n var keyValue = token.value;\n if (!nextJSONToken(streamState, token) || token.type !== 6 /* COLON */) {\n fail('expected colon');\n }\n if (!nextJSONToken(streamState, token)) {\n fail('expected value');\n }\n state = 2 /* DICT_STATE_COMMA */;\n if (token.type === 1 /* STRING */) {\n cur[keyValue] = token.value;\n continue;\n }\n if (token.type === 8 /* NULL */) {\n cur[keyValue] = null;\n continue;\n }\n if (token.type === 9 /* TRUE */) {\n cur[keyValue] = true;\n continue;\n }\n if (token.type === 10 /* FALSE */) {\n cur[keyValue] = false;\n continue;\n }\n if (token.type === 11 /* NUMBER */) {\n cur[keyValue] = parseFloat(token.value);\n continue;\n }\n if (token.type === 2 /* LEFT_SQUARE_BRACKET */) {\n var newArr = [];\n cur[keyValue] = newArr;\n pushState();\n state = 4 /* ARR_STATE */;\n cur = newArr;\n continue;\n }\n if (token.type === 3 /* LEFT_CURLY_BRACKET */) {\n var newDict = {};\n if (withMetadata) {\n newDict.$vscodeTextmateLocation = token.toLocation(filename);\n }\n cur[keyValue] = newDict;\n pushState();\n state = 1 /* DICT_STATE */;\n cur = newDict;\n continue;\n }\n }\n fail('unexpected token in dict');\n }\n if (state === 5 /* ARR_STATE_COMMA */) {\n if (token.type === 4 /* RIGHT_SQUARE_BRACKET */) {\n popState();\n continue;\n }\n if (token.type === 7 /* COMMA */) {\n state = 6 /* ARR_STATE_NO_CLOSE */;\n continue;\n }\n fail('expected , or ]');\n }\n if (state === 4 /* ARR_STATE */ || state === 6 /* ARR_STATE_NO_CLOSE */) {\n if (state === 4 /* ARR_STATE */ && token.type === 4 /* RIGHT_SQUARE_BRACKET */) {\n popState();\n continue;\n }\n state = 5 /* ARR_STATE_COMMA */;\n if (token.type === 1 /* STRING */) {\n cur.push(token.value);\n continue;\n }\n if (token.type === 8 /* NULL */) {\n cur.push(null);\n continue;\n }\n if (token.type === 9 /* TRUE */) {\n cur.push(true);\n continue;\n }\n if (token.type === 10 /* FALSE */) {\n cur.push(false);\n continue;\n }\n if (token.type === 11 /* NUMBER */) {\n cur.push(parseFloat(token.value));\n continue;\n }\n if (token.type === 2 /* LEFT_SQUARE_BRACKET */) {\n var newArr = [];\n cur.push(newArr);\n pushState();\n state = 4 /* ARR_STATE */;\n cur = newArr;\n continue;\n }\n if (token.type === 3 /* LEFT_CURLY_BRACKET */) {\n var newDict = {};\n if (withMetadata) {\n newDict.$vscodeTextmateLocation = token.toLocation(filename);\n }\n cur.push(newDict);\n pushState();\n state = 1 /* DICT_STATE */;\n cur = newDict;\n continue;\n }\n fail('unexpected token in array');\n }\n fail('unknown state');\n }\n if (objStack.length !== 0) {\n fail('unclosed constructs');\n }\n return cur;\n}\nexports.parse = parse;\nvar JSONStreamState = /** @class */ (function () {\n function JSONStreamState(source) {\n this.source = source;\n this.pos = 0;\n this.len = source.length;\n this.line = 1;\n this.char = 0;\n }\n return JSONStreamState;\n}());\nvar JSONToken = /** @class */ (function () {\n function JSONToken() {\n this.value = null;\n this.type = 0 /* UNKNOWN */;\n this.offset = -1;\n this.len = -1;\n this.line = -1;\n this.char = -1;\n }\n JSONToken.prototype.toLocation = function (filename) {\n return {\n filename: filename,\n line: this.line,\n char: this.char\n };\n };\n return JSONToken;\n}());\n/**\n * precondition: the string is known to be valid JSON (https://www.ietf.org/rfc/rfc4627.txt)\n */\nfunction nextJSONToken(_state, _out) {\n _out.value = null;\n _out.type = 0 /* UNKNOWN */;\n _out.offset = -1;\n _out.len = -1;\n _out.line = -1;\n _out.char = -1;\n var source = _state.source;\n var pos = _state.pos;\n var len = _state.len;\n var line = _state.line;\n var char = _state.char;\n //------------------------ skip whitespace\n var chCode;\n do {\n if (pos >= len) {\n return false; /*EOS*/\n }\n chCode = source.charCodeAt(pos);\n if (chCode === 32 /* SPACE */ || chCode === 9 /* HORIZONTAL_TAB */ || chCode === 13 /* CARRIAGE_RETURN */) {\n // regular whitespace\n pos++;\n char++;\n continue;\n }\n if (chCode === 10 /* LINE_FEED */) {\n // newline\n pos++;\n line++;\n char = 0;\n continue;\n }\n // not whitespace\n break;\n } while (true);\n _out.offset = pos;\n _out.line = line;\n _out.char = char;\n if (chCode === 34 /* QUOTATION_MARK */) {\n //------------------------ strings\n _out.type = 1 /* STRING */;\n pos++;\n char++;\n do {\n if (pos >= len) {\n return false; /*EOS*/\n }\n chCode = source.charCodeAt(pos);\n pos++;\n char++;\n if (chCode === 92 /* BACKSLASH */) {\n // skip next char\n pos++;\n char++;\n continue;\n }\n if (chCode === 34 /* QUOTATION_MARK */) {\n // end of the string\n break;\n }\n } while (true);\n _out.value = source.substring(_out.offset + 1, pos - 1).replace(/\\\\u([0-9A-Fa-f]{4})/g, function (_, m0) {\n return String.fromCodePoint(parseInt(m0, 16));\n }).replace(/\\\\(.)/g, function (_, m0) {\n switch (m0) {\n case '\"': return '\"';\n case '\\\\': return '\\\\';\n case '/': return '/';\n case 'b': return '\\b';\n case 'f': return '\\f';\n case 'n': return '\\n';\n case 'r': return '\\r';\n case 't': return '\\t';\n default: doFail(_state, 'invalid escape sequence');\n }\n throw new Error('unreachable');\n });\n }\n else if (chCode === 91 /* LEFT_SQUARE_BRACKET */) {\n _out.type = 2 /* LEFT_SQUARE_BRACKET */;\n pos++;\n char++;\n }\n else if (chCode === 123 /* LEFT_CURLY_BRACKET */) {\n _out.type = 3 /* LEFT_CURLY_BRACKET */;\n pos++;\n char++;\n }\n else if (chCode === 93 /* RIGHT_SQUARE_BRACKET */) {\n _out.type = 4 /* RIGHT_SQUARE_BRACKET */;\n pos++;\n char++;\n }\n else if (chCode === 125 /* RIGHT_CURLY_BRACKET */) {\n _out.type = 5 /* RIGHT_CURLY_BRACKET */;\n pos++;\n char++;\n }\n else if (chCode === 58 /* COLON */) {\n _out.type = 6 /* COLON */;\n pos++;\n char++;\n }\n else if (chCode === 44 /* COMMA */) {\n _out.type = 7 /* COMMA */;\n pos++;\n char++;\n }\n else if (chCode === 110 /* n */) {\n //------------------------ null\n _out.type = 8 /* NULL */;\n pos++;\n char++;\n chCode = source.charCodeAt(pos);\n if (chCode !== 117 /* u */) {\n return false; /* INVALID */\n }\n pos++;\n char++;\n chCode = source.charCodeAt(pos);\n if (chCode !== 108 /* l */) {\n return false; /* INVALID */\n }\n pos++;\n char++;\n chCode = source.charCodeAt(pos);\n if (chCode !== 108 /* l */) {\n return false; /* INVALID */\n }\n pos++;\n char++;\n }\n else if (chCode === 116 /* t */) {\n //------------------------ true\n _out.type = 9 /* TRUE */;\n pos++;\n char++;\n chCode = source.charCodeAt(pos);\n if (chCode !== 114 /* r */) {\n return false; /* INVALID */\n }\n pos++;\n char++;\n chCode = source.charCodeAt(pos);\n if (chCode !== 117 /* u */) {\n return false; /* INVALID */\n }\n pos++;\n char++;\n chCode = source.charCodeAt(pos);\n if (chCode !== 101 /* e */) {\n return false; /* INVALID */\n }\n pos++;\n char++;\n }\n else if (chCode === 102 /* f */) {\n //------------------------ false\n _out.type = 10 /* FALSE */;\n pos++;\n char++;\n chCode = source.charCodeAt(pos);\n if (chCode !== 97 /* a */) {\n return false; /* INVALID */\n }\n pos++;\n char++;\n chCode = source.charCodeAt(pos);\n if (chCode !== 108 /* l */) {\n return false; /* INVALID */\n }\n pos++;\n char++;\n chCode = source.charCodeAt(pos);\n if (chCode !== 115 /* s */) {\n return false; /* INVALID */\n }\n pos++;\n char++;\n chCode = source.charCodeAt(pos);\n if (chCode !== 101 /* e */) {\n return false; /* INVALID */\n }\n pos++;\n char++;\n }\n else {\n //------------------------ numbers\n _out.type = 11 /* NUMBER */;\n do {\n if (pos >= len) {\n return false; /*EOS*/\n }\n chCode = source.charCodeAt(pos);\n if (chCode === 46 /* DOT */\n || (chCode >= 48 /* D0 */ && chCode <= 57 /* D9 */)\n || (chCode === 101 /* e */ || chCode === 69 /* E */)\n || (chCode === 45 /* MINUS */ || chCode === 43 /* PLUS */)) {\n // looks like a piece of a number\n pos++;\n char++;\n continue;\n }\n // pos--; char--;\n break;\n } while (true);\n }\n _out.len = pos - _out.offset;\n if (_out.value === null) {\n _out.value = source.substr(_out.offset, _out.len);\n }\n _state.pos = pos;\n _state.line = line;\n _state.char = char;\n // console.log('PRODUCING TOKEN: ', _out.value, JSONTokenType[_out.type]);\n return true;\n}\n//# sourceMappingURL=json.js.map","\"use strict\";\n/*---------------------------------------------------------\n * Copyright (C) Microsoft Corporation. All rights reserved.\n *--------------------------------------------------------*/\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.parseRawGrammar = exports.INITIAL = exports.Registry = void 0;\nvar registry_1 = require(\"./registry\");\nvar grammarReader = require(\"./grammarReader\");\nvar theme_1 = require(\"./theme\");\nvar grammar_1 = require(\"./grammar\");\n__exportStar(require(\"./types\"), exports);\n/**\n * The registry that will hold all grammars.\n */\nvar Registry = /** @class */ (function () {\n function Registry(options) {\n this._options = options;\n this._syncRegistry = new registry_1.SyncRegistry(theme_1.Theme.createFromRawTheme(options.theme, options.colorMap), options.onigLib);\n this._ensureGrammarCache = new Map();\n }\n Registry.prototype.dispose = function () {\n this._syncRegistry.dispose();\n };\n /**\n * Change the theme. Once called, no previous `ruleStack` should be used anymore.\n */\n Registry.prototype.setTheme = function (theme, colorMap) {\n this._syncRegistry.setTheme(theme_1.Theme.createFromRawTheme(theme, colorMap));\n };\n /**\n * Returns a lookup array for color ids.\n */\n Registry.prototype.getColorMap = function () {\n return this._syncRegistry.getColorMap();\n };\n /**\n * Load the grammar for `scopeName` and all referenced included grammars asynchronously.\n * Please do not use language id 0.\n */\n Registry.prototype.loadGrammarWithEmbeddedLanguages = function (initialScopeName, initialLanguage, embeddedLanguages) {\n return this.loadGrammarWithConfiguration(initialScopeName, initialLanguage, { embeddedLanguages: embeddedLanguages });\n };\n /**\n * Load the grammar for `scopeName` and all referenced included grammars asynchronously.\n * Please do not use language id 0.\n */\n Registry.prototype.loadGrammarWithConfiguration = function (initialScopeName, initialLanguage, configuration) {\n return this._loadGrammar(initialScopeName, initialLanguage, configuration.embeddedLanguages, configuration.tokenTypes);\n };\n /**\n * Load the grammar for `scopeName` and all referenced included grammars asynchronously.\n */\n Registry.prototype.loadGrammar = function (initialScopeName) {\n return this._loadGrammar(initialScopeName, 0, null, null);\n };\n Registry.prototype._doLoadSingleGrammar = function (scopeName) {\n return __awaiter(this, void 0, void 0, function () {\n var grammar, injections;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this._options.loadGrammar(scopeName)];\n case 1:\n grammar = _a.sent();\n if (grammar) {\n injections = (typeof this._options.getInjections === 'function' ? this._options.getInjections(scopeName) : undefined);\n this._syncRegistry.addGrammar(grammar, injections);\n }\n return [2 /*return*/];\n }\n });\n });\n };\n Registry.prototype._loadSingleGrammar = function (scopeName) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n if (!this._ensureGrammarCache.has(scopeName)) {\n this._ensureGrammarCache.set(scopeName, this._doLoadSingleGrammar(scopeName));\n }\n return [2 /*return*/, this._ensureGrammarCache.get(scopeName)];\n });\n });\n };\n Registry.prototype._collectDependenciesForDep = function (initialScopeName, result, dep) {\n var grammar = this._syncRegistry.lookup(dep.scopeName);\n if (!grammar) {\n if (dep.scopeName === initialScopeName) {\n throw new Error(\"No grammar provided for <\" + initialScopeName + \">\");\n }\n return;\n }\n if (dep instanceof grammar_1.FullScopeDependency) {\n grammar_1.collectDependencies(result, this._syncRegistry.lookup(initialScopeName), grammar);\n }\n else {\n grammar_1.collectSpecificDependencies(result, this._syncRegistry.lookup(initialScopeName), grammar, dep.include);\n }\n var injections = this._syncRegistry.injections(dep.scopeName);\n if (injections) {\n for (var _i = 0, injections_1 = injections; _i < injections_1.length; _i++) {\n var injection = injections_1[_i];\n result.add(new grammar_1.FullScopeDependency(injection));\n }\n }\n };\n Registry.prototype._loadGrammar = function (initialScopeName, initialLanguage, embeddedLanguages, tokenTypes) {\n return __awaiter(this, void 0, void 0, function () {\n var seenFullScopeRequests, seenPartialScopeRequests, Q, q, deps, _i, q_1, dep, _a, _b, dep, _c, _d, dep;\n var _this = this;\n return __generator(this, function (_e) {\n switch (_e.label) {\n case 0:\n seenFullScopeRequests = new Set();\n seenPartialScopeRequests = new Set();\n seenFullScopeRequests.add(initialScopeName);\n Q = [new grammar_1.FullScopeDependency(initialScopeName)];\n _e.label = 1;\n case 1:\n if (!(Q.length > 0)) return [3 /*break*/, 3];\n q = Q;\n Q = [];\n return [4 /*yield*/, Promise.all(q.map(function (request) { return _this._loadSingleGrammar(request.scopeName); }))];\n case 2:\n _e.sent();\n deps = new grammar_1.ScopeDependencyCollector();\n for (_i = 0, q_1 = q; _i < q_1.length; _i++) {\n dep = q_1[_i];\n this._collectDependenciesForDep(initialScopeName, deps, dep);\n }\n for (_a = 0, _b = deps.full; _a < _b.length; _a++) {\n dep = _b[_a];\n if (seenFullScopeRequests.has(dep.scopeName)) {\n // already processed\n continue;\n }\n seenFullScopeRequests.add(dep.scopeName);\n Q.push(dep);\n }\n for (_c = 0, _d = deps.partial; _c < _d.length; _c++) {\n dep = _d[_c];\n if (seenFullScopeRequests.has(dep.scopeName)) {\n // already processed in full\n continue;\n }\n if (seenPartialScopeRequests.has(dep.toKey())) {\n // already processed\n continue;\n }\n seenPartialScopeRequests.add(dep.toKey());\n Q.push(dep);\n }\n return [3 /*break*/, 1];\n case 3: return [2 /*return*/, this.grammarForScopeName(initialScopeName, initialLanguage, embeddedLanguages, tokenTypes)];\n }\n });\n });\n };\n /**\n * Adds a rawGrammar.\n */\n Registry.prototype.addGrammar = function (rawGrammar, injections, initialLanguage, embeddedLanguages) {\n if (injections === void 0) { injections = []; }\n if (initialLanguage === void 0) { initialLanguage = 0; }\n if (embeddedLanguages === void 0) { embeddedLanguages = null; }\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n this._syncRegistry.addGrammar(rawGrammar, injections);\n return [4 /*yield*/, this.grammarForScopeName(rawGrammar.scopeName, initialLanguage, embeddedLanguages)];\n case 1: return [2 /*return*/, (_a.sent())];\n }\n });\n });\n };\n /**\n * Get the grammar for `scopeName`. The grammar must first be created via `loadGrammar` or `addGrammar`.\n */\n Registry.prototype.grammarForScopeName = function (scopeName, initialLanguage, embeddedLanguages, tokenTypes) {\n if (initialLanguage === void 0) { initialLanguage = 0; }\n if (embeddedLanguages === void 0) { embeddedLanguages = null; }\n if (tokenTypes === void 0) { tokenTypes = null; }\n return this._syncRegistry.grammarForScopeName(scopeName, initialLanguage, embeddedLanguages, tokenTypes);\n };\n return Registry;\n}());\nexports.Registry = Registry;\nexports.INITIAL = grammar_1.StackElement.NULL;\nexports.parseRawGrammar = grammarReader.parseRawGrammar;\n//# sourceMappingURL=main.js.map","\"use strict\";\n/*---------------------------------------------------------\n * Copyright (C) Microsoft Corporation. All rights reserved.\n *--------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createMatchers = void 0;\nfunction createMatchers(selector, matchesName) {\n var results = [];\n var tokenizer = newTokenizer(selector);\n var token = tokenizer.next();\n while (token !== null) {\n var priority = 0;\n if (token.length === 2 && token.charAt(1) === ':') {\n switch (token.charAt(0)) {\n case 'R':\n priority = 1;\n break;\n case 'L':\n priority = -1;\n break;\n default:\n console.log(\"Unknown priority \" + token + \" in scope selector\");\n }\n token = tokenizer.next();\n }\n var matcher = parseConjunction();\n results.push({ matcher: matcher, priority: priority });\n if (token !== ',') {\n break;\n }\n token = tokenizer.next();\n }\n return results;\n function parseOperand() {\n if (token === '-') {\n token = tokenizer.next();\n var expressionToNegate_1 = parseOperand();\n return function (matcherInput) { return !!expressionToNegate_1 && !expressionToNegate_1(matcherInput); };\n }\n if (token === '(') {\n token = tokenizer.next();\n var expressionInParents = parseInnerExpression();\n if (token === ')') {\n token = tokenizer.next();\n }\n return expressionInParents;\n }\n if (isIdentifier(token)) {\n var identifiers_1 = [];\n do {\n identifiers_1.push(token);\n token = tokenizer.next();\n } while (isIdentifier(token));\n return function (matcherInput) { return matchesName(identifiers_1, matcherInput); };\n }\n return null;\n }\n function parseConjunction() {\n var matchers = [];\n var matcher = parseOperand();\n while (matcher) {\n matchers.push(matcher);\n matcher = parseOperand();\n }\n return function (matcherInput) { return matchers.every(function (matcher) { return matcher(matcherInput); }); }; // and\n }\n function parseInnerExpression() {\n var matchers = [];\n var matcher = parseConjunction();\n while (matcher) {\n matchers.push(matcher);\n if (token === '|' || token === ',') {\n do {\n token = tokenizer.next();\n } while (token === '|' || token === ','); // ignore subsequent commas\n }\n else {\n break;\n }\n matcher = parseConjunction();\n }\n return function (matcherInput) { return matchers.some(function (matcher) { return matcher(matcherInput); }); }; // or\n }\n}\nexports.createMatchers = createMatchers;\nfunction isIdentifier(token) {\n return !!token && !!token.match(/[\\w\\.:]+/);\n}\nfunction newTokenizer(input) {\n var regex = /([LR]:|[\\w\\.:][\\w\\.:\\-]*|[\\,\\|\\-\\(\\)])/g;\n var match = regex.exec(input);\n return {\n next: function () {\n if (!match) {\n return null;\n }\n var res = match[0];\n match = regex.exec(input);\n return res;\n }\n };\n}\n//# sourceMappingURL=matcher.js.map","\"use strict\";\n/*---------------------------------------------------------\n * Copyright (C) Microsoft Corporation. All rights reserved.\n *--------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.parse = exports.parseWithLocation = void 0;\nfunction parseWithLocation(content, filename, locationKeyName) {\n return _parse(content, filename, locationKeyName);\n}\nexports.parseWithLocation = parseWithLocation;\n/**\n * A very fast plist parser\n */\nfunction parse(content) {\n return _parse(content, null, null);\n}\nexports.parse = parse;\nfunction _parse(content, filename, locationKeyName) {\n var len = content.length;\n var pos = 0;\n var line = 1;\n var char = 0;\n // Skip UTF8 BOM\n if (len > 0 && content.charCodeAt(0) === 65279 /* BOM */) {\n pos = 1;\n }\n function advancePosBy(by) {\n if (locationKeyName === null) {\n pos = pos + by;\n }\n else {\n while (by > 0) {\n var chCode = content.charCodeAt(pos);\n if (chCode === 10 /* LINE_FEED */) {\n pos++;\n line++;\n char = 0;\n }\n else {\n pos++;\n char++;\n }\n by--;\n }\n }\n }\n function advancePosTo(to) {\n if (locationKeyName === null) {\n pos = to;\n }\n else {\n advancePosBy(to - pos);\n }\n }\n function skipWhitespace() {\n while (pos < len) {\n var chCode = content.charCodeAt(pos);\n if (chCode !== 32 /* SPACE */ && chCode !== 9 /* TAB */ && chCode !== 13 /* CARRIAGE_RETURN */ && chCode !== 10 /* LINE_FEED */) {\n break;\n }\n advancePosBy(1);\n }\n }\n function advanceIfStartsWith(str) {\n if (content.substr(pos, str.length) === str) {\n advancePosBy(str.length);\n return true;\n }\n return false;\n }\n function advanceUntil(str) {\n var nextOccurence = content.indexOf(str, pos);\n if (nextOccurence !== -1) {\n advancePosTo(nextOccurence + str.length);\n }\n else {\n // EOF\n advancePosTo(len);\n }\n }\n function captureUntil(str) {\n var nextOccurence = content.indexOf(str, pos);\n if (nextOccurence !== -1) {\n var r = content.substring(pos, nextOccurence);\n advancePosTo(nextOccurence + str.length);\n return r;\n }\n else {\n // EOF\n var r = content.substr(pos);\n advancePosTo(len);\n return r;\n }\n }\n var state = 0 /* ROOT_STATE */;\n var cur = null;\n var stateStack = [];\n var objStack = [];\n var curKey = null;\n function pushState(newState, newCur) {\n stateStack.push(state);\n objStack.push(cur);\n state = newState;\n cur = newCur;\n }\n function popState() {\n if (stateStack.length === 0) {\n return fail('illegal state stack');\n }\n state = stateStack.pop();\n cur = objStack.pop();\n }\n function fail(msg) {\n throw new Error('Near offset ' + pos + ': ' + msg + ' ~~~' + content.substr(pos, 50) + '~~~');\n }\n var dictState = {\n enterDict: function () {\n if (curKey === null) {\n return fail('missing ');\n }\n var newDict = {};\n if (locationKeyName !== null) {\n newDict[locationKeyName] = {\n filename: filename,\n line: line,\n char: char\n };\n }\n cur[curKey] = newDict;\n curKey = null;\n pushState(1 /* DICT_STATE */, newDict);\n },\n enterArray: function () {\n if (curKey === null) {\n return fail('missing ');\n }\n var newArr = [];\n cur[curKey] = newArr;\n curKey = null;\n pushState(2 /* ARR_STATE */, newArr);\n }\n };\n var arrState = {\n enterDict: function () {\n var newDict = {};\n if (locationKeyName !== null) {\n newDict[locationKeyName] = {\n filename: filename,\n line: line,\n char: char\n };\n }\n cur.push(newDict);\n pushState(1 /* DICT_STATE */, newDict);\n },\n enterArray: function () {\n var newArr = [];\n cur.push(newArr);\n pushState(2 /* ARR_STATE */, newArr);\n }\n };\n function enterDict() {\n if (state === 1 /* DICT_STATE */) {\n dictState.enterDict();\n }\n else if (state === 2 /* ARR_STATE */) {\n arrState.enterDict();\n }\n else { // ROOT_STATE\n cur = {};\n if (locationKeyName !== null) {\n cur[locationKeyName] = {\n filename: filename,\n line: line,\n char: char\n };\n }\n pushState(1 /* DICT_STATE */, cur);\n }\n }\n function leaveDict() {\n if (state === 1 /* DICT_STATE */) {\n popState();\n }\n else if (state === 2 /* ARR_STATE */) {\n return fail('unexpected ');\n }\n else { // ROOT_STATE\n return fail('unexpected ');\n }\n }\n function enterArray() {\n if (state === 1 /* DICT_STATE */) {\n dictState.enterArray();\n }\n else if (state === 2 /* ARR_STATE */) {\n arrState.enterArray();\n }\n else { // ROOT_STATE\n cur = [];\n pushState(2 /* ARR_STATE */, cur);\n }\n }\n function leaveArray() {\n if (state === 1 /* DICT_STATE */) {\n return fail('unexpected ');\n }\n else if (state === 2 /* ARR_STATE */) {\n popState();\n }\n else { // ROOT_STATE\n return fail('unexpected ');\n }\n }\n function acceptKey(val) {\n if (state === 1 /* DICT_STATE */) {\n if (curKey !== null) {\n return fail('too many ');\n }\n curKey = val;\n }\n else if (state === 2 /* ARR_STATE */) {\n return fail('unexpected ');\n }\n else { // ROOT_STATE\n return fail('unexpected ');\n }\n }\n function acceptString(val) {\n if (state === 1 /* DICT_STATE */) {\n if (curKey === null) {\n return fail('missing ');\n }\n cur[curKey] = val;\n curKey = null;\n }\n else if (state === 2 /* ARR_STATE */) {\n cur.push(val);\n }\n else { // ROOT_STATE\n cur = val;\n }\n }\n function acceptReal(val) {\n if (isNaN(val)) {\n return fail('cannot parse float');\n }\n if (state === 1 /* DICT_STATE */) {\n if (curKey === null) {\n return fail('missing ');\n }\n cur[curKey] = val;\n curKey = null;\n }\n else if (state === 2 /* ARR_STATE */) {\n cur.push(val);\n }\n else { // ROOT_STATE\n cur = val;\n }\n }\n function acceptInteger(val) {\n if (isNaN(val)) {\n return fail('cannot parse integer');\n }\n if (state === 1 /* DICT_STATE */) {\n if (curKey === null) {\n return fail('missing ');\n }\n cur[curKey] = val;\n curKey = null;\n }\n else if (state === 2 /* ARR_STATE */) {\n cur.push(val);\n }\n else { // ROOT_STATE\n cur = val;\n }\n }\n function acceptDate(val) {\n if (state === 1 /* DICT_STATE */) {\n if (curKey === null) {\n return fail('missing ');\n }\n cur[curKey] = val;\n curKey = null;\n }\n else if (state === 2 /* ARR_STATE */) {\n cur.push(val);\n }\n else { // ROOT_STATE\n cur = val;\n }\n }\n function acceptData(val) {\n if (state === 1 /* DICT_STATE */) {\n if (curKey === null) {\n return fail('missing ');\n }\n cur[curKey] = val;\n curKey = null;\n }\n else if (state === 2 /* ARR_STATE */) {\n cur.push(val);\n }\n else { // ROOT_STATE\n cur = val;\n }\n }\n function acceptBool(val) {\n if (state === 1 /* DICT_STATE */) {\n if (curKey === null) {\n return fail('missing ');\n }\n cur[curKey] = val;\n curKey = null;\n }\n else if (state === 2 /* ARR_STATE */) {\n cur.push(val);\n }\n else { // ROOT_STATE\n cur = val;\n }\n }\n function escapeVal(str) {\n return str.replace(/&#([0-9]+);/g, function (_, m0) {\n return String.fromCodePoint(parseInt(m0, 10));\n }).replace(/&#x([0-9a-f]+);/g, function (_, m0) {\n return String.fromCodePoint(parseInt(m0, 16));\n }).replace(/&|<|>|"|'/g, function (_) {\n switch (_) {\n case '&': return '&';\n case '<': return '<';\n case '>': return '>';\n case '"': return '\"';\n case ''': return '\\'';\n }\n return _;\n });\n }\n function parseOpenTag() {\n var r = captureUntil('>');\n var isClosed = false;\n if (r.charCodeAt(r.length - 1) === 47 /* SLASH */) {\n isClosed = true;\n r = r.substring(0, r.length - 1);\n }\n return {\n name: r.trim(),\n isClosed: isClosed\n };\n }\n function parseTagValue(tag) {\n if (tag.isClosed) {\n return '';\n }\n var val = captureUntil('');\n return escapeVal(val);\n }\n while (pos < len) {\n skipWhitespace();\n if (pos >= len) {\n break;\n }\n var chCode = content.charCodeAt(pos);\n advancePosBy(1);\n if (chCode !== 60 /* LESS_THAN */) {\n return fail('expected <');\n }\n if (pos >= len) {\n return fail('unexpected end of input');\n }\n var peekChCode = content.charCodeAt(pos);\n if (peekChCode === 63 /* QUESTION_MARK */) {\n advancePosBy(1);\n advanceUntil('?>');\n continue;\n }\n if (peekChCode === 33 /* EXCLAMATION_MARK */) {\n advancePosBy(1);\n if (advanceIfStartsWith('--')) {\n advanceUntil('-->');\n continue;\n }\n advanceUntil('>');\n continue;\n }\n if (peekChCode === 47 /* SLASH */) {\n advancePosBy(1);\n skipWhitespace();\n if (advanceIfStartsWith('plist')) {\n advanceUntil('>');\n continue;\n }\n if (advanceIfStartsWith('dict')) {\n advanceUntil('>');\n leaveDict();\n continue;\n }\n if (advanceIfStartsWith('array')) {\n advanceUntil('>');\n leaveArray();\n continue;\n }\n return fail('unexpected closed tag');\n }\n var tag = parseOpenTag();\n switch (tag.name) {\n case 'dict':\n enterDict();\n if (tag.isClosed) {\n leaveDict();\n }\n continue;\n case 'array':\n enterArray();\n if (tag.isClosed) {\n leaveArray();\n }\n continue;\n case 'key':\n acceptKey(parseTagValue(tag));\n continue;\n case 'string':\n acceptString(parseTagValue(tag));\n continue;\n case 'real':\n acceptReal(parseFloat(parseTagValue(tag)));\n continue;\n case 'integer':\n acceptInteger(parseInt(parseTagValue(tag), 10));\n continue;\n case 'date':\n acceptDate(new Date(parseTagValue(tag)));\n continue;\n case 'data':\n acceptData(parseTagValue(tag));\n continue;\n case 'true':\n parseTagValue(tag);\n acceptBool(true);\n continue;\n case 'false':\n parseTagValue(tag);\n acceptBool(false);\n continue;\n }\n if (/^plist/.test(tag.name)) {\n continue;\n }\n return fail('unexpected opened tag ' + tag.name);\n }\n return cur;\n}\n//# sourceMappingURL=plist.js.map","\"use strict\";\n/*---------------------------------------------------------\n * Copyright (C) Microsoft Corporation. All rights reserved.\n *--------------------------------------------------------*/\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.SyncRegistry = void 0;\nvar grammar_1 = require(\"./grammar\");\nvar SyncRegistry = /** @class */ (function () {\n function SyncRegistry(theme, onigLibPromise) {\n this._theme = theme;\n this._grammars = {};\n this._rawGrammars = {};\n this._injectionGrammars = {};\n this._onigLibPromise = onigLibPromise;\n }\n SyncRegistry.prototype.dispose = function () {\n for (var scopeName in this._grammars) {\n if (this._grammars.hasOwnProperty(scopeName)) {\n this._grammars[scopeName].dispose();\n }\n }\n };\n SyncRegistry.prototype.setTheme = function (theme) {\n var _this = this;\n this._theme = theme;\n Object.keys(this._grammars).forEach(function (scopeName) {\n var grammar = _this._grammars[scopeName];\n grammar.onDidChangeTheme();\n });\n };\n SyncRegistry.prototype.getColorMap = function () {\n return this._theme.getColorMap();\n };\n /**\n * Add `grammar` to registry and return a list of referenced scope names\n */\n SyncRegistry.prototype.addGrammar = function (grammar, injectionScopeNames) {\n this._rawGrammars[grammar.scopeName] = grammar;\n if (injectionScopeNames) {\n this._injectionGrammars[grammar.scopeName] = injectionScopeNames;\n }\n };\n /**\n * Lookup a raw grammar.\n */\n SyncRegistry.prototype.lookup = function (scopeName) {\n return this._rawGrammars[scopeName];\n };\n /**\n * Returns the injections for the given grammar\n */\n SyncRegistry.prototype.injections = function (targetScope) {\n return this._injectionGrammars[targetScope];\n };\n /**\n * Get the default theme settings\n */\n SyncRegistry.prototype.getDefaults = function () {\n return this._theme.getDefaults();\n };\n /**\n * Match a scope in the theme.\n */\n SyncRegistry.prototype.themeMatch = function (scopeName) {\n return this._theme.match(scopeName);\n };\n /**\n * Lookup a grammar.\n */\n SyncRegistry.prototype.grammarForScopeName = function (scopeName, initialLanguage, embeddedLanguages, tokenTypes) {\n return __awaiter(this, void 0, void 0, function () {\n var rawGrammar, _a, _b, _c, _d;\n return __generator(this, function (_e) {\n switch (_e.label) {\n case 0:\n if (!!this._grammars[scopeName]) return [3 /*break*/, 2];\n rawGrammar = this._rawGrammars[scopeName];\n if (!rawGrammar) {\n return [2 /*return*/, null];\n }\n _a = this._grammars;\n _b = scopeName;\n _c = grammar_1.createGrammar;\n _d = [rawGrammar, initialLanguage, embeddedLanguages, tokenTypes, this];\n return [4 /*yield*/, this._onigLibPromise];\n case 1:\n _a[_b] = _c.apply(void 0, _d.concat([_e.sent()]));\n _e.label = 2;\n case 2: return [2 /*return*/, this._grammars[scopeName]];\n }\n });\n });\n };\n return SyncRegistry;\n}());\nexports.SyncRegistry = SyncRegistry;\n//# sourceMappingURL=registry.js.map","\"use strict\";\n/*---------------------------------------------------------\n * Copyright (C) Microsoft Corporation. All rights reserved.\n *--------------------------------------------------------*/\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.RuleFactory = exports.BeginWhileRule = exports.BeginEndRule = exports.IncludeOnlyRule = exports.MatchRule = exports.RegExpSourceList = exports.RegExpSource = exports.CaptureRule = exports.Rule = exports.CompiledRule = void 0;\nvar utils_1 = require(\"./utils\");\nvar HAS_BACK_REFERENCES = /\\\\(\\d+)/;\nvar BACK_REFERENCING_END = /\\\\(\\d+)/g;\nvar CompiledRule = /** @class */ (function () {\n function CompiledRule(onigLib, regExps, rules) {\n this.debugRegExps = regExps;\n this.rules = rules;\n this.scanner = onigLib.createOnigScanner(regExps);\n }\n CompiledRule.prototype.dispose = function () {\n if (typeof this.scanner.dispose === 'function') {\n this.scanner.dispose();\n }\n };\n return CompiledRule;\n}());\nexports.CompiledRule = CompiledRule;\nvar Rule = /** @class */ (function () {\n function Rule($location, id, name, contentName) {\n this.$location = $location;\n this.id = id;\n this._name = name || null;\n this._nameIsCapturing = utils_1.RegexSource.hasCaptures(this._name);\n this._contentName = contentName || null;\n this._contentNameIsCapturing = utils_1.RegexSource.hasCaptures(this._contentName);\n }\n Object.defineProperty(Rule.prototype, \"debugName\", {\n get: function () {\n var location = this.$location ? utils_1.basename(this.$location.filename) + \":\" + this.$location.line : 'unknown';\n return this.constructor.name + \"#\" + this.id + \" @ \" + location;\n },\n enumerable: false,\n configurable: true\n });\n Rule.prototype.getName = function (lineText, captureIndices) {\n if (!this._nameIsCapturing || this._name === null || lineText === null || captureIndices === null) {\n return this._name;\n }\n return utils_1.RegexSource.replaceCaptures(this._name, lineText, captureIndices);\n };\n Rule.prototype.getContentName = function (lineText, captureIndices) {\n if (!this._contentNameIsCapturing || this._contentName === null) {\n return this._contentName;\n }\n return utils_1.RegexSource.replaceCaptures(this._contentName, lineText, captureIndices);\n };\n return Rule;\n}());\nexports.Rule = Rule;\nvar CaptureRule = /** @class */ (function (_super) {\n __extends(CaptureRule, _super);\n function CaptureRule($location, id, name, contentName, retokenizeCapturedWithRuleId) {\n var _this = _super.call(this, $location, id, name, contentName) || this;\n _this.retokenizeCapturedWithRuleId = retokenizeCapturedWithRuleId;\n return _this;\n }\n CaptureRule.prototype.dispose = function () {\n // nothing to dispose\n };\n CaptureRule.prototype.collectPatternsRecursive = function (grammar, out, isFirst) {\n throw new Error('Not supported!');\n };\n CaptureRule.prototype.compile = function (grammar, endRegexSource) {\n throw new Error('Not supported!');\n };\n return CaptureRule;\n}(Rule));\nexports.CaptureRule = CaptureRule;\nvar RegExpSource = /** @class */ (function () {\n function RegExpSource(regExpSource, ruleId, handleAnchors) {\n if (handleAnchors === void 0) { handleAnchors = true; }\n if (handleAnchors) {\n if (regExpSource) {\n var len = regExpSource.length;\n var lastPushedPos = 0;\n var output = [];\n for (var pos = 0; pos < len; pos++) {\n var ch = regExpSource.charAt(pos);\n if (ch === '\\\\') {\n if (pos + 1 < len) {\n var nextCh = regExpSource.charAt(pos + 1);\n if (nextCh === 'z') {\n output.push(regExpSource.substring(lastPushedPos, pos));\n output.push('$(?!\\\\n)(? ' + this.source + ', ' + this.hasAnchor);\n }\n RegExpSource.prototype.clone = function () {\n return new RegExpSource(this.source, this.ruleId, true);\n };\n RegExpSource.prototype.setSource = function (newSource) {\n if (this.source === newSource) {\n return;\n }\n this.source = newSource;\n };\n RegExpSource.prototype.resolveBackReferences = function (lineText, captureIndices) {\n var capturedValues = captureIndices.map(function (capture) {\n return lineText.substring(capture.start, capture.end);\n });\n BACK_REFERENCING_END.lastIndex = 0;\n return this.source.replace(BACK_REFERENCING_END, function (match, g1) {\n return escapeRegExpCharacters(capturedValues[parseInt(g1, 10)] || '');\n });\n };\n return RegExpSource;\n}());\nexports.RegExpSource = RegExpSource;\nvar RegExpSourceList = /** @class */ (function () {\n function RegExpSourceList() {\n this._items = [];\n this._cached = null;\n }\n RegExpSourceList.prototype.dispose = function () {\n this._disposeCaches();\n };\n RegExpSourceList.prototype._disposeCaches = function () {\n if (this._cached) {\n this._cached.dispose();\n this._cached = null;\n }\n };\n RegExpSourceList.prototype.push = function (item) {\n this._items.push(item);\n };\n RegExpSourceList.prototype.unshift = function (item) {\n this._items.unshift(item);\n };\n RegExpSourceList.prototype.length = function () {\n return this._items.length;\n };\n RegExpSourceList.prototype.setSource = function (index, newSource) {\n if (this._items[index].source !== newSource) {\n // bust the cache\n this._disposeCaches();\n this._items[index].setSource(newSource);\n }\n };\n RegExpSourceList.prototype.compile = function (onigLib) {\n if (!this._cached) {\n var regExps = this._items.map(function (e) { return e.source; });\n this._cached = new CompiledRule(onigLib, regExps, this._items.map(function (e) { return e.ruleId; }));\n }\n return this._cached;\n };\n return RegExpSourceList;\n}());\nexports.RegExpSourceList = RegExpSourceList;\nvar MatchRule = /** @class */ (function (_super) {\n __extends(MatchRule, _super);\n function MatchRule($location, id, name, match, captures) {\n var _this = _super.call(this, $location, id, name, null) || this;\n _this._match = new RegExpSource(match, _this.id);\n _this.captures = captures;\n _this._cachedCompiledPatterns = null;\n return _this;\n }\n MatchRule.prototype.dispose = function () {\n if (this._cachedCompiledPatterns) {\n this._cachedCompiledPatterns.dispose();\n this._cachedCompiledPatterns = null;\n }\n };\n Object.defineProperty(MatchRule.prototype, \"debugMatchRegExp\", {\n get: function () {\n return \"\" + this._match.source;\n },\n enumerable: false,\n configurable: true\n });\n MatchRule.prototype.collectPatternsRecursive = function (grammar, out, isFirst) {\n out.push(this._match);\n };\n MatchRule.prototype.compile = function (grammar, endRegexSource) {\n if (!this._cachedCompiledPatterns) {\n this._cachedCompiledPatterns = new RegExpSourceList();\n this.collectPatternsRecursive(grammar, this._cachedCompiledPatterns, true);\n }\n return this._cachedCompiledPatterns.compile(grammar);\n };\n return MatchRule;\n}(Rule));\nexports.MatchRule = MatchRule;\nvar IncludeOnlyRule = /** @class */ (function (_super) {\n __extends(IncludeOnlyRule, _super);\n function IncludeOnlyRule($location, id, name, contentName, patterns) {\n var _this = _super.call(this, $location, id, name, contentName) || this;\n _this.patterns = patterns.patterns;\n _this.hasMissingPatterns = patterns.hasMissingPatterns;\n _this._cachedCompiledPatterns = null;\n return _this;\n }\n IncludeOnlyRule.prototype.dispose = function () {\n if (this._cachedCompiledPatterns) {\n this._cachedCompiledPatterns.dispose();\n this._cachedCompiledPatterns = null;\n }\n };\n IncludeOnlyRule.prototype.collectPatternsRecursive = function (grammar, out, isFirst) {\n var i, len, rule;\n for (i = 0, len = this.patterns.length; i < len; i++) {\n rule = grammar.getRule(this.patterns[i]);\n rule.collectPatternsRecursive(grammar, out, false);\n }\n };\n IncludeOnlyRule.prototype.compile = function (grammar, endRegexSource) {\n if (!this._cachedCompiledPatterns) {\n this._cachedCompiledPatterns = new RegExpSourceList();\n this.collectPatternsRecursive(grammar, this._cachedCompiledPatterns, true);\n }\n return this._cachedCompiledPatterns.compile(grammar);\n };\n return IncludeOnlyRule;\n}(Rule));\nexports.IncludeOnlyRule = IncludeOnlyRule;\nfunction escapeRegExpCharacters(value) {\n return value.replace(/[\\-\\\\\\{\\}\\*\\+\\?\\|\\^\\$\\.\\,\\[\\]\\(\\)\\#\\s]/g, '\\\\$&');\n}\nvar BeginEndRule = /** @class */ (function (_super) {\n __extends(BeginEndRule, _super);\n function BeginEndRule($location, id, name, contentName, begin, beginCaptures, end, endCaptures, applyEndPatternLast, patterns) {\n var _this = _super.call(this, $location, id, name, contentName) || this;\n _this._begin = new RegExpSource(begin, _this.id);\n _this.beginCaptures = beginCaptures;\n _this._end = new RegExpSource(end ? end : '\\uFFFF', -1);\n _this.endHasBackReferences = _this._end.hasBackReferences;\n _this.endCaptures = endCaptures;\n _this.applyEndPatternLast = applyEndPatternLast || false;\n _this.patterns = patterns.patterns;\n _this.hasMissingPatterns = patterns.hasMissingPatterns;\n _this._cachedCompiledPatterns = null;\n return _this;\n }\n BeginEndRule.prototype.dispose = function () {\n if (this._cachedCompiledPatterns) {\n this._cachedCompiledPatterns.dispose();\n this._cachedCompiledPatterns = null;\n }\n };\n Object.defineProperty(BeginEndRule.prototype, \"debugBeginRegExp\", {\n get: function () {\n return \"\" + this._begin.source;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BeginEndRule.prototype, \"debugEndRegExp\", {\n get: function () {\n return \"\" + this._end.source;\n },\n enumerable: false,\n configurable: true\n });\n BeginEndRule.prototype.getEndWithResolvedBackReferences = function (lineText, captureIndices) {\n return this._end.resolveBackReferences(lineText, captureIndices);\n };\n BeginEndRule.prototype.collectPatternsRecursive = function (grammar, out, isFirst) {\n if (isFirst) {\n var i = void 0, len = void 0, rule = void 0;\n for (i = 0, len = this.patterns.length; i < len; i++) {\n rule = grammar.getRule(this.patterns[i]);\n rule.collectPatternsRecursive(grammar, out, false);\n }\n }\n else {\n out.push(this._begin);\n }\n };\n BeginEndRule.prototype.compile = function (grammar, endRegexSource) {\n if (!this._cachedCompiledPatterns) {\n this._cachedCompiledPatterns = new RegExpSourceList();\n this.collectPatternsRecursive(grammar, this._cachedCompiledPatterns, true);\n if (this.applyEndPatternLast) {\n this._cachedCompiledPatterns.push(this._end.hasBackReferences ? this._end.clone() : this._end);\n }\n else {\n this._cachedCompiledPatterns.unshift(this._end.hasBackReferences ? this._end.clone() : this._end);\n }\n }\n if (this._end.hasBackReferences) {\n if (this.applyEndPatternLast) {\n this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length() - 1, endRegexSource);\n }\n else {\n this._cachedCompiledPatterns.setSource(0, endRegexSource);\n }\n }\n return this._cachedCompiledPatterns.compile(grammar);\n };\n return BeginEndRule;\n}(Rule));\nexports.BeginEndRule = BeginEndRule;\nvar BeginWhileRule = /** @class */ (function (_super) {\n __extends(BeginWhileRule, _super);\n function BeginWhileRule($location, id, name, contentName, begin, beginCaptures, _while, whileCaptures, patterns) {\n var _this = _super.call(this, $location, id, name, contentName) || this;\n _this._begin = new RegExpSource(begin, _this.id);\n _this.beginCaptures = beginCaptures;\n _this.whileCaptures = whileCaptures;\n _this._while = new RegExpSource(_while, -2);\n _this.whileHasBackReferences = _this._while.hasBackReferences;\n _this.patterns = patterns.patterns;\n _this.hasMissingPatterns = patterns.hasMissingPatterns;\n _this._cachedCompiledPatterns = null;\n _this._cachedCompiledWhilePatterns = null;\n return _this;\n }\n BeginWhileRule.prototype.dispose = function () {\n if (this._cachedCompiledPatterns) {\n this._cachedCompiledPatterns.dispose();\n this._cachedCompiledPatterns = null;\n }\n if (this._cachedCompiledWhilePatterns) {\n this._cachedCompiledWhilePatterns.dispose();\n this._cachedCompiledWhilePatterns = null;\n }\n };\n Object.defineProperty(BeginWhileRule.prototype, \"debugBeginRegExp\", {\n get: function () {\n return \"\" + this._begin.source;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BeginWhileRule.prototype, \"debugWhileRegExp\", {\n get: function () {\n return \"\" + this._while.source;\n },\n enumerable: false,\n configurable: true\n });\n BeginWhileRule.prototype.getWhileWithResolvedBackReferences = function (lineText, captureIndices) {\n return this._while.resolveBackReferences(lineText, captureIndices);\n };\n BeginWhileRule.prototype.collectPatternsRecursive = function (grammar, out, isFirst) {\n if (isFirst) {\n var i = void 0, len = void 0, rule = void 0;\n for (i = 0, len = this.patterns.length; i < len; i++) {\n rule = grammar.getRule(this.patterns[i]);\n rule.collectPatternsRecursive(grammar, out, false);\n }\n }\n else {\n out.push(this._begin);\n }\n };\n BeginWhileRule.prototype.compile = function (grammar, endRegexSource) {\n if (!this._cachedCompiledPatterns) {\n this._cachedCompiledPatterns = new RegExpSourceList();\n this.collectPatternsRecursive(grammar, this._cachedCompiledPatterns, true);\n }\n return this._cachedCompiledPatterns.compile(grammar);\n };\n BeginWhileRule.prototype.compileWhile = function (grammar, endRegexSource) {\n if (!this._cachedCompiledWhilePatterns) {\n this._cachedCompiledWhilePatterns = new RegExpSourceList();\n this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences ? this._while.clone() : this._while);\n }\n if (this._while.hasBackReferences) {\n this._cachedCompiledWhilePatterns.setSource(0, endRegexSource ? endRegexSource : '\\uFFFF');\n }\n return this._cachedCompiledWhilePatterns.compile(grammar);\n };\n return BeginWhileRule;\n}(Rule));\nexports.BeginWhileRule = BeginWhileRule;\nvar RuleFactory = /** @class */ (function () {\n function RuleFactory() {\n }\n RuleFactory.createCaptureRule = function (helper, $location, name, contentName, retokenizeCapturedWithRuleId) {\n return helper.registerRule(function (id) {\n return new CaptureRule($location, id, name, contentName, retokenizeCapturedWithRuleId);\n });\n };\n RuleFactory.getCompiledRuleId = function (desc, helper, repository) {\n if (!desc.id) {\n helper.registerRule(function (id) {\n desc.id = id;\n if (desc.match) {\n return new MatchRule(desc.$vscodeTextmateLocation, desc.id, desc.name, desc.match, RuleFactory._compileCaptures(desc.captures, helper, repository));\n }\n if (typeof desc.begin === 'undefined') {\n if (desc.repository) {\n repository = utils_1.mergeObjects({}, repository, desc.repository);\n }\n var patterns = desc.patterns;\n if (typeof patterns === 'undefined' && desc.include) {\n patterns = [{ include: desc.include }];\n }\n return new IncludeOnlyRule(desc.$vscodeTextmateLocation, desc.id, desc.name, desc.contentName, RuleFactory._compilePatterns(patterns, helper, repository));\n }\n if (desc.while) {\n return new BeginWhileRule(desc.$vscodeTextmateLocation, desc.id, desc.name, desc.contentName, desc.begin, RuleFactory._compileCaptures(desc.beginCaptures || desc.captures, helper, repository), desc.while, RuleFactory._compileCaptures(desc.whileCaptures || desc.captures, helper, repository), RuleFactory._compilePatterns(desc.patterns, helper, repository));\n }\n return new BeginEndRule(desc.$vscodeTextmateLocation, desc.id, desc.name, desc.contentName, desc.begin, RuleFactory._compileCaptures(desc.beginCaptures || desc.captures, helper, repository), desc.end, RuleFactory._compileCaptures(desc.endCaptures || desc.captures, helper, repository), desc.applyEndPatternLast, RuleFactory._compilePatterns(desc.patterns, helper, repository));\n });\n }\n return desc.id;\n };\n RuleFactory._compileCaptures = function (captures, helper, repository) {\n var r = [];\n if (captures) {\n // Find the maximum capture id\n var maximumCaptureId = 0;\n for (var captureId in captures) {\n if (captureId === '$vscodeTextmateLocation') {\n continue;\n }\n var numericCaptureId = parseInt(captureId, 10);\n if (numericCaptureId > maximumCaptureId) {\n maximumCaptureId = numericCaptureId;\n }\n }\n // Initialize result\n for (var i = 0; i <= maximumCaptureId; i++) {\n r[i] = null;\n }\n // Fill out result\n for (var captureId in captures) {\n if (captureId === '$vscodeTextmateLocation') {\n continue;\n }\n var numericCaptureId = parseInt(captureId, 10);\n var retokenizeCapturedWithRuleId = 0;\n if (captures[captureId].patterns) {\n retokenizeCapturedWithRuleId = RuleFactory.getCompiledRuleId(captures[captureId], helper, repository);\n }\n r[numericCaptureId] = RuleFactory.createCaptureRule(helper, captures[captureId].$vscodeTextmateLocation, captures[captureId].name, captures[captureId].contentName, retokenizeCapturedWithRuleId);\n }\n }\n return r;\n };\n RuleFactory._compilePatterns = function (patterns, helper, repository) {\n var r = [];\n if (patterns) {\n for (var i = 0, len = patterns.length; i < len; i++) {\n var pattern = patterns[i];\n var patternId = -1;\n if (pattern.include) {\n if (pattern.include.charAt(0) === '#') {\n // Local include found in `repository`\n var localIncludedRule = repository[pattern.include.substr(1)];\n if (localIncludedRule) {\n patternId = RuleFactory.getCompiledRuleId(localIncludedRule, helper, repository);\n }\n else {\n // console.warn('CANNOT find rule for scopeName: ' + pattern.include + ', I am: ', repository['$base'].name);\n }\n }\n else if (pattern.include === '$base' || pattern.include === '$self') {\n // Special include also found in `repository`\n patternId = RuleFactory.getCompiledRuleId(repository[pattern.include], helper, repository);\n }\n else {\n var externalGrammarName = null;\n var externalGrammarInclude = null;\n var sharpIndex = pattern.include.indexOf('#');\n if (sharpIndex >= 0) {\n externalGrammarName = pattern.include.substring(0, sharpIndex);\n externalGrammarInclude = pattern.include.substring(sharpIndex + 1);\n }\n else {\n externalGrammarName = pattern.include;\n }\n // External include\n var externalGrammar = helper.getExternalGrammar(externalGrammarName, repository);\n if (externalGrammar) {\n if (externalGrammarInclude) {\n var externalIncludedRule = externalGrammar.repository[externalGrammarInclude];\n if (externalIncludedRule) {\n patternId = RuleFactory.getCompiledRuleId(externalIncludedRule, helper, externalGrammar.repository);\n }\n else {\n // console.warn('CANNOT find rule for scopeName: ' + pattern.include + ', I am: ', repository['$base'].name);\n }\n }\n else {\n patternId = RuleFactory.getCompiledRuleId(externalGrammar.repository.$self, helper, externalGrammar.repository);\n }\n }\n else {\n // console.warn('CANNOT find grammar for scopeName: ' + pattern.include + ', I am: ', repository['$base'].name);\n }\n }\n }\n else {\n patternId = RuleFactory.getCompiledRuleId(pattern, helper, repository);\n }\n if (patternId !== -1) {\n var rule = helper.getRule(patternId);\n var skipRule = false;\n if (rule instanceof IncludeOnlyRule || rule instanceof BeginEndRule || rule instanceof BeginWhileRule) {\n if (rule.hasMissingPatterns && rule.patterns.length === 0) {\n skipRule = true;\n }\n }\n if (skipRule) {\n // console.log('REMOVING RULE ENTIRELY DUE TO EMPTY PATTERNS THAT ARE MISSING');\n continue;\n }\n r.push(patternId);\n }\n }\n }\n return {\n patterns: r,\n hasMissingPatterns: ((patterns ? patterns.length : 0) !== r.length)\n };\n };\n return RuleFactory;\n}());\nexports.RuleFactory = RuleFactory;\n//# sourceMappingURL=rule.js.map","\"use strict\";\n/*---------------------------------------------------------\n * Copyright (C) Microsoft Corporation. All rights reserved.\n *--------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ThemeTrieElement = exports.ThemeTrieElementRule = exports.strArrCmp = exports.strcmp = exports.Theme = exports.ColorMap = exports.parseTheme = exports.ParsedThemeRule = void 0;\nvar ParsedThemeRule = /** @class */ (function () {\n function ParsedThemeRule(scope, parentScopes, index, fontStyle, foreground, background) {\n this.scope = scope;\n this.parentScopes = parentScopes;\n this.index = index;\n this.fontStyle = fontStyle;\n this.foreground = foreground;\n this.background = background;\n }\n return ParsedThemeRule;\n}());\nexports.ParsedThemeRule = ParsedThemeRule;\nfunction isValidHexColor(hex) {\n if (/^#[0-9a-f]{6}$/i.test(hex)) {\n // #rrggbb\n return true;\n }\n if (/^#[0-9a-f]{8}$/i.test(hex)) {\n // #rrggbbaa\n return true;\n }\n if (/^#[0-9a-f]{3}$/i.test(hex)) {\n // #rgb\n return true;\n }\n if (/^#[0-9a-f]{4}$/i.test(hex)) {\n // #rgba\n return true;\n }\n return false;\n}\n/**\n * Parse a raw theme into rules.\n */\nfunction parseTheme(source) {\n if (!source) {\n return [];\n }\n if (!source.settings || !Array.isArray(source.settings)) {\n return [];\n }\n var settings = source.settings;\n var result = [], resultLen = 0;\n for (var i = 0, len = settings.length; i < len; i++) {\n var entry = settings[i];\n if (!entry.settings) {\n continue;\n }\n var scopes = void 0;\n if (typeof entry.scope === 'string') {\n var _scope = entry.scope;\n // remove leading commas\n _scope = _scope.replace(/^[,]+/, '');\n // remove trailing commans\n _scope = _scope.replace(/[,]+$/, '');\n scopes = _scope.split(',');\n }\n else if (Array.isArray(entry.scope)) {\n scopes = entry.scope;\n }\n else {\n scopes = [''];\n }\n var fontStyle = -1 /* NotSet */;\n if (typeof entry.settings.fontStyle === 'string') {\n fontStyle = 0 /* None */;\n var segments = entry.settings.fontStyle.split(' ');\n for (var j = 0, lenJ = segments.length; j < lenJ; j++) {\n var segment = segments[j];\n switch (segment) {\n case 'italic':\n fontStyle = fontStyle | 1 /* Italic */;\n break;\n case 'bold':\n fontStyle = fontStyle | 2 /* Bold */;\n break;\n case 'underline':\n fontStyle = fontStyle | 4 /* Underline */;\n break;\n }\n }\n }\n var foreground = null;\n if (typeof entry.settings.foreground === 'string' && isValidHexColor(entry.settings.foreground)) {\n foreground = entry.settings.foreground;\n }\n var background = null;\n if (typeof entry.settings.background === 'string' && isValidHexColor(entry.settings.background)) {\n background = entry.settings.background;\n }\n for (var j = 0, lenJ = scopes.length; j < lenJ; j++) {\n var _scope = scopes[j].trim();\n var segments = _scope.split(' ');\n var scope = segments[segments.length - 1];\n var parentScopes = null;\n if (segments.length > 1) {\n parentScopes = segments.slice(0, segments.length - 1);\n parentScopes.reverse();\n }\n result[resultLen++] = new ParsedThemeRule(scope, parentScopes, i, fontStyle, foreground, background);\n }\n }\n return result;\n}\nexports.parseTheme = parseTheme;\n/**\n * Resolve rules (i.e. inheritance).\n */\nfunction resolveParsedThemeRules(parsedThemeRules, _colorMap) {\n // Sort rules lexicographically, and then by index if necessary\n parsedThemeRules.sort(function (a, b) {\n var r = strcmp(a.scope, b.scope);\n if (r !== 0) {\n return r;\n }\n r = strArrCmp(a.parentScopes, b.parentScopes);\n if (r !== 0) {\n return r;\n }\n return a.index - b.index;\n });\n // Determine defaults\n var defaultFontStyle = 0 /* None */;\n var defaultForeground = '#000000';\n var defaultBackground = '#ffffff';\n while (parsedThemeRules.length >= 1 && parsedThemeRules[0].scope === '') {\n var incomingDefaults = parsedThemeRules.shift();\n if (incomingDefaults.fontStyle !== -1 /* NotSet */) {\n defaultFontStyle = incomingDefaults.fontStyle;\n }\n if (incomingDefaults.foreground !== null) {\n defaultForeground = incomingDefaults.foreground;\n }\n if (incomingDefaults.background !== null) {\n defaultBackground = incomingDefaults.background;\n }\n }\n var colorMap = new ColorMap(_colorMap);\n var defaults = new ThemeTrieElementRule(0, null, defaultFontStyle, colorMap.getId(defaultForeground), colorMap.getId(defaultBackground));\n var root = new ThemeTrieElement(new ThemeTrieElementRule(0, null, -1 /* NotSet */, 0, 0), []);\n for (var i = 0, len = parsedThemeRules.length; i < len; i++) {\n var rule = parsedThemeRules[i];\n root.insert(0, rule.scope, rule.parentScopes, rule.fontStyle, colorMap.getId(rule.foreground), colorMap.getId(rule.background));\n }\n return new Theme(colorMap, defaults, root);\n}\nvar ColorMap = /** @class */ (function () {\n function ColorMap(_colorMap) {\n this._lastColorId = 0;\n this._id2color = [];\n this._color2id = Object.create(null);\n if (Array.isArray(_colorMap)) {\n this._isFrozen = true;\n for (var i = 0, len = _colorMap.length; i < len; i++) {\n this._color2id[_colorMap[i]] = i;\n this._id2color[i] = _colorMap[i];\n }\n }\n else {\n this._isFrozen = false;\n }\n }\n ColorMap.prototype.getId = function (color) {\n if (color === null) {\n return 0;\n }\n color = color.toUpperCase();\n var value = this._color2id[color];\n if (value) {\n return value;\n }\n if (this._isFrozen) {\n throw new Error(\"Missing color in color map - \" + color);\n }\n value = ++this._lastColorId;\n this._color2id[color] = value;\n this._id2color[value] = color;\n return value;\n };\n ColorMap.prototype.getColorMap = function () {\n return this._id2color.slice(0);\n };\n return ColorMap;\n}());\nexports.ColorMap = ColorMap;\nvar Theme = /** @class */ (function () {\n function Theme(colorMap, defaults, root) {\n this._colorMap = colorMap;\n this._root = root;\n this._defaults = defaults;\n this._cache = {};\n }\n Theme.createFromRawTheme = function (source, colorMap) {\n return this.createFromParsedTheme(parseTheme(source), colorMap);\n };\n Theme.createFromParsedTheme = function (source, colorMap) {\n return resolveParsedThemeRules(source, colorMap);\n };\n Theme.prototype.getColorMap = function () {\n return this._colorMap.getColorMap();\n };\n Theme.prototype.getDefaults = function () {\n return this._defaults;\n };\n Theme.prototype.match = function (scopeName) {\n if (!this._cache.hasOwnProperty(scopeName)) {\n this._cache[scopeName] = this._root.match(scopeName);\n }\n return this._cache[scopeName];\n };\n return Theme;\n}());\nexports.Theme = Theme;\nfunction strcmp(a, b) {\n if (a < b) {\n return -1;\n }\n if (a > b) {\n return 1;\n }\n return 0;\n}\nexports.strcmp = strcmp;\nfunction strArrCmp(a, b) {\n if (a === null && b === null) {\n return 0;\n }\n if (!a) {\n return -1;\n }\n if (!b) {\n return 1;\n }\n var len1 = a.length;\n var len2 = b.length;\n if (len1 === len2) {\n for (var i = 0; i < len1; i++) {\n var res = strcmp(a[i], b[i]);\n if (res !== 0) {\n return res;\n }\n }\n return 0;\n }\n return len1 - len2;\n}\nexports.strArrCmp = strArrCmp;\nvar ThemeTrieElementRule = /** @class */ (function () {\n function ThemeTrieElementRule(scopeDepth, parentScopes, fontStyle, foreground, background) {\n this.scopeDepth = scopeDepth;\n this.parentScopes = parentScopes;\n this.fontStyle = fontStyle;\n this.foreground = foreground;\n this.background = background;\n }\n ThemeTrieElementRule.prototype.clone = function () {\n return new ThemeTrieElementRule(this.scopeDepth, this.parentScopes, this.fontStyle, this.foreground, this.background);\n };\n ThemeTrieElementRule.cloneArr = function (arr) {\n var r = [];\n for (var i = 0, len = arr.length; i < len; i++) {\n r[i] = arr[i].clone();\n }\n return r;\n };\n ThemeTrieElementRule.prototype.acceptOverwrite = function (scopeDepth, fontStyle, foreground, background) {\n if (this.scopeDepth > scopeDepth) {\n console.log('how did this happen?');\n }\n else {\n this.scopeDepth = scopeDepth;\n }\n // console.log('TODO -> my depth: ' + this.scopeDepth + ', overwriting depth: ' + scopeDepth);\n if (fontStyle !== -1 /* NotSet */) {\n this.fontStyle = fontStyle;\n }\n if (foreground !== 0) {\n this.foreground = foreground;\n }\n if (background !== 0) {\n this.background = background;\n }\n };\n return ThemeTrieElementRule;\n}());\nexports.ThemeTrieElementRule = ThemeTrieElementRule;\nvar ThemeTrieElement = /** @class */ (function () {\n function ThemeTrieElement(mainRule, rulesWithParentScopes, children) {\n if (rulesWithParentScopes === void 0) { rulesWithParentScopes = []; }\n if (children === void 0) { children = {}; }\n this._mainRule = mainRule;\n this._rulesWithParentScopes = rulesWithParentScopes;\n this._children = children;\n }\n ThemeTrieElement._sortBySpecificity = function (arr) {\n if (arr.length === 1) {\n return arr;\n }\n arr.sort(this._cmpBySpecificity);\n return arr;\n };\n ThemeTrieElement._cmpBySpecificity = function (a, b) {\n if (a.scopeDepth === b.scopeDepth) {\n var aParentScopes = a.parentScopes;\n var bParentScopes = b.parentScopes;\n var aParentScopesLen = aParentScopes === null ? 0 : aParentScopes.length;\n var bParentScopesLen = bParentScopes === null ? 0 : bParentScopes.length;\n if (aParentScopesLen === bParentScopesLen) {\n for (var i = 0; i < aParentScopesLen; i++) {\n var aLen = aParentScopes[i].length;\n var bLen = bParentScopes[i].length;\n if (aLen !== bLen) {\n return bLen - aLen;\n }\n }\n }\n return bParentScopesLen - aParentScopesLen;\n }\n return b.scopeDepth - a.scopeDepth;\n };\n ThemeTrieElement.prototype.match = function (scope) {\n if (scope === '') {\n return ThemeTrieElement._sortBySpecificity([].concat(this._mainRule).concat(this._rulesWithParentScopes));\n }\n var dotIndex = scope.indexOf('.');\n var head;\n var tail;\n if (dotIndex === -1) {\n head = scope;\n tail = '';\n }\n else {\n head = scope.substring(0, dotIndex);\n tail = scope.substring(dotIndex + 1);\n }\n if (this._children.hasOwnProperty(head)) {\n return this._children[head].match(tail);\n }\n return ThemeTrieElement._sortBySpecificity([].concat(this._mainRule).concat(this._rulesWithParentScopes));\n };\n ThemeTrieElement.prototype.insert = function (scopeDepth, scope, parentScopes, fontStyle, foreground, background) {\n if (scope === '') {\n this._doInsertHere(scopeDepth, parentScopes, fontStyle, foreground, background);\n return;\n }\n var dotIndex = scope.indexOf('.');\n var head;\n var tail;\n if (dotIndex === -1) {\n head = scope;\n tail = '';\n }\n else {\n head = scope.substring(0, dotIndex);\n tail = scope.substring(dotIndex + 1);\n }\n var child;\n if (this._children.hasOwnProperty(head)) {\n child = this._children[head];\n }\n else {\n child = new ThemeTrieElement(this._mainRule.clone(), ThemeTrieElementRule.cloneArr(this._rulesWithParentScopes));\n this._children[head] = child;\n }\n child.insert(scopeDepth + 1, tail, parentScopes, fontStyle, foreground, background);\n };\n ThemeTrieElement.prototype._doInsertHere = function (scopeDepth, parentScopes, fontStyle, foreground, background) {\n if (parentScopes === null) {\n // Merge into the main rule\n this._mainRule.acceptOverwrite(scopeDepth, fontStyle, foreground, background);\n return;\n }\n // Try to merge into existing rule\n for (var i = 0, len = this._rulesWithParentScopes.length; i < len; i++) {\n var rule = this._rulesWithParentScopes[i];\n if (strArrCmp(rule.parentScopes, parentScopes) === 0) {\n // bingo! => we get to merge this into an existing one\n rule.acceptOverwrite(scopeDepth, fontStyle, foreground, background);\n return;\n }\n }\n // Must add a new rule\n // Inherit from main rule\n if (fontStyle === -1 /* NotSet */) {\n fontStyle = this._mainRule.fontStyle;\n }\n if (foreground === 0) {\n foreground = this._mainRule.foreground;\n }\n if (background === 0) {\n background = this._mainRule.background;\n }\n this._rulesWithParentScopes.push(new ThemeTrieElementRule(scopeDepth, parentScopes, fontStyle, foreground, background));\n };\n return ThemeTrieElement;\n}());\nexports.ThemeTrieElement = ThemeTrieElement;\n//# sourceMappingURL=theme.js.map","\"use strict\";\n/*---------------------------------------------------------\n * Copyright (C) Microsoft Corporation. All rights reserved.\n *--------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\n//# sourceMappingURL=types.js.map","\"use strict\";\n/*---------------------------------------------------------\n * Copyright (C) Microsoft Corporation. All rights reserved.\n *--------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.RegexSource = exports.basename = exports.mergeObjects = exports.clone = void 0;\nfunction clone(something) {\n return doClone(something);\n}\nexports.clone = clone;\nfunction doClone(something) {\n if (Array.isArray(something)) {\n return cloneArray(something);\n }\n if (typeof something === 'object') {\n return cloneObj(something);\n }\n return something;\n}\nfunction cloneArray(arr) {\n var r = [];\n for (var i = 0, len = arr.length; i < len; i++) {\n r[i] = doClone(arr[i]);\n }\n return r;\n}\nfunction cloneObj(obj) {\n var r = {};\n for (var key in obj) {\n r[key] = doClone(obj[key]);\n }\n return r;\n}\nfunction mergeObjects(target) {\n var sources = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n sources[_i - 1] = arguments[_i];\n }\n sources.forEach(function (source) {\n for (var key in source) {\n target[key] = source[key];\n }\n });\n return target;\n}\nexports.mergeObjects = mergeObjects;\nfunction basename(path) {\n var idx = ~path.lastIndexOf('/') || ~path.lastIndexOf('\\\\');\n if (idx === 0) {\n return path;\n }\n else if (~idx === path.length - 1) {\n return basename(path.substring(0, path.length - 1));\n }\n else {\n return path.substr(~idx + 1);\n }\n}\nexports.basename = basename;\nvar CAPTURING_REGEX_SOURCE = /\\$(\\d+)|\\${(\\d+):\\/(downcase|upcase)}/g;\nvar RegexSource = /** @class */ (function () {\n function RegexSource() {\n }\n RegexSource.hasCaptures = function (regexSource) {\n if (regexSource === null) {\n return false;\n }\n CAPTURING_REGEX_SOURCE.lastIndex = 0;\n return CAPTURING_REGEX_SOURCE.test(regexSource);\n };\n RegexSource.replaceCaptures = function (regexSource, captureSource, captureIndices) {\n return regexSource.replace(CAPTURING_REGEX_SOURCE, function (match, index, commandIndex, command) {\n var capture = captureIndices[parseInt(index || commandIndex, 10)];\n if (capture) {\n var result = captureSource.substring(capture.start, capture.end);\n // Remove leading dots that would make the selector invalid\n while (result[0] === '.') {\n result = result.substring(1);\n }\n switch (command) {\n case 'downcase':\n return result.toLowerCase();\n case 'upcase':\n return result.toUpperCase();\n default:\n return result;\n }\n }\n else {\n return match;\n }\n });\n };\n return RegexSource;\n}());\nexports.RegexSource = RegexSource;\n//# sourceMappingURL=utils.js.map","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// module exports must be returned from runtime so entry inlining is disabled\n// startup\n// Load entry module and return exports\nreturn __webpack_require__(787);\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://vscodetextmate/webpack/universalModuleDefinition","webpack://vscodetextmate/./out/debug.js","webpack://vscodetextmate/./out/grammar.js","webpack://vscodetextmate/./out/grammarReader.js","webpack://vscodetextmate/./out/json.js","webpack://vscodetextmate/./out/main.js","webpack://vscodetextmate/./out/matcher.js","webpack://vscodetextmate/./out/plist.js","webpack://vscodetextmate/./out/registry.js","webpack://vscodetextmate/./out/rule.js","webpack://vscodetextmate/./out/theme.js","webpack://vscodetextmate/./out/types.js","webpack://vscodetextmate/./out/utils.js","webpack://vscodetextmate/webpack/bootstrap","webpack://vscodetextmate/webpack/startup"],"names":["root","factory","exports","module","define","amd","this","Object","defineProperty","value","UseOnigurumaFindOptions","DebugFlags","InDebugMode","process","env","LocalStackElement","StackElement","ScopeListElement","StackElementMetadata","Grammar","ScopeMetadata","collectDependencies","collectSpecificDependencies","ScopeDependencyCollector","PartialScopeDependency","FullScopeDependency","createGrammar","utils_1","rule_1","matcher_1","debug_1","performanceNow","performance","Date","now","grammar","initialLanguage","embeddedLanguages","tokenTypes","grammarRepository","onigLib","scopeName","include","prototype","toKey","full","partial","visitedRule","Set","_seenFull","_seenPartial","add","dep","has","push","_extractIncludedScopesInPatterns","result","baseGrammar","selfGrammar","patterns","repository","_i","patterns_1","length","pattern","patternRepository","mergeObjects","Array","isArray","charAt","substring","sharpIndex","indexOf","includedName","injections","injection","scopesAreMatching","thisScopeName","len","substr","nameMatcher","identifers","scopes","lastIndex","every","identifier","i","collectInjections","selector","rule","ruleFactoryHelper","matchers","createMatchers","ruleId","RuleFactory","getCompiledRuleId","matchers_1","matcher","priority","languageId","tokenType","themeData","ScopeMetadataProvider","themeProvider","_initialLanguage","_themeProvider","_cache","Map","_defaultMetaData","getDefaults","_embeddedLanguages","create","keys","scope","language","console","warn","escapedScopes","map","_escapeRegExpCharacters","_embeddedLanguagesRegex","sort","reverse","RegExp","join","onDidChangeTheme","getDefaultMetadata","replace","getMetadataForScope","_NULL_SCOPE_METADATA","get","_doGetMetadataForScope","set","_scopeToLanguage","standardTokenType","_toStandardTokenType","themeMatch","m","match","STANDARD_TOKEN_TYPE_REGEXP","Error","_scopeMetadataProvider","_onigLib","_rootId","_lastRuleId","_ruleId2desc","_includedGrammars","_grammarRepository","_grammar","initGrammar","_injections","_tokenTypeMatchers","_a","_b","matchers_2","type","dispose","createOnigScanner","sources","createOnigString","getInjections","_this","rawInjections","expression","injectionScopeNames","forEach","injectionScopeName","injectionGrammar","getExternalGrammar","injectionSelector","i1","i2","registerRule","id","getRule","patternId","rawIncludedGrammar","lookup","$base","tokenizeLine","lineText","prevState","r","_tokenize","tokens","lineTokens","getResult","ruleStack","lineLength","tokenizeLine2","getBinaryResult","emitBinaryTokens","isFirstLine","$self","NULL","reset","rawDefaultMetadata","defaultTheme","defaultMetadata","fontStyle","foreground","background","rootScopeName","getName","rawRootMetadata","rootMetadata","mergeMetadata","scopeList","onigLineText","content","LineTokens","nextState","_tokenizeString","disposeOnigString","str","base","clone","$vscodeTextmateLocation","name","handleCaptures","stack","captures","captureIndices","lineTextContent","Math","min","localStack","maxEnd","end","captureRule","captureIndex","start","endPos","produceFromScopes","pop","produce","retokenizeCapturedWithRuleId","nameScopesList","contentNameScopesList","contentName","getContentName","stackClone","onigSubStr","captureRuleScopeName","captureRuleScopesList","debugCompiledRuleToString","ruleScanner","rules","debugRegExps","getFindOptions","allowA","allowG","options","prepareRuleSearch","endRegexSource","compile","findOptions","compileAG","prepareRuleWhileSearch","compileWhile","compileWhileAG","linePos","checkWhileConditions","STOP","anchorPosition","whileCheckResult","beginRuleCapturedEOL","whileRules","node","nodeRule","BeginWhileRule","whileRule","endRule","scanner","findNextMatchSync","log","debugName","debugWhileRegExp","index","whileCaptures","_checkWhileConditions","scanNext","matchResult","perfStart","elapsedMillis","matchedRuleId","matchRule","injectionResult","bestMatchRuleId","bestMatchRating","Number","MAX_VALUE","bestMatchCaptureIndices","bestMatchResultPriority","generateScopes","matchRating","priorityMatch","matchInjections","matchResultScore","injectionResultScore","matchRuleOrInjections","hasAdvanced","poppedRule","debugEndRegExp","setContentNameScopesList","endCaptures","popped","getAnchorPos","getEnterPos","error","_rule","beforePush","BeginEndRule","pushedRule","debugBeginRegExp","beginCaptures","endHasBackReferences","setEndRule","getEndWithResolvedBackReferences","hasSameRuleAs","whileHasBackReferences","getWhileWithResolvedBackReferences","matchingRule","debugMatchRegExp","safePop","toBinaryStr","metadata","toString","printMetadata","getLanguageId","getTokenType","getFontStyle","getForeground","getBackground","_languageId","_tokenType","_fontStyle","_foreground","_background","parent","_equals","a","b","equals","other","_matchesScope","selectorWithDot","_matches","target","parentScopes","scopesList","source","_push","rawMetadata","split","_generateScopes","resultLen","enterPos","anchorPos","depth","_enterPos","_anchorPos","_structuralEquals","_reset","el","_writeString","res","outIndex","tokenTypeOverrides","_emitBinaryTokens","_tokenTypeOverrides","_lineText","_tokens","_binaryTokens","_lastTokenEndIndex","endIndex","toTemporaryType","k","startIndex","Uint32Array","standardType","parseRawGrammar","plist","json_1","filePath","test","contents","filename","parse","JSON","parseWithLocation","parsePLISTGrammar","doFail","streamState","msg","pos","withMetadata","JSONStreamState","token","JSONToken","state","cur","stateStack","objStack","pushState","popState","fail","nextJSONToken","toLocation","keyValue","parseFloat","newArr","newDict","line","char","offset","_state","_out","chCode","charCodeAt","_","m0","String","fromCodePoint","parseInt","__createBinding","o","k2","undefined","enumerable","__exportStar","p","hasOwnProperty","call","__awaiter","thisArg","_arguments","P","generator","Promise","resolve","reject","fulfilled","step","next","e","rejected","done","then","apply","__generator","body","f","y","t","g","label","sent","trys","ops","verb","Symbol","iterator","n","v","op","TypeError","INITIAL","Registry","registry_1","grammarReader","theme_1","grammar_1","_options","_syncRegistry","SyncRegistry","Theme","createFromRawTheme","theme","colorMap","_ensureGrammarCache","setTheme","getColorMap","loadGrammarWithEmbeddedLanguages","initialScopeName","loadGrammarWithConfiguration","configuration","_loadGrammar","loadGrammar","_doLoadSingleGrammar","addGrammar","_loadSingleGrammar","_collectDependenciesForDep","injections_1","seenFullScopeRequests","seenPartialScopeRequests","Q","q","deps","q_1","_c","_d","_e","all","request","grammarForScopeName","rawGrammar","isIdentifier","matchesName","input","regex","results","tokenizer","exec","parseConjunction","parseOperand","expressionToNegate_1","matcherInput","expressionInParents","some","parseInnerExpression","identifiers_1","_parse","locationKeyName","advancePosBy","by","advancePosTo","to","skipWhitespace","advanceIfStartsWith","advanceUntil","nextOccurence","captureUntil","curKey","newState","newCur","val","isClosed","dictState","leaveDict","leaveArray","acceptString","acceptReal","isNaN","acceptInteger","acceptDate","acceptData","acceptBool","parseTagValue","tag","peekChCode","trim","onigLibPromise","_theme","_grammars","_rawGrammars","_injectionGrammars","_onigLibPromise","targetScope","concat","extendStatics","__extends","d","setPrototypeOf","__proto__","__","constructor","IncludeOnlyRule","MatchRule","RegExpSourceList","RegExpSource","CaptureRule","Rule","CompiledRule","HAS_BACK_REFERENCES","BACK_REFERENCING_END","regExps","$location","_name","_nameIsCapturing","RegexSource","hasCaptures","_contentName","_contentNameIsCapturing","location","basename","configurable","replaceCaptures","_super","collectPatternsRecursive","out","isFirst","regExpSource","handleAnchors","lastPushedPos","output","hasAnchor","nextCh","_anchorCache","_buildAnchorCache","hasBackReferences","setSource","newSource","resolveBackReferences","capturedValues","capture","g1","ch","A0_G0_result","A0_G1_result","A1_G0_result","A1_G1_result","A0_G0","A0_G1","A1_G0","A1_G1","resolveAnchors","_items","_hasAnchors","_cached","_disposeCaches","item","unshift","_resolveAnchors","_match","_cachedCompiledPatterns","_getCachedCompiledPatterns","hasMissingPatterns","begin","applyEndPatternLast","_begin","_end","_while","_cachedCompiledWhilePatterns","_getCachedCompiledWhilePatterns","createCaptureRule","helper","desc","_compileCaptures","_compilePatterns","while","maximumCaptureId","captureId","numericCaptureId","localIncludedRule","externalGrammarName","externalGrammarInclude","externalGrammar","externalIncludedRule","skipRule","ThemeTrieElement","ThemeTrieElementRule","strArrCmp","strcmp","ColorMap","parseTheme","ParsedThemeRule","isValidHexColor","hex","settings","entry","j","lenJ","segments","slice","resolveParsedThemeRules","parsedThemeRules","_colorMap","defaultFontStyle","defaultForeground","defaultBackground","incomingDefaults","shift","defaults","getId","insert","_lastColorId","_id2color","_color2id","_isFrozen","color","toUpperCase","_root","_defaults","createFromParsedTheme","len1","len2","scopeDepth","cloneArr","arr","acceptOverwrite","mainRule","rulesWithParentScopes","children","_mainRule","_rulesWithParentScopes","_children","_sortBySpecificity","_cmpBySpecificity","aParentScopes","bParentScopes","aParentScopesLen","bParentScopesLen","aLen","bLen","head","tail","dotIndex","child","_doInsertHere","doClone","something","cloneArray","obj","key","cloneObj","arguments","path","idx","lastIndexOf","CAPTURING_REGEX_SOURCE","regexSource","captureSource","commandIndex","command","toLowerCase","__webpack_module_cache__","__webpack_require__","moduleId","__webpack_modules__"],"mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAwB,eAAID,IAE5BD,EAAqB,eAAIC,IAR3B,CASGK,MAAM,WACT,M,sCCNAC,OAAOC,eAAeN,EAAS,aAAc,CAAEO,OAAO,IACtDP,EAAQQ,wBAA0BR,EAAQS,gBAAa,EACvDT,EAAQS,WAAa,CACjBC,YAAiC,oBAAZC,WAA6BA,QAAQC,IAA2B,uBAEzFZ,EAAQQ,yBAA0B,G,cCLlCH,OAAOC,eAAeN,EAAS,aAAc,CAAEO,OAAO,IACtDP,EAAQa,kBAAoBb,EAAQc,aAAed,EAAQe,iBAAmBf,EAAQgB,qBAAuBhB,EAAQiB,QAAUjB,EAAQkB,cAAgBlB,EAAQmB,oBAAsBnB,EAAQoB,4BAA8BpB,EAAQqB,yBAA2BrB,EAAQsB,uBAAyBtB,EAAQuB,oBAAsBvB,EAAQwB,mBAAgB,EACrV,IAAIC,EAAU,EAAQ,KAClBC,EAAS,EAAQ,KACjBC,EAAY,EAAQ,KACpBC,EAAU,EAAQ,KAClBC,EAC2B,oBAAhBC,YAEA,WAAc,OAAOC,KAAKC,OAG1B,WAAc,OAAOF,YAAYE,OAMhDhC,EAAQwB,cAHR,SAAuBS,EAASC,EAAiBC,EAAmBC,EAAYC,EAAmBC,GAC/F,OAAO,IAAIrB,EAAQgB,EAASC,EAAiBC,EAAmBC,EAAYC,EAAmBC,IAGnG,IAAIf,EACA,SAA6BgB,GACzBnC,KAAKmC,UAAYA,GAIzBvC,EA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,OA9BAA,EAAYC,YAAc,SAAU4I,GAChC,OAAoB,OAAhBA,IAGJD,EAAuB7nB,UAAY,EAC5B6nB,EAAuB/U,KAAKgV,KAEvC7I,EAAYO,gBAAkB,SAAUsI,EAAaC,EAAepf,GAChE,OAAOmf,EAAYllB,QAAQilB,GAAwB,SAAUtkB,EAAO4I,EAAO6b,EAAcC,GACrF,IAAIvH,EAAU/X,EAAe0M,SAASlJ,GAAS6b,EAAc,KAC7D,IAAItH,EAgBA,OAAOnd,EAbP,IAFA,IAAIlF,EAAS0pB,EAAc5oB,UAAUuhB,EAAQtX,MAAOsX,EAAQzX,KAEvC,MAAd5K,EAAO,IACVA,EAASA,EAAOc,UAAU,GAE9B,OAAQ8oB,GACJ,IAAK,WACD,OAAO5pB,EAAO6pB,cAClB,IAAK,SACD,OAAO7pB,EAAOinB,cAClB,QACI,OAAOjnB,OAQpB4gB,EAjCqB,GAmChClkB,EAAQkkB,YAAcA,IC9FlBkJ,EAA2B,G,OAG/B,SAASC,EAAoBC,GAE5B,GAAGF,EAAyBE,GAC3B,OAAOF,EAAyBE,GAAUttB,QAG3C,IAAIC,EAASmtB,EAAyBE,GAAY,CAGjDttB,QAAS,IAOV,OAHAutB,EAAoBD,GAAUvS,KAAK9a,EAAOD,QAASC,EAAQA,EAAOD,QAASqtB,GAGpEptB,EAAOD,QCjBWqtB,CAAoB,M","file":"main.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"vscodetextmate\"] = factory();\n\telse\n\t\troot[\"vscodetextmate\"] = factory();\n})(this, function() {\nreturn ","\"use strict\";\n/*---------------------------------------------------------\n * Copyright (C) Microsoft Corporation. All rights reserved.\n *--------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.UseOnigurumaFindOptions = exports.DebugFlags = void 0;\nexports.DebugFlags = {\n InDebugMode: (typeof process !== 'undefined' && !!process.env['VSCODE_TEXTMATE_DEBUG'])\n};\nexports.UseOnigurumaFindOptions = false;\n//# sourceMappingURL=debug.js.map","\"use strict\";\n/*---------------------------------------------------------\n * Copyright (C) Microsoft Corporation. All rights reserved.\n *--------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.LocalStackElement = exports.StackElement = exports.ScopeListElement = exports.StackElementMetadata = exports.Grammar = exports.ScopeMetadata = exports.collectDependencies = exports.collectSpecificDependencies = exports.ScopeDependencyCollector = exports.PartialScopeDependency = exports.FullScopeDependency = exports.createGrammar = void 0;\nvar utils_1 = require(\"./utils\");\nvar rule_1 = require(\"./rule\");\nvar matcher_1 = require(\"./matcher\");\nvar debug_1 = require(\"./debug\");\nvar performanceNow = (function () {\n if (typeof performance === 'undefined') {\n // performance.now() is not available in this environment, so use Date.now()\n return function () { return Date.now(); };\n }\n else {\n return function () { return performance.now(); };\n }\n})();\nfunction createGrammar(grammar, initialLanguage, embeddedLanguages, tokenTypes, grammarRepository, onigLib) {\n return new Grammar(grammar, initialLanguage, embeddedLanguages, tokenTypes, grammarRepository, onigLib); //TODO\n}\nexports.createGrammar = createGrammar;\nvar FullScopeDependency = /** @class */ (function () {\n function FullScopeDependency(scopeName) {\n this.scopeName = scopeName;\n }\n return FullScopeDependency;\n}());\nexports.FullScopeDependency = FullScopeDependency;\nvar PartialScopeDependency = /** @class */ (function () {\n function PartialScopeDependency(scopeName, include) {\n this.scopeName = scopeName;\n this.include = include;\n }\n PartialScopeDependency.prototype.toKey = function () {\n return this.scopeName + \"#\" + this.include;\n };\n return PartialScopeDependency;\n}());\nexports.PartialScopeDependency = PartialScopeDependency;\nvar ScopeDependencyCollector = /** @class */ (function () {\n function ScopeDependencyCollector() {\n this.full = [];\n this.partial = [];\n this.visitedRule = new Set();\n this._seenFull = new Set();\n this._seenPartial = new Set();\n }\n ScopeDependencyCollector.prototype.add = function (dep) {\n if (dep instanceof FullScopeDependency) {\n if (!this._seenFull.has(dep.scopeName)) {\n this._seenFull.add(dep.scopeName);\n this.full.push(dep);\n }\n }\n else {\n if (!this._seenPartial.has(dep.toKey())) {\n this._seenPartial.add(dep.toKey());\n this.partial.push(dep);\n }\n }\n };\n return ScopeDependencyCollector;\n}());\nexports.ScopeDependencyCollector = ScopeDependencyCollector;\n/**\n * Fill in `result` all external included scopes in `patterns`\n */\nfunction _extractIncludedScopesInPatterns(result, baseGrammar, selfGrammar, patterns, repository) {\n for (var _i = 0, patterns_1 = patterns; _i < patterns_1.length; _i++) {\n var pattern = patterns_1[_i];\n if (result.visitedRule.has(pattern)) {\n continue;\n }\n result.visitedRule.add(pattern);\n var patternRepository = (pattern.repository ? utils_1.mergeObjects({}, repository, pattern.repository) : repository);\n if (Array.isArray(pattern.patterns)) {\n _extractIncludedScopesInPatterns(result, baseGrammar, selfGrammar, pattern.patterns, patternRepository);\n }\n var include = pattern.include;\n if (!include) {\n continue;\n }\n if (include === '$base' || include === baseGrammar.scopeName) {\n collectDependencies(result, baseGrammar, baseGrammar);\n }\n else if (include === '$self' || include === selfGrammar.scopeName) {\n collectDependencies(result, baseGrammar, selfGrammar);\n }\n else if (include.charAt(0) === '#') {\n collectSpecificDependencies(result, baseGrammar, selfGrammar, include.substring(1), patternRepository);\n }\n else {\n var sharpIndex = include.indexOf('#');\n if (sharpIndex >= 0) {\n var scopeName = include.substring(0, sharpIndex);\n var includedName = include.substring(sharpIndex + 1);\n if (scopeName === baseGrammar.scopeName) {\n collectSpecificDependencies(result, baseGrammar, baseGrammar, includedName, patternRepository);\n }\n else if (scopeName === selfGrammar.scopeName) {\n collectSpecificDependencies(result, baseGrammar, selfGrammar, includedName, patternRepository);\n }\n else {\n result.add(new PartialScopeDependency(scopeName, include.substring(sharpIndex + 1)));\n }\n }\n else {\n result.add(new FullScopeDependency(include));\n }\n }\n }\n}\n/**\n * Collect a specific dependency from the grammar's repository\n */\nfunction collectSpecificDependencies(result, baseGrammar, selfGrammar, include, repository) {\n if (repository === void 0) { repository = selfGrammar.repository; }\n if (repository && repository[include]) {\n var rule = repository[include];\n _extractIncludedScopesInPatterns(result, baseGrammar, selfGrammar, [rule], repository);\n }\n}\nexports.collectSpecificDependencies = collectSpecificDependencies;\n/**\n * Collects the list of all external included scopes in `grammar`.\n */\nfunction collectDependencies(result, baseGrammar, selfGrammar) {\n if (selfGrammar.patterns && Array.isArray(selfGrammar.patterns)) {\n _extractIncludedScopesInPatterns(result, baseGrammar, selfGrammar, selfGrammar.patterns, selfGrammar.repository);\n }\n if (selfGrammar.injections) {\n var injections = [];\n for (var injection in selfGrammar.injections) {\n injections.push(selfGrammar.injections[injection]);\n }\n _extractIncludedScopesInPatterns(result, baseGrammar, selfGrammar, injections, selfGrammar.repository);\n }\n}\nexports.collectDependencies = collectDependencies;\nfunction scopesAreMatching(thisScopeName, scopeName) {\n if (!thisScopeName) {\n return false;\n }\n if (thisScopeName === scopeName) {\n return true;\n }\n var len = scopeName.length;\n return thisScopeName.length > len && thisScopeName.substr(0, len) === scopeName && thisScopeName[len] === '.';\n}\nfunction nameMatcher(identifers, scopes) {\n if (scopes.length < identifers.length) {\n return false;\n }\n var lastIndex = 0;\n return identifers.every(function (identifier) {\n for (var i = lastIndex; i < scopes.length; i++) {\n if (scopesAreMatching(scopes[i], identifier)) {\n lastIndex = i + 1;\n return true;\n }\n }\n return false;\n });\n}\nfunction collectInjections(result, selector, rule, ruleFactoryHelper, grammar) {\n var matchers = matcher_1.createMatchers(selector, nameMatcher);\n var ruleId = rule_1.RuleFactory.getCompiledRuleId(rule, ruleFactoryHelper, grammar.repository);\n for (var _i = 0, matchers_1 = matchers; _i < matchers_1.length; _i++) {\n var matcher = matchers_1[_i];\n result.push({\n matcher: matcher.matcher,\n ruleId: ruleId,\n grammar: grammar,\n priority: matcher.priority\n });\n }\n}\nvar ScopeMetadata = /** @class */ (function () {\n function ScopeMetadata(scopeName, languageId, tokenType, themeData) {\n this.scopeName = scopeName;\n this.languageId = languageId;\n this.tokenType = tokenType;\n this.themeData = themeData;\n }\n return ScopeMetadata;\n}());\nexports.ScopeMetadata = ScopeMetadata;\nvar ScopeMetadataProvider = /** @class */ (function () {\n function ScopeMetadataProvider(initialLanguage, themeProvider, embeddedLanguages) {\n this._initialLanguage = initialLanguage;\n this._themeProvider = themeProvider;\n this._cache = new Map();\n this._defaultMetaData = new ScopeMetadata('', this._initialLanguage, 0 /* Other */, [this._themeProvider.getDefaults()]);\n // embeddedLanguages handling\n this._embeddedLanguages = Object.create(null);\n if (embeddedLanguages) {\n // If embeddedLanguages are configured, fill in `this._embeddedLanguages`\n var scopes = Object.keys(embeddedLanguages);\n for (var i = 0, len = scopes.length; i < len; i++) {\n var scope = scopes[i];\n var language = embeddedLanguages[scope];\n if (typeof language !== 'number' || language === 0) {\n console.warn('Invalid embedded language found at scope ' + scope + ': <<' + language + '>>');\n // never hurts to be too careful\n continue;\n }\n this._embeddedLanguages[scope] = language;\n }\n }\n // create the regex\n var escapedScopes = Object.keys(this._embeddedLanguages).map(function (scopeName) { return ScopeMetadataProvider._escapeRegExpCharacters(scopeName); });\n if (escapedScopes.length === 0) {\n // no scopes registered\n this._embeddedLanguagesRegex = null;\n }\n else {\n escapedScopes.sort();\n escapedScopes.reverse();\n this._embeddedLanguagesRegex = new RegExp(\"^((\" + escapedScopes.join(')|(') + \"))($|\\\\.)\", '');\n }\n }\n ScopeMetadataProvider.prototype.onDidChangeTheme = function () {\n this._cache = new Map();\n this._defaultMetaData = new ScopeMetadata('', this._initialLanguage, 0 /* Other */, [this._themeProvider.getDefaults()]);\n };\n ScopeMetadataProvider.prototype.getDefaultMetadata = function () {\n return this._defaultMetaData;\n };\n /**\n * Escapes regular expression characters in a given string\n */\n ScopeMetadataProvider._escapeRegExpCharacters = function (value) {\n return value.replace(/[\\-\\\\\\{\\}\\*\\+\\?\\|\\^\\$\\.\\,\\[\\]\\(\\)\\#\\s]/g, '\\\\$&');\n };\n ScopeMetadataProvider.prototype.getMetadataForScope = function (scopeName) {\n if (scopeName === null) {\n return ScopeMetadataProvider._NULL_SCOPE_METADATA;\n }\n var value = this._cache.get(scopeName);\n if (value) {\n return value;\n }\n value = this._doGetMetadataForScope(scopeName);\n this._cache.set(scopeName, value);\n return value;\n };\n ScopeMetadataProvider.prototype._doGetMetadataForScope = function (scopeName) {\n var languageId = this._scopeToLanguage(scopeName);\n var standardTokenType = this._toStandardTokenType(scopeName);\n var themeData = this._themeProvider.themeMatch(scopeName);\n return new ScopeMetadata(scopeName, languageId, standardTokenType, themeData);\n };\n /**\n * Given a produced TM scope, return the language that token describes or null if unknown.\n * e.g. source.html => html, source.css.embedded.html => css, punctuation.definition.tag.html => null\n */\n ScopeMetadataProvider.prototype._scopeToLanguage = function (scope) {\n if (!scope) {\n return 0;\n }\n if (!this._embeddedLanguagesRegex) {\n // no scopes registered\n return 0;\n }\n var m = scope.match(this._embeddedLanguagesRegex);\n if (!m) {\n // no scopes matched\n return 0;\n }\n var language = this._embeddedLanguages[m[1]] || 0;\n if (!language) {\n return 0;\n }\n return language;\n };\n ScopeMetadataProvider.prototype._toStandardTokenType = function (tokenType) {\n var m = tokenType.match(ScopeMetadataProvider.STANDARD_TOKEN_TYPE_REGEXP);\n if (!m) {\n return 0 /* Other */;\n }\n switch (m[1]) {\n case 'comment':\n return 1 /* Comment */;\n case 'string':\n return 2 /* String */;\n case 'regex':\n return 4 /* RegEx */;\n case 'meta.embedded':\n return 8 /* MetaEmbedded */;\n }\n throw new Error('Unexpected match for standard token type!');\n };\n ScopeMetadataProvider._NULL_SCOPE_METADATA = new ScopeMetadata('', 0, 0, null);\n ScopeMetadataProvider.STANDARD_TOKEN_TYPE_REGEXP = /\\b(comment|string|regex|meta\\.embedded)\\b/;\n return ScopeMetadataProvider;\n}());\nvar Grammar = /** @class */ (function () {\n function Grammar(grammar, initialLanguage, embeddedLanguages, tokenTypes, grammarRepository, onigLib) {\n this._scopeMetadataProvider = new ScopeMetadataProvider(initialLanguage, grammarRepository, embeddedLanguages);\n this._onigLib = onigLib;\n this._rootId = -1;\n this._lastRuleId = 0;\n this._ruleId2desc = [null];\n this._includedGrammars = {};\n this._grammarRepository = grammarRepository;\n this._grammar = initGrammar(grammar, null);\n this._injections = null;\n this._tokenTypeMatchers = [];\n if (tokenTypes) {\n for (var _i = 0, _a = Object.keys(tokenTypes); _i < _a.length; _i++) {\n var selector = _a[_i];\n var matchers = matcher_1.createMatchers(selector, nameMatcher);\n for (var _b = 0, matchers_2 = matchers; _b < matchers_2.length; _b++) {\n var matcher = matchers_2[_b];\n this._tokenTypeMatchers.push({\n matcher: matcher.matcher,\n type: tokenTypes[selector]\n });\n }\n }\n }\n }\n Grammar.prototype.dispose = function () {\n for (var _i = 0, _a = this._ruleId2desc; _i < _a.length; _i++) {\n var rule = _a[_i];\n if (rule) {\n rule.dispose();\n }\n }\n };\n Grammar.prototype.createOnigScanner = function (sources) {\n return this._onigLib.createOnigScanner(sources);\n };\n Grammar.prototype.createOnigString = function (sources) {\n return this._onigLib.createOnigString(sources);\n };\n Grammar.prototype.onDidChangeTheme = function () {\n this._scopeMetadataProvider.onDidChangeTheme();\n };\n Grammar.prototype.getMetadataForScope = function (scope) {\n return this._scopeMetadataProvider.getMetadataForScope(scope);\n };\n Grammar.prototype.getInjections = function () {\n var _this = this;\n if (this._injections === null) {\n this._injections = [];\n // add injections from the current grammar\n var rawInjections = this._grammar.injections;\n if (rawInjections) {\n for (var expression in rawInjections) {\n collectInjections(this._injections, expression, rawInjections[expression], this, this._grammar);\n }\n }\n // add injection grammars contributed for the current scope\n if (this._grammarRepository) {\n var injectionScopeNames = this._grammarRepository.injections(this._grammar.scopeName);\n if (injectionScopeNames) {\n injectionScopeNames.forEach(function (injectionScopeName) {\n var injectionGrammar = _this.getExternalGrammar(injectionScopeName);\n if (injectionGrammar) {\n var selector = injectionGrammar.injectionSelector;\n if (selector) {\n collectInjections(_this._injections, selector, injectionGrammar, _this, injectionGrammar);\n }\n }\n });\n }\n }\n this._injections.sort(function (i1, i2) { return i1.priority - i2.priority; }); // sort by priority\n }\n return this._injections;\n };\n Grammar.prototype.registerRule = function (factory) {\n var id = (++this._lastRuleId);\n var result = factory(id);\n this._ruleId2desc[id] = result;\n return result;\n };\n Grammar.prototype.getRule = function (patternId) {\n return this._ruleId2desc[patternId];\n };\n Grammar.prototype.getExternalGrammar = function (scopeName, repository) {\n if (this._includedGrammars[scopeName]) {\n return this._includedGrammars[scopeName];\n }\n else if (this._grammarRepository) {\n var rawIncludedGrammar = this._grammarRepository.lookup(scopeName);\n if (rawIncludedGrammar) {\n // console.log('LOADED GRAMMAR ' + pattern.include);\n this._includedGrammars[scopeName] = initGrammar(rawIncludedGrammar, repository && repository.$base);\n return this._includedGrammars[scopeName];\n }\n }\n return null;\n };\n Grammar.prototype.tokenizeLine = function (lineText, prevState) {\n var r = this._tokenize(lineText, prevState, false);\n return {\n tokens: r.lineTokens.getResult(r.ruleStack, r.lineLength),\n ruleStack: r.ruleStack\n };\n };\n Grammar.prototype.tokenizeLine2 = function (lineText, prevState) {\n var r = this._tokenize(lineText, prevState, true);\n return {\n tokens: r.lineTokens.getBinaryResult(r.ruleStack, r.lineLength),\n ruleStack: r.ruleStack\n };\n };\n Grammar.prototype._tokenize = function (lineText, prevState, emitBinaryTokens) {\n if (this._rootId === -1) {\n this._rootId = rule_1.RuleFactory.getCompiledRuleId(this._grammar.repository.$self, this, this._grammar.repository);\n }\n var isFirstLine;\n if (!prevState || prevState === StackElement.NULL) {\n isFirstLine = true;\n var rawDefaultMetadata = this._scopeMetadataProvider.getDefaultMetadata();\n var defaultTheme = rawDefaultMetadata.themeData[0];\n var defaultMetadata = StackElementMetadata.set(0, rawDefaultMetadata.languageId, rawDefaultMetadata.tokenType, defaultTheme.fontStyle, defaultTheme.foreground, defaultTheme.background);\n var rootScopeName = this.getRule(this._rootId).getName(null, null);\n var rawRootMetadata = this._scopeMetadataProvider.getMetadataForScope(rootScopeName);\n var rootMetadata = ScopeListElement.mergeMetadata(defaultMetadata, null, rawRootMetadata);\n var scopeList = new ScopeListElement(null, rootScopeName === null ? 'unknown' : rootScopeName, rootMetadata);\n prevState = new StackElement(null, this._rootId, -1, -1, false, null, scopeList, scopeList);\n }\n else {\n isFirstLine = false;\n prevState.reset();\n }\n lineText = lineText + '\\n';\n var onigLineText = this.createOnigString(lineText);\n var lineLength = onigLineText.content.length;\n var lineTokens = new LineTokens(emitBinaryTokens, lineText, this._tokenTypeMatchers);\n var nextState = _tokenizeString(this, onigLineText, isFirstLine, 0, prevState, lineTokens, true);\n disposeOnigString(onigLineText);\n return {\n lineLength: lineLength,\n lineTokens: lineTokens,\n ruleStack: nextState\n };\n };\n return Grammar;\n}());\nexports.Grammar = Grammar;\nfunction disposeOnigString(str) {\n if (typeof str.dispose === 'function') {\n str.dispose();\n }\n}\nfunction initGrammar(grammar, base) {\n grammar = utils_1.clone(grammar);\n grammar.repository = grammar.repository || {};\n grammar.repository.$self = {\n $vscodeTextmateLocation: grammar.$vscodeTextmateLocation,\n patterns: grammar.patterns,\n name: grammar.scopeName\n };\n grammar.repository.$base = base || grammar.repository.$self;\n return grammar;\n}\nfunction handleCaptures(grammar, lineText, isFirstLine, stack, lineTokens, captures, captureIndices) {\n if (captures.length === 0) {\n return;\n }\n var lineTextContent = lineText.content;\n var len = Math.min(captures.length, captureIndices.length);\n var localStack = [];\n var maxEnd = captureIndices[0].end;\n for (var i = 0; i < len; i++) {\n var captureRule = captures[i];\n if (captureRule === null) {\n // Not interested\n continue;\n }\n var captureIndex = captureIndices[i];\n if (captureIndex.length === 0) {\n // Nothing really captured\n continue;\n }\n if (captureIndex.start > maxEnd) {\n // Capture going beyond consumed string\n break;\n }\n // pop captures while needed\n while (localStack.length > 0 && localStack[localStack.length - 1].endPos <= captureIndex.start) {\n // pop!\n lineTokens.produceFromScopes(localStack[localStack.length - 1].scopes, localStack[localStack.length - 1].endPos);\n localStack.pop();\n }\n if (localStack.length > 0) {\n lineTokens.produceFromScopes(localStack[localStack.length - 1].scopes, captureIndex.start);\n }\n else {\n lineTokens.produce(stack, captureIndex.start);\n }\n if (captureRule.retokenizeCapturedWithRuleId) {\n // the capture requires additional matching\n var scopeName = captureRule.getName(lineTextContent, captureIndices);\n var nameScopesList = stack.contentNameScopesList.push(grammar, scopeName);\n var contentName = captureRule.getContentName(lineTextContent, captureIndices);\n var contentNameScopesList = nameScopesList.push(grammar, contentName);\n var stackClone = stack.push(captureRule.retokenizeCapturedWithRuleId, captureIndex.start, -1, false, null, nameScopesList, contentNameScopesList);\n var onigSubStr = grammar.createOnigString(lineTextContent.substring(0, captureIndex.end));\n _tokenizeString(grammar, onigSubStr, (isFirstLine && captureIndex.start === 0), captureIndex.start, stackClone, lineTokens, false);\n disposeOnigString(onigSubStr);\n continue;\n }\n var captureRuleScopeName = captureRule.getName(lineTextContent, captureIndices);\n if (captureRuleScopeName !== null) {\n // push\n var base = localStack.length > 0 ? localStack[localStack.length - 1].scopes : stack.contentNameScopesList;\n var captureRuleScopesList = base.push(grammar, captureRuleScopeName);\n localStack.push(new LocalStackElement(captureRuleScopesList, captureIndex.end));\n }\n }\n while (localStack.length > 0) {\n // pop!\n lineTokens.produceFromScopes(localStack[localStack.length - 1].scopes, localStack[localStack.length - 1].endPos);\n localStack.pop();\n }\n}\nfunction debugCompiledRuleToString(ruleScanner) {\n var r = [];\n for (var i = 0, len = ruleScanner.rules.length; i < len; i++) {\n r.push(' - ' + ruleScanner.rules[i] + ': ' + ruleScanner.debugRegExps[i]);\n }\n return r.join('\\n');\n}\nfunction getFindOptions(allowA, allowG) {\n var options = 0 /* None */;\n if (!allowA) {\n options |= 1 /* NotBeginString */;\n }\n if (!allowG) {\n options |= 4 /* NotBeginPosition */;\n }\n return options;\n}\nfunction prepareRuleSearch(rule, grammar, endRegexSource, allowA, allowG) {\n if (debug_1.UseOnigurumaFindOptions) {\n var ruleScanner_1 = rule.compile(grammar, endRegexSource);\n var findOptions = getFindOptions(allowA, allowG);\n return { ruleScanner: ruleScanner_1, findOptions: findOptions };\n }\n var ruleScanner = rule.compileAG(grammar, endRegexSource, allowA, allowG);\n return { ruleScanner: ruleScanner, findOptions: 0 /* None */ };\n}\nfunction prepareRuleWhileSearch(rule, grammar, endRegexSource, allowA, allowG) {\n if (debug_1.UseOnigurumaFindOptions) {\n var ruleScanner_2 = rule.compileWhile(grammar, endRegexSource);\n var findOptions = getFindOptions(allowA, allowG);\n return { ruleScanner: ruleScanner_2, findOptions: findOptions };\n }\n var ruleScanner = rule.compileWhileAG(grammar, endRegexSource, allowA, allowG);\n return { ruleScanner: ruleScanner, findOptions: 0 /* None */ };\n}\nfunction matchInjections(injections, grammar, lineText, isFirstLine, linePos, stack, anchorPosition) {\n // The lower the better\n var bestMatchRating = Number.MAX_VALUE;\n var bestMatchCaptureIndices = null;\n var bestMatchRuleId;\n var bestMatchResultPriority = 0;\n var scopes = stack.contentNameScopesList.generateScopes();\n for (var i = 0, len = injections.length; i < len; i++) {\n var injection = injections[i];\n if (!injection.matcher(scopes)) {\n // injection selector doesn't match stack\n continue;\n }\n var rule = grammar.getRule(injection.ruleId);\n var _a = prepareRuleSearch(rule, grammar, null, isFirstLine, linePos === anchorPosition), ruleScanner = _a.ruleScanner, findOptions = _a.findOptions;\n var matchResult = ruleScanner.scanner.findNextMatchSync(lineText, linePos, findOptions);\n if (debug_1.DebugFlags.InDebugMode) {\n console.log(' scanning for injections');\n console.log(debugCompiledRuleToString(ruleScanner));\n }\n if (!matchResult) {\n continue;\n }\n var matchRating = matchResult.captureIndices[0].start;\n if (matchRating >= bestMatchRating) {\n // Injections are sorted by priority, so the previous injection had a better or equal priority\n continue;\n }\n bestMatchRating = matchRating;\n bestMatchCaptureIndices = matchResult.captureIndices;\n bestMatchRuleId = ruleScanner.rules[matchResult.index];\n bestMatchResultPriority = injection.priority;\n if (bestMatchRating === linePos) {\n // No more need to look at the rest of the injections.\n break;\n }\n }\n if (bestMatchCaptureIndices) {\n return {\n priorityMatch: bestMatchResultPriority === -1,\n captureIndices: bestMatchCaptureIndices,\n matchedRuleId: bestMatchRuleId\n };\n }\n return null;\n}\nfunction matchRule(grammar, lineText, isFirstLine, linePos, stack, anchorPosition) {\n var rule = stack.getRule(grammar);\n var _a = prepareRuleSearch(rule, grammar, stack.endRule, isFirstLine, linePos === anchorPosition), ruleScanner = _a.ruleScanner, findOptions = _a.findOptions;\n var perfStart = 0;\n if (debug_1.DebugFlags.InDebugMode) {\n perfStart = performanceNow();\n }\n var r = ruleScanner.scanner.findNextMatchSync(lineText, linePos, findOptions);\n if (debug_1.DebugFlags.InDebugMode) {\n var elapsedMillis = performanceNow() - perfStart;\n if (elapsedMillis > 5) {\n console.warn(\"Rule \" + rule.debugName + \" (\" + rule.id + \") matching took \" + elapsedMillis + \" against '\" + lineText + \"'\");\n }\n // console.log(` scanning for (linePos: ${linePos}, anchorPosition: ${anchorPosition})`);\n // console.log(debugCompiledRuleToString(ruleScanner));\n if (r) {\n console.log(\"matched rule id: \" + ruleScanner.rules[r.index] + \" from \" + r.captureIndices[0].start + \" to \" + r.captureIndices[0].end);\n }\n }\n if (r) {\n return {\n captureIndices: r.captureIndices,\n matchedRuleId: ruleScanner.rules[r.index]\n };\n }\n return null;\n}\nfunction matchRuleOrInjections(grammar, lineText, isFirstLine, linePos, stack, anchorPosition) {\n // Look for normal grammar rule\n var matchResult = matchRule(grammar, lineText, isFirstLine, linePos, stack, anchorPosition);\n // Look for injected rules\n var injections = grammar.getInjections();\n if (injections.length === 0) {\n // No injections whatsoever => early return\n return matchResult;\n }\n var injectionResult = matchInjections(injections, grammar, lineText, isFirstLine, linePos, stack, anchorPosition);\n if (!injectionResult) {\n // No injections matched => early return\n return matchResult;\n }\n if (!matchResult) {\n // Only injections matched => early return\n return injectionResult;\n }\n // Decide if `matchResult` or `injectionResult` should win\n var matchResultScore = matchResult.captureIndices[0].start;\n var injectionResultScore = injectionResult.captureIndices[0].start;\n if (injectionResultScore < matchResultScore || (injectionResult.priorityMatch && injectionResultScore === matchResultScore)) {\n // injection won!\n return injectionResult;\n }\n return matchResult;\n}\n/**\n * Walk the stack from bottom to top, and check each while condition in this order.\n * If any fails, cut off the entire stack above the failed while condition. While conditions\n * may also advance the linePosition.\n */\nfunction _checkWhileConditions(grammar, lineText, isFirstLine, linePos, stack, lineTokens) {\n var anchorPosition = (stack.beginRuleCapturedEOL ? 0 : -1);\n var whileRules = [];\n for (var node = stack; node; node = node.pop()) {\n var nodeRule = node.getRule(grammar);\n if (nodeRule instanceof rule_1.BeginWhileRule) {\n whileRules.push({\n rule: nodeRule,\n stack: node\n });\n }\n }\n for (var whileRule = whileRules.pop(); whileRule; whileRule = whileRules.pop()) {\n var _a = prepareRuleWhileSearch(whileRule.rule, grammar, whileRule.stack.endRule, isFirstLine, linePos === anchorPosition), ruleScanner = _a.ruleScanner, findOptions = _a.findOptions;\n var r = ruleScanner.scanner.findNextMatchSync(lineText, linePos, findOptions);\n if (debug_1.DebugFlags.InDebugMode) {\n console.log(' scanning for while rule');\n console.log(debugCompiledRuleToString(ruleScanner));\n }\n if (r) {\n var matchedRuleId = ruleScanner.rules[r.index];\n if (matchedRuleId !== -2) {\n // we shouldn't end up here\n stack = whileRule.stack.pop();\n break;\n }\n if (r.captureIndices && r.captureIndices.length) {\n lineTokens.produce(whileRule.stack, r.captureIndices[0].start);\n handleCaptures(grammar, lineText, isFirstLine, whileRule.stack, lineTokens, whileRule.rule.whileCaptures, r.captureIndices);\n lineTokens.produce(whileRule.stack, r.captureIndices[0].end);\n anchorPosition = r.captureIndices[0].end;\n if (r.captureIndices[0].end > linePos) {\n linePos = r.captureIndices[0].end;\n isFirstLine = false;\n }\n }\n }\n else {\n if (debug_1.DebugFlags.InDebugMode) {\n console.log(' popping ' + whileRule.rule.debugName + ' - ' + whileRule.rule.debugWhileRegExp);\n }\n stack = whileRule.stack.pop();\n break;\n }\n }\n return { stack: stack, linePos: linePos, anchorPosition: anchorPosition, isFirstLine: isFirstLine };\n}\nfunction _tokenizeString(grammar, lineText, isFirstLine, linePos, stack, lineTokens, checkWhileConditions) {\n var lineLength = lineText.content.length;\n var STOP = false;\n var anchorPosition = -1;\n if (checkWhileConditions) {\n var whileCheckResult = _checkWhileConditions(grammar, lineText, isFirstLine, linePos, stack, lineTokens);\n stack = whileCheckResult.stack;\n linePos = whileCheckResult.linePos;\n isFirstLine = whileCheckResult.isFirstLine;\n anchorPosition = whileCheckResult.anchorPosition;\n }\n while (!STOP) {\n scanNext(); // potentially modifies linePos && anchorPosition\n }\n function scanNext() {\n if (debug_1.DebugFlags.InDebugMode) {\n console.log('');\n console.log(\"@@scanNext \" + linePos + \": |\" + lineText.content.substr(linePos).replace(/\\n$/, '\\\\n') + \"|\");\n }\n var r = matchRuleOrInjections(grammar, lineText, isFirstLine, linePos, stack, anchorPosition);\n if (!r) {\n if (debug_1.DebugFlags.InDebugMode) {\n console.log(' no more matches.');\n }\n // No match\n lineTokens.produce(stack, lineLength);\n STOP = true;\n return;\n }\n var captureIndices = r.captureIndices;\n var matchedRuleId = r.matchedRuleId;\n var hasAdvanced = (captureIndices && captureIndices.length > 0) ? (captureIndices[0].end > linePos) : false;\n if (matchedRuleId === -1) {\n // We matched the `end` for this rule => pop it\n var poppedRule = stack.getRule(grammar);\n if (debug_1.DebugFlags.InDebugMode) {\n console.log(' popping ' + poppedRule.debugName + ' - ' + poppedRule.debugEndRegExp);\n }\n lineTokens.produce(stack, captureIndices[0].start);\n stack = stack.setContentNameScopesList(stack.nameScopesList);\n handleCaptures(grammar, lineText, isFirstLine, stack, lineTokens, poppedRule.endCaptures, captureIndices);\n lineTokens.produce(stack, captureIndices[0].end);\n // pop\n var popped = stack;\n stack = stack.pop();\n anchorPosition = popped.getAnchorPos();\n if (!hasAdvanced && popped.getEnterPos() === linePos) {\n // Grammar pushed & popped a rule without advancing\n if (debug_1.DebugFlags.InDebugMode) {\n console.error('[1] - Grammar is in an endless loop - Grammar pushed & popped a rule without advancing');\n }\n // See https://github.com/Microsoft/vscode-textmate/issues/12\n // Let's assume this was a mistake by the grammar author and the intent was to continue in this state\n stack = popped;\n lineTokens.produce(stack, lineLength);\n STOP = true;\n return;\n }\n }\n else {\n // We matched a rule!\n var _rule = grammar.getRule(matchedRuleId);\n lineTokens.produce(stack, captureIndices[0].start);\n var beforePush = stack;\n // push it on the stack rule\n var scopeName = _rule.getName(lineText.content, captureIndices);\n var nameScopesList = stack.contentNameScopesList.push(grammar, scopeName);\n stack = stack.push(matchedRuleId, linePos, anchorPosition, captureIndices[0].end === lineLength, null, nameScopesList, nameScopesList);\n if (_rule instanceof rule_1.BeginEndRule) {\n var pushedRule = _rule;\n if (debug_1.DebugFlags.InDebugMode) {\n console.log(' pushing ' + pushedRule.debugName + ' - ' + pushedRule.debugBeginRegExp);\n }\n handleCaptures(grammar, lineText, isFirstLine, stack, lineTokens, pushedRule.beginCaptures, captureIndices);\n lineTokens.produce(stack, captureIndices[0].end);\n anchorPosition = captureIndices[0].end;\n var contentName = pushedRule.getContentName(lineText.content, captureIndices);\n var contentNameScopesList = nameScopesList.push(grammar, contentName);\n stack = stack.setContentNameScopesList(contentNameScopesList);\n if (pushedRule.endHasBackReferences) {\n stack = stack.setEndRule(pushedRule.getEndWithResolvedBackReferences(lineText.content, captureIndices));\n }\n if (!hasAdvanced && beforePush.hasSameRuleAs(stack)) {\n // Grammar pushed the same rule without advancing\n if (debug_1.DebugFlags.InDebugMode) {\n console.error('[2] - Grammar is in an endless loop - Grammar pushed the same rule without advancing');\n }\n stack = stack.pop();\n lineTokens.produce(stack, lineLength);\n STOP = true;\n return;\n }\n }\n else if (_rule instanceof rule_1.BeginWhileRule) {\n var pushedRule = _rule;\n if (debug_1.DebugFlags.InDebugMode) {\n console.log(' pushing ' + pushedRule.debugName);\n }\n handleCaptures(grammar, lineText, isFirstLine, stack, lineTokens, pushedRule.beginCaptures, captureIndices);\n lineTokens.produce(stack, captureIndices[0].end);\n anchorPosition = captureIndices[0].end;\n var contentName = pushedRule.getContentName(lineText.content, captureIndices);\n var contentNameScopesList = nameScopesList.push(grammar, contentName);\n stack = stack.setContentNameScopesList(contentNameScopesList);\n if (pushedRule.whileHasBackReferences) {\n stack = stack.setEndRule(pushedRule.getWhileWithResolvedBackReferences(lineText.content, captureIndices));\n }\n if (!hasAdvanced && beforePush.hasSameRuleAs(stack)) {\n // Grammar pushed the same rule without advancing\n if (debug_1.DebugFlags.InDebugMode) {\n console.error('[3] - Grammar is in an endless loop - Grammar pushed the same rule without advancing');\n }\n stack = stack.pop();\n lineTokens.produce(stack, lineLength);\n STOP = true;\n return;\n }\n }\n else {\n var matchingRule = _rule;\n if (debug_1.DebugFlags.InDebugMode) {\n console.log(' matched ' + matchingRule.debugName + ' - ' + matchingRule.debugMatchRegExp);\n }\n handleCaptures(grammar, lineText, isFirstLine, stack, lineTokens, matchingRule.captures, captureIndices);\n lineTokens.produce(stack, captureIndices[0].end);\n // pop rule immediately since it is a MatchRule\n stack = stack.pop();\n if (!hasAdvanced) {\n // Grammar is not advancing, nor is it pushing/popping\n if (debug_1.DebugFlags.InDebugMode) {\n console.error('[4] - Grammar is in an endless loop - Grammar is not advancing, nor is it pushing/popping');\n }\n stack = stack.safePop();\n lineTokens.produce(stack, lineLength);\n STOP = true;\n return;\n }\n }\n }\n if (captureIndices[0].end > linePos) {\n // Advance stream\n linePos = captureIndices[0].end;\n isFirstLine = false;\n }\n }\n return stack;\n}\nvar StackElementMetadata = /** @class */ (function () {\n function StackElementMetadata() {\n }\n StackElementMetadata.toBinaryStr = function (metadata) {\n var r = metadata.toString(2);\n while (r.length < 32) {\n r = '0' + r;\n }\n return r;\n };\n StackElementMetadata.printMetadata = function (metadata) {\n var languageId = StackElementMetadata.getLanguageId(metadata);\n var tokenType = StackElementMetadata.getTokenType(metadata);\n var fontStyle = StackElementMetadata.getFontStyle(metadata);\n var foreground = StackElementMetadata.getForeground(metadata);\n var background = StackElementMetadata.getBackground(metadata);\n console.log({\n languageId: languageId,\n tokenType: tokenType,\n fontStyle: fontStyle,\n foreground: foreground,\n background: background,\n });\n };\n StackElementMetadata.getLanguageId = function (metadata) {\n return (metadata & 255 /* LANGUAGEID_MASK */) >>> 0 /* LANGUAGEID_OFFSET */;\n };\n StackElementMetadata.getTokenType = function (metadata) {\n return (metadata & 1792 /* TOKEN_TYPE_MASK */) >>> 8 /* TOKEN_TYPE_OFFSET */;\n };\n StackElementMetadata.getFontStyle = function (metadata) {\n return (metadata & 14336 /* FONT_STYLE_MASK */) >>> 11 /* FONT_STYLE_OFFSET */;\n };\n StackElementMetadata.getForeground = function (metadata) {\n return (metadata & 8372224 /* FOREGROUND_MASK */) >>> 14 /* FOREGROUND_OFFSET */;\n };\n StackElementMetadata.getBackground = function (metadata) {\n return (metadata & 4286578688 /* BACKGROUND_MASK */) >>> 23 /* BACKGROUND_OFFSET */;\n };\n StackElementMetadata.set = function (metadata, languageId, tokenType, fontStyle, foreground, background) {\n var _languageId = StackElementMetadata.getLanguageId(metadata);\n var _tokenType = StackElementMetadata.getTokenType(metadata);\n var _fontStyle = StackElementMetadata.getFontStyle(metadata);\n var _foreground = StackElementMetadata.getForeground(metadata);\n var _background = StackElementMetadata.getBackground(metadata);\n if (languageId !== 0) {\n _languageId = languageId;\n }\n if (tokenType !== 0 /* Other */) {\n _tokenType = tokenType === 8 /* MetaEmbedded */ ? 0 /* Other */ : tokenType;\n }\n if (fontStyle !== -1 /* NotSet */) {\n _fontStyle = fontStyle;\n }\n if (foreground !== 0) {\n _foreground = foreground;\n }\n if (background !== 0) {\n _background = background;\n }\n return ((_languageId << 0 /* LANGUAGEID_OFFSET */)\n | (_tokenType << 8 /* TOKEN_TYPE_OFFSET */)\n | (_fontStyle << 11 /* FONT_STYLE_OFFSET */)\n | (_foreground << 14 /* FOREGROUND_OFFSET */)\n | (_background << 23 /* BACKGROUND_OFFSET */)) >>> 0;\n };\n return StackElementMetadata;\n}());\nexports.StackElementMetadata = StackElementMetadata;\nvar ScopeListElement = /** @class */ (function () {\n function ScopeListElement(parent, scope, metadata) {\n this.parent = parent;\n this.scope = scope;\n this.metadata = metadata;\n }\n ScopeListElement._equals = function (a, b) {\n do {\n if (a === b) {\n return true;\n }\n if (!a && !b) {\n // End of list reached for both\n return true;\n }\n if (!a || !b) {\n // End of list reached only for one\n return false;\n }\n if (a.scope !== b.scope || a.metadata !== b.metadata) {\n return false;\n }\n // Go to previous pair\n a = a.parent;\n b = b.parent;\n } while (true);\n };\n ScopeListElement.prototype.equals = function (other) {\n return ScopeListElement._equals(this, other);\n };\n ScopeListElement._matchesScope = function (scope, selector, selectorWithDot) {\n return (selector === scope || scope.substring(0, selectorWithDot.length) === selectorWithDot);\n };\n ScopeListElement._matches = function (target, parentScopes) {\n if (parentScopes === null) {\n return true;\n }\n var len = parentScopes.length;\n var index = 0;\n var selector = parentScopes[index];\n var selectorWithDot = selector + '.';\n while (target) {\n if (this._matchesScope(target.scope, selector, selectorWithDot)) {\n index++;\n if (index === len) {\n return true;\n }\n selector = parentScopes[index];\n selectorWithDot = selector + '.';\n }\n target = target.parent;\n }\n return false;\n };\n ScopeListElement.mergeMetadata = function (metadata, scopesList, source) {\n if (source === null) {\n return metadata;\n }\n var fontStyle = -1 /* NotSet */;\n var foreground = 0;\n var background = 0;\n if (source.themeData !== null) {\n // Find the first themeData that matches\n for (var i = 0, len = source.themeData.length; i < len; i++) {\n var themeData = source.themeData[i];\n if (this._matches(scopesList, themeData.parentScopes)) {\n fontStyle = themeData.fontStyle;\n foreground = themeData.foreground;\n background = themeData.background;\n break;\n }\n }\n }\n return StackElementMetadata.set(metadata, source.languageId, source.tokenType, fontStyle, foreground, background);\n };\n ScopeListElement._push = function (target, grammar, scopes) {\n for (var i = 0, len = scopes.length; i < len; i++) {\n var scope = scopes[i];\n var rawMetadata = grammar.getMetadataForScope(scope);\n var metadata = ScopeListElement.mergeMetadata(target.metadata, target, rawMetadata);\n target = new ScopeListElement(target, scope, metadata);\n }\n return target;\n };\n ScopeListElement.prototype.push = function (grammar, scope) {\n if (scope === null) {\n return this;\n }\n if (scope.indexOf(' ') >= 0) {\n // there are multiple scopes to push\n return ScopeListElement._push(this, grammar, scope.split(/ /g));\n }\n // there is a single scope to push\n return ScopeListElement._push(this, grammar, [scope]);\n };\n ScopeListElement._generateScopes = function (scopesList) {\n var result = [];\n var resultLen = 0;\n while (scopesList) {\n result[resultLen++] = scopesList.scope;\n scopesList = scopesList.parent;\n }\n result.reverse();\n return result;\n };\n ScopeListElement.prototype.generateScopes = function () {\n return ScopeListElement._generateScopes(this);\n };\n return ScopeListElement;\n}());\nexports.ScopeListElement = ScopeListElement;\n/**\n * Represents a \"pushed\" state on the stack (as a linked list element).\n */\nvar StackElement = /** @class */ (function () {\n function StackElement(parent, ruleId, enterPos, anchorPos, beginRuleCapturedEOL, endRule, nameScopesList, contentNameScopesList) {\n this.parent = parent;\n this.depth = (this.parent ? this.parent.depth + 1 : 1);\n this.ruleId = ruleId;\n this._enterPos = enterPos;\n this._anchorPos = anchorPos;\n this.beginRuleCapturedEOL = beginRuleCapturedEOL;\n this.endRule = endRule;\n this.nameScopesList = nameScopesList;\n this.contentNameScopesList = contentNameScopesList;\n }\n /**\n * A structural equals check. Does not take into account `scopes`.\n */\n StackElement._structuralEquals = function (a, b) {\n do {\n if (a === b) {\n return true;\n }\n if (!a && !b) {\n // End of list reached for both\n return true;\n }\n if (!a || !b) {\n // End of list reached only for one\n return false;\n }\n if (a.depth !== b.depth || a.ruleId !== b.ruleId || a.endRule !== b.endRule) {\n return false;\n }\n // Go to previous pair\n a = a.parent;\n b = b.parent;\n } while (true);\n };\n StackElement._equals = function (a, b) {\n if (a === b) {\n return true;\n }\n if (!this._structuralEquals(a, b)) {\n return false;\n }\n return a.contentNameScopesList.equals(b.contentNameScopesList);\n };\n StackElement.prototype.clone = function () {\n return this;\n };\n StackElement.prototype.equals = function (other) {\n if (other === null) {\n return false;\n }\n return StackElement._equals(this, other);\n };\n StackElement._reset = function (el) {\n while (el) {\n el._enterPos = -1;\n el._anchorPos = -1;\n el = el.parent;\n }\n };\n StackElement.prototype.reset = function () {\n StackElement._reset(this);\n };\n StackElement.prototype.pop = function () {\n return this.parent;\n };\n StackElement.prototype.safePop = function () {\n if (this.parent) {\n return this.parent;\n }\n return this;\n };\n StackElement.prototype.push = function (ruleId, enterPos, anchorPos, beginRuleCapturedEOL, endRule, nameScopesList, contentNameScopesList) {\n return new StackElement(this, ruleId, enterPos, anchorPos, beginRuleCapturedEOL, endRule, nameScopesList, contentNameScopesList);\n };\n StackElement.prototype.getEnterPos = function () {\n return this._enterPos;\n };\n StackElement.prototype.getAnchorPos = function () {\n return this._anchorPos;\n };\n StackElement.prototype.getRule = function (grammar) {\n return grammar.getRule(this.ruleId);\n };\n StackElement.prototype._writeString = function (res, outIndex) {\n if (this.parent) {\n outIndex = this.parent._writeString(res, outIndex);\n }\n res[outIndex++] = \"(\" + this.ruleId + \", TODO-\" + this.nameScopesList + \", TODO-\" + this.contentNameScopesList + \")\";\n return outIndex;\n };\n StackElement.prototype.toString = function () {\n var r = [];\n this._writeString(r, 0);\n return '[' + r.join(',') + ']';\n };\n StackElement.prototype.setContentNameScopesList = function (contentNameScopesList) {\n if (this.contentNameScopesList === contentNameScopesList) {\n return this;\n }\n return this.parent.push(this.ruleId, this._enterPos, this._anchorPos, this.beginRuleCapturedEOL, this.endRule, this.nameScopesList, contentNameScopesList);\n };\n StackElement.prototype.setEndRule = function (endRule) {\n if (this.endRule === endRule) {\n return this;\n }\n return new StackElement(this.parent, this.ruleId, this._enterPos, this._anchorPos, this.beginRuleCapturedEOL, endRule, this.nameScopesList, this.contentNameScopesList);\n };\n StackElement.prototype.hasSameRuleAs = function (other) {\n var el = this;\n while (el && el._enterPos === other._enterPos) {\n if (el.ruleId === other.ruleId) {\n return true;\n }\n el = el.parent;\n }\n return false;\n };\n StackElement.NULL = new StackElement(null, 0, 0, 0, false, null, null, null);\n return StackElement;\n}());\nexports.StackElement = StackElement;\nvar LocalStackElement = /** @class */ (function () {\n function LocalStackElement(scopes, endPos) {\n this.scopes = scopes;\n this.endPos = endPos;\n }\n return LocalStackElement;\n}());\nexports.LocalStackElement = LocalStackElement;\nvar LineTokens = /** @class */ (function () {\n function LineTokens(emitBinaryTokens, lineText, tokenTypeOverrides) {\n this._emitBinaryTokens = emitBinaryTokens;\n this._tokenTypeOverrides = tokenTypeOverrides;\n if (debug_1.DebugFlags.InDebugMode) {\n this._lineText = lineText;\n }\n else {\n this._lineText = null;\n }\n this._tokens = [];\n this._binaryTokens = [];\n this._lastTokenEndIndex = 0;\n }\n LineTokens.prototype.produce = function (stack, endIndex) {\n this.produceFromScopes(stack.contentNameScopesList, endIndex);\n };\n LineTokens.prototype.produceFromScopes = function (scopesList, endIndex) {\n if (this._lastTokenEndIndex >= endIndex) {\n return;\n }\n if (this._emitBinaryTokens) {\n var metadata = scopesList.metadata;\n for (var _i = 0, _a = this._tokenTypeOverrides; _i < _a.length; _i++) {\n var tokenType = _a[_i];\n if (tokenType.matcher(scopesList.generateScopes())) {\n metadata = StackElementMetadata.set(metadata, 0, toTemporaryType(tokenType.type), -1 /* NotSet */, 0, 0);\n }\n }\n if (this._binaryTokens.length > 0 && this._binaryTokens[this._binaryTokens.length - 1] === metadata) {\n // no need to push a token with the same metadata\n this._lastTokenEndIndex = endIndex;\n return;\n }\n this._binaryTokens.push(this._lastTokenEndIndex);\n this._binaryTokens.push(metadata);\n this._lastTokenEndIndex = endIndex;\n return;\n }\n var scopes = scopesList.generateScopes();\n if (debug_1.DebugFlags.InDebugMode) {\n console.log(' token: |' + this._lineText.substring(this._lastTokenEndIndex, endIndex).replace(/\\n$/, '\\\\n') + '|');\n for (var k = 0; k < scopes.length; k++) {\n console.log(' * ' + scopes[k]);\n }\n }\n this._tokens.push({\n startIndex: this._lastTokenEndIndex,\n endIndex: endIndex,\n // value: lineText.substring(lastTokenEndIndex, endIndex),\n scopes: scopes\n });\n this._lastTokenEndIndex = endIndex;\n };\n LineTokens.prototype.getResult = function (stack, lineLength) {\n if (this._tokens.length > 0 && this._tokens[this._tokens.length - 1].startIndex === lineLength - 1) {\n // pop produced token for newline\n this._tokens.pop();\n }\n if (this._tokens.length === 0) {\n this._lastTokenEndIndex = -1;\n this.produce(stack, lineLength);\n this._tokens[this._tokens.length - 1].startIndex = 0;\n }\n return this._tokens;\n };\n LineTokens.prototype.getBinaryResult = function (stack, lineLength) {\n if (this._binaryTokens.length > 0 && this._binaryTokens[this._binaryTokens.length - 2] === lineLength - 1) {\n // pop produced token for newline\n this._binaryTokens.pop();\n this._binaryTokens.pop();\n }\n if (this._binaryTokens.length === 0) {\n this._lastTokenEndIndex = -1;\n this.produce(stack, lineLength);\n this._binaryTokens[this._binaryTokens.length - 2] = 0;\n }\n var result = new Uint32Array(this._binaryTokens.length);\n for (var i = 0, len = this._binaryTokens.length; i < len; i++) {\n result[i] = this._binaryTokens[i];\n }\n return result;\n };\n return LineTokens;\n}());\nfunction toTemporaryType(standardType) {\n switch (standardType) {\n case 4 /* RegEx */:\n return 4 /* RegEx */;\n case 2 /* String */:\n return 2 /* String */;\n case 1 /* Comment */:\n return 1 /* Comment */;\n case 0 /* Other */:\n default:\n // `MetaEmbedded` is the same scope as `Other`\n // but it overwrites existing token types in the stack.\n return 8 /* MetaEmbedded */;\n }\n}\n//# sourceMappingURL=grammar.js.map","\"use strict\";\n/*---------------------------------------------------------\n * Copyright (C) Microsoft Corporation. All rights reserved.\n *--------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.parseRawGrammar = void 0;\nvar plist = require(\"./plist\");\nvar debug_1 = require(\"./debug\");\nvar json_1 = require(\"./json\");\nfunction parseRawGrammar(content, filePath) {\n if (filePath === void 0) { filePath = null; }\n if (filePath !== null && /\\.json$/.test(filePath)) {\n return parseJSONGrammar(content, filePath);\n }\n return parsePLISTGrammar(content, filePath);\n}\nexports.parseRawGrammar = parseRawGrammar;\nfunction parseJSONGrammar(contents, filename) {\n if (debug_1.DebugFlags.InDebugMode) {\n return json_1.parse(contents, filename, true);\n }\n return JSON.parse(contents);\n}\nfunction parsePLISTGrammar(contents, filename) {\n if (debug_1.DebugFlags.InDebugMode) {\n return plist.parseWithLocation(contents, filename, '$vscodeTextmateLocation');\n }\n return plist.parse(contents);\n}\n//# sourceMappingURL=grammarReader.js.map","\"use strict\";\n/*---------------------------------------------------------\n * Copyright (C) Microsoft Corporation. All rights reserved.\n *--------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.parse = void 0;\nfunction doFail(streamState, msg) {\n // console.log('Near offset ' + streamState.pos + ': ' + msg + ' ~~~' + streamState.source.substr(streamState.pos, 50) + '~~~');\n throw new Error('Near offset ' + streamState.pos + ': ' + msg + ' ~~~' + streamState.source.substr(streamState.pos, 50) + '~~~');\n}\nfunction parse(source, filename, withMetadata) {\n var streamState = new JSONStreamState(source);\n var token = new JSONToken();\n var state = 0 /* ROOT_STATE */;\n var cur = null;\n var stateStack = [];\n var objStack = [];\n function pushState() {\n stateStack.push(state);\n objStack.push(cur);\n }\n function popState() {\n state = stateStack.pop();\n cur = objStack.pop();\n }\n function fail(msg) {\n doFail(streamState, msg);\n }\n while (nextJSONToken(streamState, token)) {\n if (state === 0 /* ROOT_STATE */) {\n if (cur !== null) {\n fail('too many constructs in root');\n }\n if (token.type === 3 /* LEFT_CURLY_BRACKET */) {\n cur = {};\n if (withMetadata) {\n cur.$vscodeTextmateLocation = token.toLocation(filename);\n }\n pushState();\n state = 1 /* DICT_STATE */;\n continue;\n }\n if (token.type === 2 /* LEFT_SQUARE_BRACKET */) {\n cur = [];\n pushState();\n state = 4 /* ARR_STATE */;\n continue;\n }\n fail('unexpected token in root');\n }\n if (state === 2 /* DICT_STATE_COMMA */) {\n if (token.type === 5 /* RIGHT_CURLY_BRACKET */) {\n popState();\n continue;\n }\n if (token.type === 7 /* COMMA */) {\n state = 3 /* DICT_STATE_NO_CLOSE */;\n continue;\n }\n fail('expected , or }');\n }\n if (state === 1 /* DICT_STATE */ || state === 3 /* DICT_STATE_NO_CLOSE */) {\n if (state === 1 /* DICT_STATE */ && token.type === 5 /* RIGHT_CURLY_BRACKET */) {\n popState();\n continue;\n }\n if (token.type === 1 /* STRING */) {\n var keyValue = token.value;\n if (!nextJSONToken(streamState, token) || token.type !== 6 /* COLON */) {\n fail('expected colon');\n }\n if (!nextJSONToken(streamState, token)) {\n fail('expected value');\n }\n state = 2 /* DICT_STATE_COMMA */;\n if (token.type === 1 /* STRING */) {\n cur[keyValue] = token.value;\n continue;\n }\n if (token.type === 8 /* NULL */) {\n cur[keyValue] = null;\n continue;\n }\n if (token.type === 9 /* TRUE */) {\n cur[keyValue] = true;\n continue;\n }\n if (token.type === 10 /* FALSE */) {\n cur[keyValue] = false;\n continue;\n }\n if (token.type === 11 /* NUMBER */) {\n cur[keyValue] = parseFloat(token.value);\n continue;\n }\n if (token.type === 2 /* LEFT_SQUARE_BRACKET */) {\n var newArr = [];\n cur[keyValue] = newArr;\n pushState();\n state = 4 /* ARR_STATE */;\n cur = newArr;\n continue;\n }\n if (token.type === 3 /* LEFT_CURLY_BRACKET */) {\n var newDict = {};\n if (withMetadata) {\n newDict.$vscodeTextmateLocation = token.toLocation(filename);\n }\n cur[keyValue] = newDict;\n pushState();\n state = 1 /* DICT_STATE */;\n cur = newDict;\n continue;\n }\n }\n fail('unexpected token in dict');\n }\n if (state === 5 /* ARR_STATE_COMMA */) {\n if (token.type === 4 /* RIGHT_SQUARE_BRACKET */) {\n popState();\n continue;\n }\n if (token.type === 7 /* COMMA */) {\n state = 6 /* ARR_STATE_NO_CLOSE */;\n continue;\n }\n fail('expected , or ]');\n }\n if (state === 4 /* ARR_STATE */ || state === 6 /* ARR_STATE_NO_CLOSE */) {\n if (state === 4 /* ARR_STATE */ && token.type === 4 /* RIGHT_SQUARE_BRACKET */) {\n popState();\n continue;\n }\n state = 5 /* ARR_STATE_COMMA */;\n if (token.type === 1 /* STRING */) {\n cur.push(token.value);\n continue;\n }\n if (token.type === 8 /* NULL */) {\n cur.push(null);\n continue;\n }\n if (token.type === 9 /* TRUE */) {\n cur.push(true);\n continue;\n }\n if (token.type === 10 /* FALSE */) {\n cur.push(false);\n continue;\n }\n if (token.type === 11 /* NUMBER */) {\n cur.push(parseFloat(token.value));\n continue;\n }\n if (token.type === 2 /* LEFT_SQUARE_BRACKET */) {\n var newArr = [];\n cur.push(newArr);\n pushState();\n state = 4 /* ARR_STATE */;\n cur = newArr;\n continue;\n }\n if (token.type === 3 /* LEFT_CURLY_BRACKET */) {\n var newDict = {};\n if (withMetadata) {\n newDict.$vscodeTextmateLocation = token.toLocation(filename);\n }\n cur.push(newDict);\n pushState();\n state = 1 /* DICT_STATE */;\n cur = newDict;\n continue;\n }\n fail('unexpected token in array');\n }\n fail('unknown state');\n }\n if (objStack.length !== 0) {\n fail('unclosed constructs');\n }\n return cur;\n}\nexports.parse = parse;\nvar JSONStreamState = /** @class */ (function () {\n function JSONStreamState(source) {\n this.source = source;\n this.pos = 0;\n this.len = source.length;\n this.line = 1;\n this.char = 0;\n }\n return JSONStreamState;\n}());\nvar JSONToken = /** @class */ (function () {\n function JSONToken() {\n this.value = null;\n this.type = 0 /* UNKNOWN */;\n this.offset = -1;\n this.len = -1;\n this.line = -1;\n this.char = -1;\n }\n JSONToken.prototype.toLocation = function (filename) {\n return {\n filename: filename,\n line: this.line,\n char: this.char\n };\n };\n return JSONToken;\n}());\n/**\n * precondition: the string is known to be valid JSON (https://www.ietf.org/rfc/rfc4627.txt)\n */\nfunction nextJSONToken(_state, _out) {\n _out.value = null;\n _out.type = 0 /* UNKNOWN */;\n _out.offset = -1;\n _out.len = -1;\n _out.line = -1;\n _out.char = -1;\n var source = _state.source;\n var pos = _state.pos;\n var len = _state.len;\n var line = _state.line;\n var char = _state.char;\n //------------------------ skip whitespace\n var chCode;\n do {\n if (pos >= len) {\n return false; /*EOS*/\n }\n chCode = source.charCodeAt(pos);\n if (chCode === 32 /* SPACE */ || chCode === 9 /* HORIZONTAL_TAB */ || chCode === 13 /* CARRIAGE_RETURN */) {\n // regular whitespace\n pos++;\n char++;\n continue;\n }\n if (chCode === 10 /* LINE_FEED */) {\n // newline\n pos++;\n line++;\n char = 0;\n continue;\n }\n // not whitespace\n break;\n } while (true);\n _out.offset = pos;\n _out.line = line;\n _out.char = char;\n if (chCode === 34 /* QUOTATION_MARK */) {\n //------------------------ strings\n _out.type = 1 /* STRING */;\n pos++;\n char++;\n do {\n if (pos >= len) {\n return false; /*EOS*/\n }\n chCode = source.charCodeAt(pos);\n pos++;\n char++;\n if (chCode === 92 /* BACKSLASH */) {\n // skip next char\n pos++;\n char++;\n continue;\n }\n if (chCode === 34 /* QUOTATION_MARK */) {\n // end of the string\n break;\n }\n } while (true);\n _out.value = source.substring(_out.offset + 1, pos - 1).replace(/\\\\u([0-9A-Fa-f]{4})/g, function (_, m0) {\n return String.fromCodePoint(parseInt(m0, 16));\n }).replace(/\\\\(.)/g, function (_, m0) {\n switch (m0) {\n case '\"': return '\"';\n case '\\\\': return '\\\\';\n case '/': return '/';\n case 'b': return '\\b';\n case 'f': return '\\f';\n case 'n': return '\\n';\n case 'r': return '\\r';\n case 't': return '\\t';\n default: doFail(_state, 'invalid escape sequence');\n }\n throw new Error('unreachable');\n });\n }\n else if (chCode === 91 /* LEFT_SQUARE_BRACKET */) {\n _out.type = 2 /* LEFT_SQUARE_BRACKET */;\n pos++;\n char++;\n }\n else if (chCode === 123 /* LEFT_CURLY_BRACKET */) {\n _out.type = 3 /* LEFT_CURLY_BRACKET */;\n pos++;\n char++;\n }\n else if (chCode === 93 /* RIGHT_SQUARE_BRACKET */) {\n _out.type = 4 /* RIGHT_SQUARE_BRACKET */;\n pos++;\n char++;\n }\n else if (chCode === 125 /* RIGHT_CURLY_BRACKET */) {\n _out.type = 5 /* RIGHT_CURLY_BRACKET */;\n pos++;\n char++;\n }\n else if (chCode === 58 /* COLON */) {\n _out.type = 6 /* COLON */;\n pos++;\n char++;\n }\n else if (chCode === 44 /* COMMA */) {\n _out.type = 7 /* COMMA */;\n pos++;\n char++;\n }\n else if (chCode === 110 /* n */) {\n //------------------------ null\n _out.type = 8 /* NULL */;\n pos++;\n char++;\n chCode = source.charCodeAt(pos);\n if (chCode !== 117 /* u */) {\n return false; /* INVALID */\n }\n pos++;\n char++;\n chCode = source.charCodeAt(pos);\n if (chCode !== 108 /* l */) {\n return false; /* INVALID */\n }\n pos++;\n char++;\n chCode = source.charCodeAt(pos);\n if (chCode !== 108 /* l */) {\n return false; /* INVALID */\n }\n pos++;\n char++;\n }\n else if (chCode === 116 /* t */) {\n //------------------------ true\n _out.type = 9 /* TRUE */;\n pos++;\n char++;\n chCode = source.charCodeAt(pos);\n if (chCode !== 114 /* r */) {\n return false; /* INVALID */\n }\n pos++;\n char++;\n chCode = source.charCodeAt(pos);\n if (chCode !== 117 /* u */) {\n return false; /* INVALID */\n }\n pos++;\n char++;\n chCode = source.charCodeAt(pos);\n if (chCode !== 101 /* e */) {\n return false; /* INVALID */\n }\n pos++;\n char++;\n }\n else if (chCode === 102 /* f */) {\n //------------------------ false\n _out.type = 10 /* FALSE */;\n pos++;\n char++;\n chCode = source.charCodeAt(pos);\n if (chCode !== 97 /* a */) {\n return false; /* INVALID */\n }\n pos++;\n char++;\n chCode = source.charCodeAt(pos);\n if (chCode !== 108 /* l */) {\n return false; /* INVALID */\n }\n pos++;\n char++;\n chCode = source.charCodeAt(pos);\n if (chCode !== 115 /* s */) {\n return false; /* INVALID */\n }\n pos++;\n char++;\n chCode = source.charCodeAt(pos);\n if (chCode !== 101 /* e */) {\n return false; /* INVALID */\n }\n pos++;\n char++;\n }\n else {\n //------------------------ numbers\n _out.type = 11 /* NUMBER */;\n do {\n if (pos >= len) {\n return false; /*EOS*/\n }\n chCode = source.charCodeAt(pos);\n if (chCode === 46 /* DOT */\n || (chCode >= 48 /* D0 */ && chCode <= 57 /* D9 */)\n || (chCode === 101 /* e */ || chCode === 69 /* E */)\n || (chCode === 45 /* MINUS */ || chCode === 43 /* PLUS */)) {\n // looks like a piece of a number\n pos++;\n char++;\n continue;\n }\n // pos--; char--;\n break;\n } while (true);\n }\n _out.len = pos - _out.offset;\n if (_out.value === null) {\n _out.value = source.substr(_out.offset, _out.len);\n }\n _state.pos = pos;\n _state.line = line;\n _state.char = char;\n // console.log('PRODUCING TOKEN: ', _out.value, JSONTokenType[_out.type]);\n return true;\n}\n//# sourceMappingURL=json.js.map","\"use strict\";\n/*---------------------------------------------------------\n * Copyright (C) Microsoft Corporation. All rights reserved.\n *--------------------------------------------------------*/\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.parseRawGrammar = exports.INITIAL = exports.Registry = void 0;\nvar registry_1 = require(\"./registry\");\nvar grammarReader = require(\"./grammarReader\");\nvar theme_1 = require(\"./theme\");\nvar grammar_1 = require(\"./grammar\");\n__exportStar(require(\"./types\"), exports);\n/**\n * The registry that will hold all grammars.\n */\nvar Registry = /** @class */ (function () {\n function Registry(options) {\n this._options = options;\n this._syncRegistry = new registry_1.SyncRegistry(theme_1.Theme.createFromRawTheme(options.theme, options.colorMap), options.onigLib);\n this._ensureGrammarCache = new Map();\n }\n Registry.prototype.dispose = function () {\n this._syncRegistry.dispose();\n };\n /**\n * Change the theme. Once called, no previous `ruleStack` should be used anymore.\n */\n Registry.prototype.setTheme = function (theme, colorMap) {\n this._syncRegistry.setTheme(theme_1.Theme.createFromRawTheme(theme, colorMap));\n };\n /**\n * Returns a lookup array for color ids.\n */\n Registry.prototype.getColorMap = function () {\n return this._syncRegistry.getColorMap();\n };\n /**\n * Load the grammar for `scopeName` and all referenced included grammars asynchronously.\n * Please do not use language id 0.\n */\n Registry.prototype.loadGrammarWithEmbeddedLanguages = function (initialScopeName, initialLanguage, embeddedLanguages) {\n return this.loadGrammarWithConfiguration(initialScopeName, initialLanguage, { embeddedLanguages: embeddedLanguages });\n };\n /**\n * Load the grammar for `scopeName` and all referenced included grammars asynchronously.\n * Please do not use language id 0.\n */\n Registry.prototype.loadGrammarWithConfiguration = function (initialScopeName, initialLanguage, configuration) {\n return this._loadGrammar(initialScopeName, initialLanguage, configuration.embeddedLanguages, configuration.tokenTypes);\n };\n /**\n * Load the grammar for `scopeName` and all referenced included grammars asynchronously.\n */\n Registry.prototype.loadGrammar = function (initialScopeName) {\n return this._loadGrammar(initialScopeName, 0, null, null);\n };\n Registry.prototype._doLoadSingleGrammar = function (scopeName) {\n return __awaiter(this, void 0, void 0, function () {\n var grammar, injections;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this._options.loadGrammar(scopeName)];\n case 1:\n grammar = _a.sent();\n if (grammar) {\n injections = (typeof this._options.getInjections === 'function' ? this._options.getInjections(scopeName) : undefined);\n this._syncRegistry.addGrammar(grammar, injections);\n }\n return [2 /*return*/];\n }\n });\n });\n };\n Registry.prototype._loadSingleGrammar = function (scopeName) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n if (!this._ensureGrammarCache.has(scopeName)) {\n this._ensureGrammarCache.set(scopeName, this._doLoadSingleGrammar(scopeName));\n }\n return [2 /*return*/, this._ensureGrammarCache.get(scopeName)];\n });\n });\n };\n Registry.prototype._collectDependenciesForDep = function (initialScopeName, result, dep) {\n var grammar = this._syncRegistry.lookup(dep.scopeName);\n if (!grammar) {\n if (dep.scopeName === initialScopeName) {\n throw new Error(\"No grammar provided for <\" + initialScopeName + \">\");\n }\n return;\n }\n if (dep instanceof grammar_1.FullScopeDependency) {\n grammar_1.collectDependencies(result, this._syncRegistry.lookup(initialScopeName), grammar);\n }\n else {\n grammar_1.collectSpecificDependencies(result, this._syncRegistry.lookup(initialScopeName), grammar, dep.include);\n }\n var injections = this._syncRegistry.injections(dep.scopeName);\n if (injections) {\n for (var _i = 0, injections_1 = injections; _i < injections_1.length; _i++) {\n var injection = injections_1[_i];\n result.add(new grammar_1.FullScopeDependency(injection));\n }\n }\n };\n Registry.prototype._loadGrammar = function (initialScopeName, initialLanguage, embeddedLanguages, tokenTypes) {\n return __awaiter(this, void 0, void 0, function () {\n var seenFullScopeRequests, seenPartialScopeRequests, Q, q, deps, _i, q_1, dep, _a, _b, dep, _c, _d, dep;\n var _this = this;\n return __generator(this, function (_e) {\n switch (_e.label) {\n case 0:\n seenFullScopeRequests = new Set();\n seenPartialScopeRequests = new Set();\n seenFullScopeRequests.add(initialScopeName);\n Q = [new grammar_1.FullScopeDependency(initialScopeName)];\n _e.label = 1;\n case 1:\n if (!(Q.length > 0)) return [3 /*break*/, 3];\n q = Q;\n Q = [];\n return [4 /*yield*/, Promise.all(q.map(function (request) { return _this._loadSingleGrammar(request.scopeName); }))];\n case 2:\n _e.sent();\n deps = new grammar_1.ScopeDependencyCollector();\n for (_i = 0, q_1 = q; _i < q_1.length; _i++) {\n dep = q_1[_i];\n this._collectDependenciesForDep(initialScopeName, deps, dep);\n }\n for (_a = 0, _b = deps.full; _a < _b.length; _a++) {\n dep = _b[_a];\n if (seenFullScopeRequests.has(dep.scopeName)) {\n // already processed\n continue;\n }\n seenFullScopeRequests.add(dep.scopeName);\n Q.push(dep);\n }\n for (_c = 0, _d = deps.partial; _c < _d.length; _c++) {\n dep = _d[_c];\n if (seenFullScopeRequests.has(dep.scopeName)) {\n // already processed in full\n continue;\n }\n if (seenPartialScopeRequests.has(dep.toKey())) {\n // already processed\n continue;\n }\n seenPartialScopeRequests.add(dep.toKey());\n Q.push(dep);\n }\n return [3 /*break*/, 1];\n case 3: return [2 /*return*/, this.grammarForScopeName(initialScopeName, initialLanguage, embeddedLanguages, tokenTypes)];\n }\n });\n });\n };\n /**\n * Adds a rawGrammar.\n */\n Registry.prototype.addGrammar = function (rawGrammar, injections, initialLanguage, embeddedLanguages) {\n if (injections === void 0) { injections = []; }\n if (initialLanguage === void 0) { initialLanguage = 0; }\n if (embeddedLanguages === void 0) { embeddedLanguages = null; }\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n this._syncRegistry.addGrammar(rawGrammar, injections);\n return [4 /*yield*/, this.grammarForScopeName(rawGrammar.scopeName, initialLanguage, embeddedLanguages)];\n case 1: return [2 /*return*/, (_a.sent())];\n }\n });\n });\n };\n /**\n * Get the grammar for `scopeName`. The grammar must first be created via `loadGrammar` or `addGrammar`.\n */\n Registry.prototype.grammarForScopeName = function (scopeName, initialLanguage, embeddedLanguages, tokenTypes) {\n if (initialLanguage === void 0) { initialLanguage = 0; }\n if (embeddedLanguages === void 0) { embeddedLanguages = null; }\n if (tokenTypes === void 0) { tokenTypes = null; }\n return this._syncRegistry.grammarForScopeName(scopeName, initialLanguage, embeddedLanguages, tokenTypes);\n };\n return Registry;\n}());\nexports.Registry = Registry;\nexports.INITIAL = grammar_1.StackElement.NULL;\nexports.parseRawGrammar = grammarReader.parseRawGrammar;\n//# sourceMappingURL=main.js.map","\"use strict\";\n/*---------------------------------------------------------\n * Copyright (C) Microsoft Corporation. All rights reserved.\n *--------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createMatchers = void 0;\nfunction createMatchers(selector, matchesName) {\n var results = [];\n var tokenizer = newTokenizer(selector);\n var token = tokenizer.next();\n while (token !== null) {\n var priority = 0;\n if (token.length === 2 && token.charAt(1) === ':') {\n switch (token.charAt(0)) {\n case 'R':\n priority = 1;\n break;\n case 'L':\n priority = -1;\n break;\n default:\n console.log(\"Unknown priority \" + token + \" in scope selector\");\n }\n token = tokenizer.next();\n }\n var matcher = parseConjunction();\n results.push({ matcher: matcher, priority: priority });\n if (token !== ',') {\n break;\n }\n token = tokenizer.next();\n }\n return results;\n function parseOperand() {\n if (token === '-') {\n token = tokenizer.next();\n var expressionToNegate_1 = parseOperand();\n return function (matcherInput) { return !!expressionToNegate_1 && !expressionToNegate_1(matcherInput); };\n }\n if (token === '(') {\n token = tokenizer.next();\n var expressionInParents = parseInnerExpression();\n if (token === ')') {\n token = tokenizer.next();\n }\n return expressionInParents;\n }\n if (isIdentifier(token)) {\n var identifiers_1 = [];\n do {\n identifiers_1.push(token);\n token = tokenizer.next();\n } while (isIdentifier(token));\n return function (matcherInput) { return matchesName(identifiers_1, matcherInput); };\n }\n return null;\n }\n function parseConjunction() {\n var matchers = [];\n var matcher = parseOperand();\n while (matcher) {\n matchers.push(matcher);\n matcher = parseOperand();\n }\n return function (matcherInput) { return matchers.every(function (matcher) { return matcher(matcherInput); }); }; // and\n }\n function parseInnerExpression() {\n var matchers = [];\n var matcher = parseConjunction();\n while (matcher) {\n matchers.push(matcher);\n if (token === '|' || token === ',') {\n do {\n token = tokenizer.next();\n } while (token === '|' || token === ','); // ignore subsequent commas\n }\n else {\n break;\n }\n matcher = parseConjunction();\n }\n return function (matcherInput) { return matchers.some(function (matcher) { return matcher(matcherInput); }); }; // or\n }\n}\nexports.createMatchers = createMatchers;\nfunction isIdentifier(token) {\n return !!token && !!token.match(/[\\w\\.:]+/);\n}\nfunction newTokenizer(input) {\n var regex = /([LR]:|[\\w\\.:][\\w\\.:\\-]*|[\\,\\|\\-\\(\\)])/g;\n var match = regex.exec(input);\n return {\n next: function () {\n if (!match) {\n return null;\n }\n var res = match[0];\n match = regex.exec(input);\n return res;\n }\n };\n}\n//# sourceMappingURL=matcher.js.map","\"use strict\";\n/*---------------------------------------------------------\n * Copyright (C) Microsoft Corporation. All rights reserved.\n *--------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.parse = exports.parseWithLocation = void 0;\nfunction parseWithLocation(content, filename, locationKeyName) {\n return _parse(content, filename, locationKeyName);\n}\nexports.parseWithLocation = parseWithLocation;\n/**\n * A very fast plist parser\n */\nfunction parse(content) {\n return _parse(content, null, null);\n}\nexports.parse = parse;\nfunction _parse(content, filename, locationKeyName) {\n var len = content.length;\n var pos = 0;\n var line = 1;\n var char = 0;\n // Skip UTF8 BOM\n if (len > 0 && content.charCodeAt(0) === 65279 /* BOM */) {\n pos = 1;\n }\n function advancePosBy(by) {\n if (locationKeyName === null) {\n pos = pos + by;\n }\n else {\n while (by > 0) {\n var chCode = content.charCodeAt(pos);\n if (chCode === 10 /* LINE_FEED */) {\n pos++;\n line++;\n char = 0;\n }\n else {\n pos++;\n char++;\n }\n by--;\n }\n }\n }\n function advancePosTo(to) {\n if (locationKeyName === null) {\n pos = to;\n }\n else {\n advancePosBy(to - pos);\n }\n }\n function skipWhitespace() {\n while (pos < len) {\n var chCode = content.charCodeAt(pos);\n if (chCode !== 32 /* SPACE */ && chCode !== 9 /* TAB */ && chCode !== 13 /* CARRIAGE_RETURN */ && chCode !== 10 /* LINE_FEED */) {\n break;\n }\n advancePosBy(1);\n }\n }\n function advanceIfStartsWith(str) {\n if (content.substr(pos, str.length) === str) {\n advancePosBy(str.length);\n return true;\n }\n return false;\n }\n function advanceUntil(str) {\n var nextOccurence = content.indexOf(str, pos);\n if (nextOccurence !== -1) {\n advancePosTo(nextOccurence + str.length);\n }\n else {\n // EOF\n advancePosTo(len);\n }\n }\n function captureUntil(str) {\n var nextOccurence = content.indexOf(str, pos);\n if (nextOccurence !== -1) {\n var r = content.substring(pos, nextOccurence);\n advancePosTo(nextOccurence + str.length);\n return r;\n }\n else {\n // EOF\n var r = content.substr(pos);\n advancePosTo(len);\n return r;\n }\n }\n var state = 0 /* ROOT_STATE */;\n var cur = null;\n var stateStack = [];\n var objStack = [];\n var curKey = null;\n function pushState(newState, newCur) {\n stateStack.push(state);\n objStack.push(cur);\n state = newState;\n cur = newCur;\n }\n function popState() {\n if (stateStack.length === 0) {\n return fail('illegal state stack');\n }\n state = stateStack.pop();\n cur = objStack.pop();\n }\n function fail(msg) {\n throw new Error('Near offset ' + pos + ': ' + msg + ' ~~~' + content.substr(pos, 50) + '~~~');\n }\n var dictState = {\n enterDict: function () {\n if (curKey === null) {\n return fail('missing ');\n }\n var newDict = {};\n if (locationKeyName !== null) {\n newDict[locationKeyName] = {\n filename: filename,\n line: line,\n char: char\n };\n }\n cur[curKey] = newDict;\n curKey = null;\n pushState(1 /* DICT_STATE */, newDict);\n },\n enterArray: function () {\n if (curKey === null) {\n return fail('missing ');\n }\n var newArr = [];\n cur[curKey] = newArr;\n curKey = null;\n pushState(2 /* ARR_STATE */, newArr);\n }\n };\n var arrState = {\n enterDict: function () {\n var newDict = {};\n if (locationKeyName !== null) {\n newDict[locationKeyName] = {\n filename: filename,\n line: line,\n char: char\n };\n }\n cur.push(newDict);\n pushState(1 /* DICT_STATE */, newDict);\n },\n enterArray: function () {\n var newArr = [];\n cur.push(newArr);\n pushState(2 /* ARR_STATE */, newArr);\n }\n };\n function enterDict() {\n if (state === 1 /* DICT_STATE */) {\n dictState.enterDict();\n }\n else if (state === 2 /* ARR_STATE */) {\n arrState.enterDict();\n }\n else { // ROOT_STATE\n cur = {};\n if (locationKeyName !== null) {\n cur[locationKeyName] = {\n filename: filename,\n line: line,\n char: char\n };\n }\n pushState(1 /* DICT_STATE */, cur);\n }\n }\n function leaveDict() {\n if (state === 1 /* DICT_STATE */) {\n popState();\n }\n else if (state === 2 /* ARR_STATE */) {\n return fail('unexpected ');\n }\n else { // ROOT_STATE\n return fail('unexpected ');\n }\n }\n function enterArray() {\n if (state === 1 /* DICT_STATE */) {\n dictState.enterArray();\n }\n else if (state === 2 /* ARR_STATE */) {\n arrState.enterArray();\n }\n else { // ROOT_STATE\n cur = [];\n pushState(2 /* ARR_STATE */, cur);\n }\n }\n function leaveArray() {\n if (state === 1 /* DICT_STATE */) {\n return fail('unexpected ');\n }\n else if (state === 2 /* ARR_STATE */) {\n popState();\n }\n else { // ROOT_STATE\n return fail('unexpected ');\n }\n }\n function acceptKey(val) {\n if (state === 1 /* DICT_STATE */) {\n if (curKey !== null) {\n return fail('too many ');\n }\n curKey = val;\n }\n else if (state === 2 /* ARR_STATE */) {\n return fail('unexpected ');\n }\n else { // ROOT_STATE\n return fail('unexpected ');\n }\n }\n function acceptString(val) {\n if (state === 1 /* DICT_STATE */) {\n if (curKey === null) {\n return fail('missing ');\n }\n cur[curKey] = val;\n curKey = null;\n }\n else if (state === 2 /* ARR_STATE */) {\n cur.push(val);\n }\n else { // ROOT_STATE\n cur = val;\n }\n }\n function acceptReal(val) {\n if (isNaN(val)) {\n return fail('cannot parse float');\n }\n if (state === 1 /* DICT_STATE */) {\n if (curKey === null) {\n return fail('missing ');\n }\n cur[curKey] = val;\n curKey = null;\n }\n else if (state === 2 /* ARR_STATE */) {\n cur.push(val);\n }\n else { // ROOT_STATE\n cur = val;\n }\n }\n function acceptInteger(val) {\n if (isNaN(val)) {\n return fail('cannot parse integer');\n }\n if (state === 1 /* DICT_STATE */) {\n if (curKey === null) {\n return fail('missing ');\n }\n cur[curKey] = val;\n curKey = null;\n }\n else if (state === 2 /* ARR_STATE */) {\n cur.push(val);\n }\n else { // ROOT_STATE\n cur = val;\n }\n }\n function acceptDate(val) {\n if (state === 1 /* DICT_STATE */) {\n if (curKey === null) {\n return fail('missing ');\n }\n cur[curKey] = val;\n curKey = null;\n }\n else if (state === 2 /* ARR_STATE */) {\n cur.push(val);\n }\n else { // ROOT_STATE\n cur = val;\n }\n }\n function acceptData(val) {\n if (state === 1 /* DICT_STATE */) {\n if (curKey === null) {\n return fail('missing ');\n }\n cur[curKey] = val;\n curKey = null;\n }\n else if (state === 2 /* ARR_STATE */) {\n cur.push(val);\n }\n else { // ROOT_STATE\n cur = val;\n }\n }\n function acceptBool(val) {\n if (state === 1 /* DICT_STATE */) {\n if (curKey === null) {\n return fail('missing ');\n }\n cur[curKey] = val;\n curKey = null;\n }\n else if (state === 2 /* ARR_STATE */) {\n cur.push(val);\n }\n else { // ROOT_STATE\n cur = val;\n }\n }\n function escapeVal(str) {\n return str.replace(/&#([0-9]+);/g, function (_, m0) {\n return String.fromCodePoint(parseInt(m0, 10));\n }).replace(/&#x([0-9a-f]+);/g, function (_, m0) {\n return String.fromCodePoint(parseInt(m0, 16));\n }).replace(/&|<|>|"|'/g, function (_) {\n switch (_) {\n case '&': return '&';\n case '<': return '<';\n case '>': return '>';\n case '"': return '\"';\n case ''': return '\\'';\n }\n return _;\n });\n }\n function parseOpenTag() {\n var r = captureUntil('>');\n var isClosed = false;\n if (r.charCodeAt(r.length - 1) === 47 /* SLASH */) {\n isClosed = true;\n r = r.substring(0, r.length - 1);\n }\n return {\n name: r.trim(),\n isClosed: isClosed\n };\n }\n function parseTagValue(tag) {\n if (tag.isClosed) {\n return '';\n }\n var val = captureUntil('');\n return escapeVal(val);\n }\n while (pos < len) {\n skipWhitespace();\n if (pos >= len) {\n break;\n }\n var chCode = content.charCodeAt(pos);\n advancePosBy(1);\n if (chCode !== 60 /* LESS_THAN */) {\n return fail('expected <');\n }\n if (pos >= len) {\n return fail('unexpected end of input');\n }\n var peekChCode = content.charCodeAt(pos);\n if (peekChCode === 63 /* QUESTION_MARK */) {\n advancePosBy(1);\n advanceUntil('?>');\n continue;\n }\n if (peekChCode === 33 /* EXCLAMATION_MARK */) {\n advancePosBy(1);\n if (advanceIfStartsWith('--')) {\n advanceUntil('-->');\n continue;\n }\n advanceUntil('>');\n continue;\n }\n if (peekChCode === 47 /* SLASH */) {\n advancePosBy(1);\n skipWhitespace();\n if (advanceIfStartsWith('plist')) {\n advanceUntil('>');\n continue;\n }\n if (advanceIfStartsWith('dict')) {\n advanceUntil('>');\n leaveDict();\n continue;\n }\n if (advanceIfStartsWith('array')) {\n advanceUntil('>');\n leaveArray();\n continue;\n }\n return fail('unexpected closed tag');\n }\n var tag = parseOpenTag();\n switch (tag.name) {\n case 'dict':\n enterDict();\n if (tag.isClosed) {\n leaveDict();\n }\n continue;\n case 'array':\n enterArray();\n if (tag.isClosed) {\n leaveArray();\n }\n continue;\n case 'key':\n acceptKey(parseTagValue(tag));\n continue;\n case 'string':\n acceptString(parseTagValue(tag));\n continue;\n case 'real':\n acceptReal(parseFloat(parseTagValue(tag)));\n continue;\n case 'integer':\n acceptInteger(parseInt(parseTagValue(tag), 10));\n continue;\n case 'date':\n acceptDate(new Date(parseTagValue(tag)));\n continue;\n case 'data':\n acceptData(parseTagValue(tag));\n continue;\n case 'true':\n parseTagValue(tag);\n acceptBool(true);\n continue;\n case 'false':\n parseTagValue(tag);\n acceptBool(false);\n continue;\n }\n if (/^plist/.test(tag.name)) {\n continue;\n }\n return fail('unexpected opened tag ' + tag.name);\n }\n return cur;\n}\n//# sourceMappingURL=plist.js.map","\"use strict\";\n/*---------------------------------------------------------\n * Copyright (C) Microsoft Corporation. All rights reserved.\n *--------------------------------------------------------*/\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.SyncRegistry = void 0;\nvar grammar_1 = require(\"./grammar\");\nvar SyncRegistry = /** @class */ (function () {\n function SyncRegistry(theme, onigLibPromise) {\n this._theme = theme;\n this._grammars = {};\n this._rawGrammars = {};\n this._injectionGrammars = {};\n this._onigLibPromise = onigLibPromise;\n }\n SyncRegistry.prototype.dispose = function () {\n for (var scopeName in this._grammars) {\n if (this._grammars.hasOwnProperty(scopeName)) {\n this._grammars[scopeName].dispose();\n }\n }\n };\n SyncRegistry.prototype.setTheme = function (theme) {\n var _this = this;\n this._theme = theme;\n Object.keys(this._grammars).forEach(function (scopeName) {\n var grammar = _this._grammars[scopeName];\n grammar.onDidChangeTheme();\n });\n };\n SyncRegistry.prototype.getColorMap = function () {\n return this._theme.getColorMap();\n };\n /**\n * Add `grammar` to registry and return a list of referenced scope names\n */\n SyncRegistry.prototype.addGrammar = function (grammar, injectionScopeNames) {\n this._rawGrammars[grammar.scopeName] = grammar;\n if (injectionScopeNames) {\n this._injectionGrammars[grammar.scopeName] = injectionScopeNames;\n }\n };\n /**\n * Lookup a raw grammar.\n */\n SyncRegistry.prototype.lookup = function (scopeName) {\n return this._rawGrammars[scopeName];\n };\n /**\n * Returns the injections for the given grammar\n */\n SyncRegistry.prototype.injections = function (targetScope) {\n return this._injectionGrammars[targetScope];\n };\n /**\n * Get the default theme settings\n */\n SyncRegistry.prototype.getDefaults = function () {\n return this._theme.getDefaults();\n };\n /**\n * Match a scope in the theme.\n */\n SyncRegistry.prototype.themeMatch = function (scopeName) {\n return this._theme.match(scopeName);\n };\n /**\n * Lookup a grammar.\n */\n SyncRegistry.prototype.grammarForScopeName = function (scopeName, initialLanguage, embeddedLanguages, tokenTypes) {\n return __awaiter(this, void 0, void 0, function () {\n var rawGrammar, _a, _b, _c, _d;\n return __generator(this, function (_e) {\n switch (_e.label) {\n case 0:\n if (!!this._grammars[scopeName]) return [3 /*break*/, 2];\n rawGrammar = this._rawGrammars[scopeName];\n if (!rawGrammar) {\n return [2 /*return*/, null];\n }\n _a = this._grammars;\n _b = scopeName;\n _c = grammar_1.createGrammar;\n _d = [rawGrammar, initialLanguage, embeddedLanguages, tokenTypes, this];\n return [4 /*yield*/, this._onigLibPromise];\n case 1:\n _a[_b] = _c.apply(void 0, _d.concat([_e.sent()]));\n _e.label = 2;\n case 2: return [2 /*return*/, this._grammars[scopeName]];\n }\n });\n });\n };\n return SyncRegistry;\n}());\nexports.SyncRegistry = SyncRegistry;\n//# sourceMappingURL=registry.js.map","\"use strict\";\n/*---------------------------------------------------------\n * Copyright (C) Microsoft Corporation. All rights reserved.\n *--------------------------------------------------------*/\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.RuleFactory = exports.BeginWhileRule = exports.BeginEndRule = exports.IncludeOnlyRule = exports.MatchRule = exports.RegExpSourceList = exports.RegExpSource = exports.CaptureRule = exports.Rule = exports.CompiledRule = void 0;\nvar utils_1 = require(\"./utils\");\nvar HAS_BACK_REFERENCES = /\\\\(\\d+)/;\nvar BACK_REFERENCING_END = /\\\\(\\d+)/g;\nvar CompiledRule = /** @class */ (function () {\n function CompiledRule(onigLib, regExps, rules) {\n this.debugRegExps = regExps;\n this.rules = rules;\n this.scanner = onigLib.createOnigScanner(regExps);\n }\n CompiledRule.prototype.dispose = function () {\n if (typeof this.scanner.dispose === 'function') {\n this.scanner.dispose();\n }\n };\n return CompiledRule;\n}());\nexports.CompiledRule = CompiledRule;\nvar Rule = /** @class */ (function () {\n function Rule($location, id, name, contentName) {\n this.$location = $location;\n this.id = id;\n this._name = name || null;\n this._nameIsCapturing = utils_1.RegexSource.hasCaptures(this._name);\n this._contentName = contentName || null;\n this._contentNameIsCapturing = utils_1.RegexSource.hasCaptures(this._contentName);\n }\n Object.defineProperty(Rule.prototype, \"debugName\", {\n get: function () {\n var location = this.$location ? utils_1.basename(this.$location.filename) + \":\" + this.$location.line : 'unknown';\n return this.constructor.name + \"#\" + this.id + \" @ \" + location;\n },\n enumerable: false,\n configurable: true\n });\n Rule.prototype.getName = function (lineText, captureIndices) {\n if (!this._nameIsCapturing || this._name === null || lineText === null || captureIndices === null) {\n return this._name;\n }\n return utils_1.RegexSource.replaceCaptures(this._name, lineText, captureIndices);\n };\n Rule.prototype.getContentName = function (lineText, captureIndices) {\n if (!this._contentNameIsCapturing || this._contentName === null) {\n return this._contentName;\n }\n return utils_1.RegexSource.replaceCaptures(this._contentName, lineText, captureIndices);\n };\n return Rule;\n}());\nexports.Rule = Rule;\nvar CaptureRule = /** @class */ (function (_super) {\n __extends(CaptureRule, _super);\n function CaptureRule($location, id, name, contentName, retokenizeCapturedWithRuleId) {\n var _this = _super.call(this, $location, id, name, contentName) || this;\n _this.retokenizeCapturedWithRuleId = retokenizeCapturedWithRuleId;\n return _this;\n }\n CaptureRule.prototype.dispose = function () {\n // nothing to dispose\n };\n CaptureRule.prototype.collectPatternsRecursive = function (grammar, out, isFirst) {\n throw new Error('Not supported!');\n };\n CaptureRule.prototype.compile = function (grammar, endRegexSource) {\n throw new Error('Not supported!');\n };\n CaptureRule.prototype.compileAG = function (grammar, endRegexSource, allowA, allowG) {\n throw new Error('Not supported!');\n };\n return CaptureRule;\n}(Rule));\nexports.CaptureRule = CaptureRule;\nvar RegExpSource = /** @class */ (function () {\n function RegExpSource(regExpSource, ruleId, handleAnchors) {\n if (handleAnchors === void 0) { handleAnchors = true; }\n if (handleAnchors) {\n if (regExpSource) {\n var len = regExpSource.length;\n var lastPushedPos = 0;\n var output = [];\n var hasAnchor = false;\n for (var pos = 0; pos < len; pos++) {\n var ch = regExpSource.charAt(pos);\n if (ch === '\\\\') {\n if (pos + 1 < len) {\n var nextCh = regExpSource.charAt(pos + 1);\n if (nextCh === 'z') {\n output.push(regExpSource.substring(lastPushedPos, pos));\n output.push('$(?!\\\\n)(? ' + this.source + ', ' + this.hasAnchor);\n }\n RegExpSource.prototype.clone = function () {\n return new RegExpSource(this.source, this.ruleId, true);\n };\n RegExpSource.prototype.setSource = function (newSource) {\n if (this.source === newSource) {\n return;\n }\n this.source = newSource;\n if (this.hasAnchor) {\n this._anchorCache = this._buildAnchorCache();\n }\n };\n RegExpSource.prototype.resolveBackReferences = function (lineText, captureIndices) {\n var capturedValues = captureIndices.map(function (capture) {\n return lineText.substring(capture.start, capture.end);\n });\n BACK_REFERENCING_END.lastIndex = 0;\n return this.source.replace(BACK_REFERENCING_END, function (match, g1) {\n return escapeRegExpCharacters(capturedValues[parseInt(g1, 10)] || '');\n });\n };\n RegExpSource.prototype._buildAnchorCache = function () {\n var A0_G0_result = [];\n var A0_G1_result = [];\n var A1_G0_result = [];\n var A1_G1_result = [];\n var pos, len, ch, nextCh;\n for (pos = 0, len = this.source.length; pos < len; pos++) {\n ch = this.source.charAt(pos);\n A0_G0_result[pos] = ch;\n A0_G1_result[pos] = ch;\n A1_G0_result[pos] = ch;\n A1_G1_result[pos] = ch;\n if (ch === '\\\\') {\n if (pos + 1 < len) {\n nextCh = this.source.charAt(pos + 1);\n if (nextCh === 'A') {\n A0_G0_result[pos + 1] = '\\uFFFF';\n A0_G1_result[pos + 1] = '\\uFFFF';\n A1_G0_result[pos + 1] = 'A';\n A1_G1_result[pos + 1] = 'A';\n }\n else if (nextCh === 'G') {\n A0_G0_result[pos + 1] = '\\uFFFF';\n A0_G1_result[pos + 1] = 'G';\n A1_G0_result[pos + 1] = '\\uFFFF';\n A1_G1_result[pos + 1] = 'G';\n }\n else {\n A0_G0_result[pos + 1] = nextCh;\n A0_G1_result[pos + 1] = nextCh;\n A1_G0_result[pos + 1] = nextCh;\n A1_G1_result[pos + 1] = nextCh;\n }\n pos++;\n }\n }\n }\n return {\n A0_G0: A0_G0_result.join(''),\n A0_G1: A0_G1_result.join(''),\n A1_G0: A1_G0_result.join(''),\n A1_G1: A1_G1_result.join('')\n };\n };\n RegExpSource.prototype.resolveAnchors = function (allowA, allowG) {\n if (!this.hasAnchor || !this._anchorCache) {\n return this.source;\n }\n if (allowA) {\n if (allowG) {\n return this._anchorCache.A1_G1;\n }\n else {\n return this._anchorCache.A1_G0;\n }\n }\n else {\n if (allowG) {\n return this._anchorCache.A0_G1;\n }\n else {\n return this._anchorCache.A0_G0;\n }\n }\n };\n return RegExpSource;\n}());\nexports.RegExpSource = RegExpSource;\nvar RegExpSourceList = /** @class */ (function () {\n function RegExpSourceList() {\n this._items = [];\n this._hasAnchors = false;\n this._cached = null;\n this._anchorCache = {\n A0_G0: null,\n A0_G1: null,\n A1_G0: null,\n A1_G1: null\n };\n }\n RegExpSourceList.prototype.dispose = function () {\n this._disposeCaches();\n };\n RegExpSourceList.prototype._disposeCaches = function () {\n if (this._cached) {\n this._cached.dispose();\n this._cached = null;\n }\n if (this._anchorCache.A0_G0) {\n this._anchorCache.A0_G0.dispose();\n this._anchorCache.A0_G0 = null;\n }\n if (this._anchorCache.A0_G1) {\n this._anchorCache.A0_G1.dispose();\n this._anchorCache.A0_G1 = null;\n }\n if (this._anchorCache.A1_G0) {\n this._anchorCache.A1_G0.dispose();\n this._anchorCache.A1_G0 = null;\n }\n if (this._anchorCache.A1_G1) {\n this._anchorCache.A1_G1.dispose();\n this._anchorCache.A1_G1 = null;\n }\n };\n RegExpSourceList.prototype.push = function (item) {\n this._items.push(item);\n this._hasAnchors = this._hasAnchors || item.hasAnchor;\n };\n RegExpSourceList.prototype.unshift = function (item) {\n this._items.unshift(item);\n this._hasAnchors = this._hasAnchors || item.hasAnchor;\n };\n RegExpSourceList.prototype.length = function () {\n return this._items.length;\n };\n RegExpSourceList.prototype.setSource = function (index, newSource) {\n if (this._items[index].source !== newSource) {\n // bust the cache\n this._disposeCaches();\n this._items[index].setSource(newSource);\n }\n };\n RegExpSourceList.prototype.compile = function (onigLib) {\n if (!this._cached) {\n var regExps = this._items.map(function (e) { return e.source; });\n this._cached = new CompiledRule(onigLib, regExps, this._items.map(function (e) { return e.ruleId; }));\n }\n return this._cached;\n };\n RegExpSourceList.prototype.compileAG = function (onigLib, allowA, allowG) {\n if (!this._hasAnchors) {\n return this.compile(onigLib);\n }\n else {\n if (allowA) {\n if (allowG) {\n if (!this._anchorCache.A1_G1) {\n this._anchorCache.A1_G1 = this._resolveAnchors(onigLib, allowA, allowG);\n }\n return this._anchorCache.A1_G1;\n }\n else {\n if (!this._anchorCache.A1_G0) {\n this._anchorCache.A1_G0 = this._resolveAnchors(onigLib, allowA, allowG);\n }\n return this._anchorCache.A1_G0;\n }\n }\n else {\n if (allowG) {\n if (!this._anchorCache.A0_G1) {\n this._anchorCache.A0_G1 = this._resolveAnchors(onigLib, allowA, allowG);\n }\n return this._anchorCache.A0_G1;\n }\n else {\n if (!this._anchorCache.A0_G0) {\n this._anchorCache.A0_G0 = this._resolveAnchors(onigLib, allowA, allowG);\n }\n return this._anchorCache.A0_G0;\n }\n }\n }\n };\n RegExpSourceList.prototype._resolveAnchors = function (onigLib, allowA, allowG) {\n var regExps = this._items.map(function (e) { return e.resolveAnchors(allowA, allowG); });\n return new CompiledRule(onigLib, regExps, this._items.map(function (e) { return e.ruleId; }));\n };\n return RegExpSourceList;\n}());\nexports.RegExpSourceList = RegExpSourceList;\nvar MatchRule = /** @class */ (function (_super) {\n __extends(MatchRule, _super);\n function MatchRule($location, id, name, match, captures) {\n var _this = _super.call(this, $location, id, name, null) || this;\n _this._match = new RegExpSource(match, _this.id);\n _this.captures = captures;\n _this._cachedCompiledPatterns = null;\n return _this;\n }\n MatchRule.prototype.dispose = function () {\n if (this._cachedCompiledPatterns) {\n this._cachedCompiledPatterns.dispose();\n this._cachedCompiledPatterns = null;\n }\n };\n Object.defineProperty(MatchRule.prototype, \"debugMatchRegExp\", {\n get: function () {\n return \"\" + this._match.source;\n },\n enumerable: false,\n configurable: true\n });\n MatchRule.prototype.collectPatternsRecursive = function (grammar, out, isFirst) {\n out.push(this._match);\n };\n MatchRule.prototype.compile = function (grammar, endRegexSource) {\n return this._getCachedCompiledPatterns(grammar).compile(grammar);\n };\n MatchRule.prototype.compileAG = function (grammar, endRegexSource, allowA, allowG) {\n return this._getCachedCompiledPatterns(grammar).compileAG(grammar, allowA, allowG);\n };\n MatchRule.prototype._getCachedCompiledPatterns = function (grammar) {\n if (!this._cachedCompiledPatterns) {\n this._cachedCompiledPatterns = new RegExpSourceList();\n this.collectPatternsRecursive(grammar, this._cachedCompiledPatterns, true);\n }\n return this._cachedCompiledPatterns;\n };\n return MatchRule;\n}(Rule));\nexports.MatchRule = MatchRule;\nvar IncludeOnlyRule = /** @class */ (function (_super) {\n __extends(IncludeOnlyRule, _super);\n function IncludeOnlyRule($location, id, name, contentName, patterns) {\n var _this = _super.call(this, $location, id, name, contentName) || this;\n _this.patterns = patterns.patterns;\n _this.hasMissingPatterns = patterns.hasMissingPatterns;\n _this._cachedCompiledPatterns = null;\n return _this;\n }\n IncludeOnlyRule.prototype.dispose = function () {\n if (this._cachedCompiledPatterns) {\n this._cachedCompiledPatterns.dispose();\n this._cachedCompiledPatterns = null;\n }\n };\n IncludeOnlyRule.prototype.collectPatternsRecursive = function (grammar, out, isFirst) {\n var i, len, rule;\n for (i = 0, len = this.patterns.length; i < len; i++) {\n rule = grammar.getRule(this.patterns[i]);\n rule.collectPatternsRecursive(grammar, out, false);\n }\n };\n IncludeOnlyRule.prototype.compile = function (grammar, endRegexSource) {\n return this._getCachedCompiledPatterns(grammar).compile(grammar);\n };\n IncludeOnlyRule.prototype.compileAG = function (grammar, endRegexSource, allowA, allowG) {\n return this._getCachedCompiledPatterns(grammar).compileAG(grammar, allowA, allowG);\n };\n IncludeOnlyRule.prototype._getCachedCompiledPatterns = function (grammar) {\n if (!this._cachedCompiledPatterns) {\n this._cachedCompiledPatterns = new RegExpSourceList();\n this.collectPatternsRecursive(grammar, this._cachedCompiledPatterns, true);\n }\n return this._cachedCompiledPatterns;\n };\n return IncludeOnlyRule;\n}(Rule));\nexports.IncludeOnlyRule = IncludeOnlyRule;\nfunction escapeRegExpCharacters(value) {\n return value.replace(/[\\-\\\\\\{\\}\\*\\+\\?\\|\\^\\$\\.\\,\\[\\]\\(\\)\\#\\s]/g, '\\\\$&');\n}\nvar BeginEndRule = /** @class */ (function (_super) {\n __extends(BeginEndRule, _super);\n function BeginEndRule($location, id, name, contentName, begin, beginCaptures, end, endCaptures, applyEndPatternLast, patterns) {\n var _this = _super.call(this, $location, id, name, contentName) || this;\n _this._begin = new RegExpSource(begin, _this.id);\n _this.beginCaptures = beginCaptures;\n _this._end = new RegExpSource(end ? end : '\\uFFFF', -1);\n _this.endHasBackReferences = _this._end.hasBackReferences;\n _this.endCaptures = endCaptures;\n _this.applyEndPatternLast = applyEndPatternLast || false;\n _this.patterns = patterns.patterns;\n _this.hasMissingPatterns = patterns.hasMissingPatterns;\n _this._cachedCompiledPatterns = null;\n return _this;\n }\n BeginEndRule.prototype.dispose = function () {\n if (this._cachedCompiledPatterns) {\n this._cachedCompiledPatterns.dispose();\n this._cachedCompiledPatterns = null;\n }\n };\n Object.defineProperty(BeginEndRule.prototype, \"debugBeginRegExp\", {\n get: function () {\n return \"\" + this._begin.source;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BeginEndRule.prototype, \"debugEndRegExp\", {\n get: function () {\n return \"\" + this._end.source;\n },\n enumerable: false,\n configurable: true\n });\n BeginEndRule.prototype.getEndWithResolvedBackReferences = function (lineText, captureIndices) {\n return this._end.resolveBackReferences(lineText, captureIndices);\n };\n BeginEndRule.prototype.collectPatternsRecursive = function (grammar, out, isFirst) {\n if (isFirst) {\n var i = void 0, len = void 0, rule = void 0;\n for (i = 0, len = this.patterns.length; i < len; i++) {\n rule = grammar.getRule(this.patterns[i]);\n rule.collectPatternsRecursive(grammar, out, false);\n }\n }\n else {\n out.push(this._begin);\n }\n };\n BeginEndRule.prototype.compile = function (grammar, endRegexSource) {\n return this._getCachedCompiledPatterns(grammar, endRegexSource).compile(grammar);\n };\n BeginEndRule.prototype.compileAG = function (grammar, endRegexSource, allowA, allowG) {\n return this._getCachedCompiledPatterns(grammar, endRegexSource).compileAG(grammar, allowA, allowG);\n };\n BeginEndRule.prototype._getCachedCompiledPatterns = function (grammar, endRegexSource) {\n if (!this._cachedCompiledPatterns) {\n this._cachedCompiledPatterns = new RegExpSourceList();\n this.collectPatternsRecursive(grammar, this._cachedCompiledPatterns, true);\n if (this.applyEndPatternLast) {\n this._cachedCompiledPatterns.push(this._end.hasBackReferences ? this._end.clone() : this._end);\n }\n else {\n this._cachedCompiledPatterns.unshift(this._end.hasBackReferences ? this._end.clone() : this._end);\n }\n }\n if (this._end.hasBackReferences) {\n if (this.applyEndPatternLast) {\n this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length() - 1, endRegexSource);\n }\n else {\n this._cachedCompiledPatterns.setSource(0, endRegexSource);\n }\n }\n return this._cachedCompiledPatterns;\n };\n return BeginEndRule;\n}(Rule));\nexports.BeginEndRule = BeginEndRule;\nvar BeginWhileRule = /** @class */ (function (_super) {\n __extends(BeginWhileRule, _super);\n function BeginWhileRule($location, id, name, contentName, begin, beginCaptures, _while, whileCaptures, patterns) {\n var _this = _super.call(this, $location, id, name, contentName) || this;\n _this._begin = new RegExpSource(begin, _this.id);\n _this.beginCaptures = beginCaptures;\n _this.whileCaptures = whileCaptures;\n _this._while = new RegExpSource(_while, -2);\n _this.whileHasBackReferences = _this._while.hasBackReferences;\n _this.patterns = patterns.patterns;\n _this.hasMissingPatterns = patterns.hasMissingPatterns;\n _this._cachedCompiledPatterns = null;\n _this._cachedCompiledWhilePatterns = null;\n return _this;\n }\n BeginWhileRule.prototype.dispose = function () {\n if (this._cachedCompiledPatterns) {\n this._cachedCompiledPatterns.dispose();\n this._cachedCompiledPatterns = null;\n }\n if (this._cachedCompiledWhilePatterns) {\n this._cachedCompiledWhilePatterns.dispose();\n this._cachedCompiledWhilePatterns = null;\n }\n };\n Object.defineProperty(BeginWhileRule.prototype, \"debugBeginRegExp\", {\n get: function () {\n return \"\" + this._begin.source;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BeginWhileRule.prototype, \"debugWhileRegExp\", {\n get: function () {\n return \"\" + this._while.source;\n },\n enumerable: false,\n configurable: true\n });\n BeginWhileRule.prototype.getWhileWithResolvedBackReferences = function (lineText, captureIndices) {\n return this._while.resolveBackReferences(lineText, captureIndices);\n };\n BeginWhileRule.prototype.collectPatternsRecursive = function (grammar, out, isFirst) {\n if (isFirst) {\n var i = void 0, len = void 0, rule = void 0;\n for (i = 0, len = this.patterns.length; i < len; i++) {\n rule = grammar.getRule(this.patterns[i]);\n rule.collectPatternsRecursive(grammar, out, false);\n }\n }\n else {\n out.push(this._begin);\n }\n };\n BeginWhileRule.prototype.compile = function (grammar, endRegexSource) {\n return this._getCachedCompiledPatterns(grammar).compile(grammar);\n };\n BeginWhileRule.prototype.compileAG = function (grammar, endRegexSource, allowA, allowG) {\n return this._getCachedCompiledPatterns(grammar).compileAG(grammar, allowA, allowG);\n };\n BeginWhileRule.prototype._getCachedCompiledPatterns = function (grammar) {\n if (!this._cachedCompiledPatterns) {\n this._cachedCompiledPatterns = new RegExpSourceList();\n this.collectPatternsRecursive(grammar, this._cachedCompiledPatterns, true);\n }\n return this._cachedCompiledPatterns;\n };\n BeginWhileRule.prototype.compileWhile = function (grammar, endRegexSource) {\n return this._getCachedCompiledWhilePatterns(grammar, endRegexSource).compile(grammar);\n };\n BeginWhileRule.prototype.compileWhileAG = function (grammar, endRegexSource, allowA, allowG) {\n return this._getCachedCompiledWhilePatterns(grammar, endRegexSource).compileAG(grammar, allowA, allowG);\n };\n BeginWhileRule.prototype._getCachedCompiledWhilePatterns = function (grammar, endRegexSource) {\n if (!this._cachedCompiledWhilePatterns) {\n this._cachedCompiledWhilePatterns = new RegExpSourceList();\n this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences ? this._while.clone() : this._while);\n }\n if (this._while.hasBackReferences) {\n this._cachedCompiledWhilePatterns.setSource(0, endRegexSource ? endRegexSource : '\\uFFFF');\n }\n return this._cachedCompiledWhilePatterns;\n };\n return BeginWhileRule;\n}(Rule));\nexports.BeginWhileRule = BeginWhileRule;\nvar RuleFactory = /** @class */ (function () {\n function RuleFactory() {\n }\n RuleFactory.createCaptureRule = function (helper, $location, name, contentName, retokenizeCapturedWithRuleId) {\n return helper.registerRule(function (id) {\n return new CaptureRule($location, id, name, contentName, retokenizeCapturedWithRuleId);\n });\n };\n RuleFactory.getCompiledRuleId = function (desc, helper, repository) {\n if (!desc.id) {\n helper.registerRule(function (id) {\n desc.id = id;\n if (desc.match) {\n return new MatchRule(desc.$vscodeTextmateLocation, desc.id, desc.name, desc.match, RuleFactory._compileCaptures(desc.captures, helper, repository));\n }\n if (typeof desc.begin === 'undefined') {\n if (desc.repository) {\n repository = utils_1.mergeObjects({}, repository, desc.repository);\n }\n var patterns = desc.patterns;\n if (typeof patterns === 'undefined' && desc.include) {\n patterns = [{ include: desc.include }];\n }\n return new IncludeOnlyRule(desc.$vscodeTextmateLocation, desc.id, desc.name, desc.contentName, RuleFactory._compilePatterns(patterns, helper, repository));\n }\n if (desc.while) {\n return new BeginWhileRule(desc.$vscodeTextmateLocation, desc.id, desc.name, desc.contentName, desc.begin, RuleFactory._compileCaptures(desc.beginCaptures || desc.captures, helper, repository), desc.while, RuleFactory._compileCaptures(desc.whileCaptures || desc.captures, helper, repository), RuleFactory._compilePatterns(desc.patterns, helper, repository));\n }\n return new BeginEndRule(desc.$vscodeTextmateLocation, desc.id, desc.name, desc.contentName, desc.begin, RuleFactory._compileCaptures(desc.beginCaptures || desc.captures, helper, repository), desc.end, RuleFactory._compileCaptures(desc.endCaptures || desc.captures, helper, repository), desc.applyEndPatternLast, RuleFactory._compilePatterns(desc.patterns, helper, repository));\n });\n }\n return desc.id;\n };\n RuleFactory._compileCaptures = function (captures, helper, repository) {\n var r = [];\n if (captures) {\n // Find the maximum capture id\n var maximumCaptureId = 0;\n for (var captureId in captures) {\n if (captureId === '$vscodeTextmateLocation') {\n continue;\n }\n var numericCaptureId = parseInt(captureId, 10);\n if (numericCaptureId > maximumCaptureId) {\n maximumCaptureId = numericCaptureId;\n }\n }\n // Initialize result\n for (var i = 0; i <= maximumCaptureId; i++) {\n r[i] = null;\n }\n // Fill out result\n for (var captureId in captures) {\n if (captureId === '$vscodeTextmateLocation') {\n continue;\n }\n var numericCaptureId = parseInt(captureId, 10);\n var retokenizeCapturedWithRuleId = 0;\n if (captures[captureId].patterns) {\n retokenizeCapturedWithRuleId = RuleFactory.getCompiledRuleId(captures[captureId], helper, repository);\n }\n r[numericCaptureId] = RuleFactory.createCaptureRule(helper, captures[captureId].$vscodeTextmateLocation, captures[captureId].name, captures[captureId].contentName, retokenizeCapturedWithRuleId);\n }\n }\n return r;\n };\n RuleFactory._compilePatterns = function (patterns, helper, repository) {\n var r = [];\n if (patterns) {\n for (var i = 0, len = patterns.length; i < len; i++) {\n var pattern = patterns[i];\n var patternId = -1;\n if (pattern.include) {\n if (pattern.include.charAt(0) === '#') {\n // Local include found in `repository`\n var localIncludedRule = repository[pattern.include.substr(1)];\n if (localIncludedRule) {\n patternId = RuleFactory.getCompiledRuleId(localIncludedRule, helper, repository);\n }\n else {\n // console.warn('CANNOT find rule for scopeName: ' + pattern.include + ', I am: ', repository['$base'].name);\n }\n }\n else if (pattern.include === '$base' || pattern.include === '$self') {\n // Special include also found in `repository`\n patternId = RuleFactory.getCompiledRuleId(repository[pattern.include], helper, repository);\n }\n else {\n var externalGrammarName = null;\n var externalGrammarInclude = null;\n var sharpIndex = pattern.include.indexOf('#');\n if (sharpIndex >= 0) {\n externalGrammarName = pattern.include.substring(0, sharpIndex);\n externalGrammarInclude = pattern.include.substring(sharpIndex + 1);\n }\n else {\n externalGrammarName = pattern.include;\n }\n // External include\n var externalGrammar = helper.getExternalGrammar(externalGrammarName, repository);\n if (externalGrammar) {\n if (externalGrammarInclude) {\n var externalIncludedRule = externalGrammar.repository[externalGrammarInclude];\n if (externalIncludedRule) {\n patternId = RuleFactory.getCompiledRuleId(externalIncludedRule, helper, externalGrammar.repository);\n }\n else {\n // console.warn('CANNOT find rule for scopeName: ' + pattern.include + ', I am: ', repository['$base'].name);\n }\n }\n else {\n patternId = RuleFactory.getCompiledRuleId(externalGrammar.repository.$self, helper, externalGrammar.repository);\n }\n }\n else {\n // console.warn('CANNOT find grammar for scopeName: ' + pattern.include + ', I am: ', repository['$base'].name);\n }\n }\n }\n else {\n patternId = RuleFactory.getCompiledRuleId(pattern, helper, repository);\n }\n if (patternId !== -1) {\n var rule = helper.getRule(patternId);\n var skipRule = false;\n if (rule instanceof IncludeOnlyRule || rule instanceof BeginEndRule || rule instanceof BeginWhileRule) {\n if (rule.hasMissingPatterns && rule.patterns.length === 0) {\n skipRule = true;\n }\n }\n if (skipRule) {\n // console.log('REMOVING RULE ENTIRELY DUE TO EMPTY PATTERNS THAT ARE MISSING');\n continue;\n }\n r.push(patternId);\n }\n }\n }\n return {\n patterns: r,\n hasMissingPatterns: ((patterns ? patterns.length : 0) !== r.length)\n };\n };\n return RuleFactory;\n}());\nexports.RuleFactory = RuleFactory;\n//# sourceMappingURL=rule.js.map","\"use strict\";\n/*---------------------------------------------------------\n * Copyright (C) Microsoft Corporation. All rights reserved.\n *--------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ThemeTrieElement = exports.ThemeTrieElementRule = exports.strArrCmp = exports.strcmp = exports.Theme = exports.ColorMap = exports.parseTheme = exports.ParsedThemeRule = void 0;\nvar ParsedThemeRule = /** @class */ (function () {\n function ParsedThemeRule(scope, parentScopes, index, fontStyle, foreground, background) {\n this.scope = scope;\n this.parentScopes = parentScopes;\n this.index = index;\n this.fontStyle = fontStyle;\n this.foreground = foreground;\n this.background = background;\n }\n return ParsedThemeRule;\n}());\nexports.ParsedThemeRule = ParsedThemeRule;\nfunction isValidHexColor(hex) {\n if (/^#[0-9a-f]{6}$/i.test(hex)) {\n // #rrggbb\n return true;\n }\n if (/^#[0-9a-f]{8}$/i.test(hex)) {\n // #rrggbbaa\n return true;\n }\n if (/^#[0-9a-f]{3}$/i.test(hex)) {\n // #rgb\n return true;\n }\n if (/^#[0-9a-f]{4}$/i.test(hex)) {\n // #rgba\n return true;\n }\n return false;\n}\n/**\n * Parse a raw theme into rules.\n */\nfunction parseTheme(source) {\n if (!source) {\n return [];\n }\n if (!source.settings || !Array.isArray(source.settings)) {\n return [];\n }\n var settings = source.settings;\n var result = [], resultLen = 0;\n for (var i = 0, len = settings.length; i < len; i++) {\n var entry = settings[i];\n if (!entry.settings) {\n continue;\n }\n var scopes = void 0;\n if (typeof entry.scope === 'string') {\n var _scope = entry.scope;\n // remove leading commas\n _scope = _scope.replace(/^[,]+/, '');\n // remove trailing commans\n _scope = _scope.replace(/[,]+$/, '');\n scopes = _scope.split(',');\n }\n else if (Array.isArray(entry.scope)) {\n scopes = entry.scope;\n }\n else {\n scopes = [''];\n }\n var fontStyle = -1 /* NotSet */;\n if (typeof entry.settings.fontStyle === 'string') {\n fontStyle = 0 /* None */;\n var segments = entry.settings.fontStyle.split(' ');\n for (var j = 0, lenJ = segments.length; j < lenJ; j++) {\n var segment = segments[j];\n switch (segment) {\n case 'italic':\n fontStyle = fontStyle | 1 /* Italic */;\n break;\n case 'bold':\n fontStyle = fontStyle | 2 /* Bold */;\n break;\n case 'underline':\n fontStyle = fontStyle | 4 /* Underline */;\n break;\n }\n }\n }\n var foreground = null;\n if (typeof entry.settings.foreground === 'string' && isValidHexColor(entry.settings.foreground)) {\n foreground = entry.settings.foreground;\n }\n var background = null;\n if (typeof entry.settings.background === 'string' && isValidHexColor(entry.settings.background)) {\n background = entry.settings.background;\n }\n for (var j = 0, lenJ = scopes.length; j < lenJ; j++) {\n var _scope = scopes[j].trim();\n var segments = _scope.split(' ');\n var scope = segments[segments.length - 1];\n var parentScopes = null;\n if (segments.length > 1) {\n parentScopes = segments.slice(0, segments.length - 1);\n parentScopes.reverse();\n }\n result[resultLen++] = new ParsedThemeRule(scope, parentScopes, i, fontStyle, foreground, background);\n }\n }\n return result;\n}\nexports.parseTheme = parseTheme;\n/**\n * Resolve rules (i.e. inheritance).\n */\nfunction resolveParsedThemeRules(parsedThemeRules, _colorMap) {\n // Sort rules lexicographically, and then by index if necessary\n parsedThemeRules.sort(function (a, b) {\n var r = strcmp(a.scope, b.scope);\n if (r !== 0) {\n return r;\n }\n r = strArrCmp(a.parentScopes, b.parentScopes);\n if (r !== 0) {\n return r;\n }\n return a.index - b.index;\n });\n // Determine defaults\n var defaultFontStyle = 0 /* None */;\n var defaultForeground = '#000000';\n var defaultBackground = '#ffffff';\n while (parsedThemeRules.length >= 1 && parsedThemeRules[0].scope === '') {\n var incomingDefaults = parsedThemeRules.shift();\n if (incomingDefaults.fontStyle !== -1 /* NotSet */) {\n defaultFontStyle = incomingDefaults.fontStyle;\n }\n if (incomingDefaults.foreground !== null) {\n defaultForeground = incomingDefaults.foreground;\n }\n if (incomingDefaults.background !== null) {\n defaultBackground = incomingDefaults.background;\n }\n }\n var colorMap = new ColorMap(_colorMap);\n var defaults = new ThemeTrieElementRule(0, null, defaultFontStyle, colorMap.getId(defaultForeground), colorMap.getId(defaultBackground));\n var root = new ThemeTrieElement(new ThemeTrieElementRule(0, null, -1 /* NotSet */, 0, 0), []);\n for (var i = 0, len = parsedThemeRules.length; i < len; i++) {\n var rule = parsedThemeRules[i];\n root.insert(0, rule.scope, rule.parentScopes, rule.fontStyle, colorMap.getId(rule.foreground), colorMap.getId(rule.background));\n }\n return new Theme(colorMap, defaults, root);\n}\nvar ColorMap = /** @class */ (function () {\n function ColorMap(_colorMap) {\n this._lastColorId = 0;\n this._id2color = [];\n this._color2id = Object.create(null);\n if (Array.isArray(_colorMap)) {\n this._isFrozen = true;\n for (var i = 0, len = _colorMap.length; i < len; i++) {\n this._color2id[_colorMap[i]] = i;\n this._id2color[i] = _colorMap[i];\n }\n }\n else {\n this._isFrozen = false;\n }\n }\n ColorMap.prototype.getId = function (color) {\n if (color === null) {\n return 0;\n }\n color = color.toUpperCase();\n var value = this._color2id[color];\n if (value) {\n return value;\n }\n if (this._isFrozen) {\n throw new Error(\"Missing color in color map - \" + color);\n }\n value = ++this._lastColorId;\n this._color2id[color] = value;\n this._id2color[value] = color;\n return value;\n };\n ColorMap.prototype.getColorMap = function () {\n return this._id2color.slice(0);\n };\n return ColorMap;\n}());\nexports.ColorMap = ColorMap;\nvar Theme = /** @class */ (function () {\n function Theme(colorMap, defaults, root) {\n this._colorMap = colorMap;\n this._root = root;\n this._defaults = defaults;\n this._cache = {};\n }\n Theme.createFromRawTheme = function (source, colorMap) {\n return this.createFromParsedTheme(parseTheme(source), colorMap);\n };\n Theme.createFromParsedTheme = function (source, colorMap) {\n return resolveParsedThemeRules(source, colorMap);\n };\n Theme.prototype.getColorMap = function () {\n return this._colorMap.getColorMap();\n };\n Theme.prototype.getDefaults = function () {\n return this._defaults;\n };\n Theme.prototype.match = function (scopeName) {\n if (!this._cache.hasOwnProperty(scopeName)) {\n this._cache[scopeName] = this._root.match(scopeName);\n }\n return this._cache[scopeName];\n };\n return Theme;\n}());\nexports.Theme = Theme;\nfunction strcmp(a, b) {\n if (a < b) {\n return -1;\n }\n if (a > b) {\n return 1;\n }\n return 0;\n}\nexports.strcmp = strcmp;\nfunction strArrCmp(a, b) {\n if (a === null && b === null) {\n return 0;\n }\n if (!a) {\n return -1;\n }\n if (!b) {\n return 1;\n }\n var len1 = a.length;\n var len2 = b.length;\n if (len1 === len2) {\n for (var i = 0; i < len1; i++) {\n var res = strcmp(a[i], b[i]);\n if (res !== 0) {\n return res;\n }\n }\n return 0;\n }\n return len1 - len2;\n}\nexports.strArrCmp = strArrCmp;\nvar ThemeTrieElementRule = /** @class */ (function () {\n function ThemeTrieElementRule(scopeDepth, parentScopes, fontStyle, foreground, background) {\n this.scopeDepth = scopeDepth;\n this.parentScopes = parentScopes;\n this.fontStyle = fontStyle;\n this.foreground = foreground;\n this.background = background;\n }\n ThemeTrieElementRule.prototype.clone = function () {\n return new ThemeTrieElementRule(this.scopeDepth, this.parentScopes, this.fontStyle, this.foreground, this.background);\n };\n ThemeTrieElementRule.cloneArr = function (arr) {\n var r = [];\n for (var i = 0, len = arr.length; i < len; i++) {\n r[i] = arr[i].clone();\n }\n return r;\n };\n ThemeTrieElementRule.prototype.acceptOverwrite = function (scopeDepth, fontStyle, foreground, background) {\n if (this.scopeDepth > scopeDepth) {\n console.log('how did this happen?');\n }\n else {\n this.scopeDepth = scopeDepth;\n }\n // console.log('TODO -> my depth: ' + this.scopeDepth + ', overwriting depth: ' + scopeDepth);\n if (fontStyle !== -1 /* NotSet */) {\n this.fontStyle = fontStyle;\n }\n if (foreground !== 0) {\n this.foreground = foreground;\n }\n if (background !== 0) {\n this.background = background;\n }\n };\n return ThemeTrieElementRule;\n}());\nexports.ThemeTrieElementRule = ThemeTrieElementRule;\nvar ThemeTrieElement = /** @class */ (function () {\n function ThemeTrieElement(mainRule, rulesWithParentScopes, children) {\n if (rulesWithParentScopes === void 0) { rulesWithParentScopes = []; }\n if (children === void 0) { children = {}; }\n this._mainRule = mainRule;\n this._rulesWithParentScopes = rulesWithParentScopes;\n this._children = children;\n }\n ThemeTrieElement._sortBySpecificity = function (arr) {\n if (arr.length === 1) {\n return arr;\n }\n arr.sort(this._cmpBySpecificity);\n return arr;\n };\n ThemeTrieElement._cmpBySpecificity = function (a, b) {\n if (a.scopeDepth === b.scopeDepth) {\n var aParentScopes = a.parentScopes;\n var bParentScopes = b.parentScopes;\n var aParentScopesLen = aParentScopes === null ? 0 : aParentScopes.length;\n var bParentScopesLen = bParentScopes === null ? 0 : bParentScopes.length;\n if (aParentScopesLen === bParentScopesLen) {\n for (var i = 0; i < aParentScopesLen; i++) {\n var aLen = aParentScopes[i].length;\n var bLen = bParentScopes[i].length;\n if (aLen !== bLen) {\n return bLen - aLen;\n }\n }\n }\n return bParentScopesLen - aParentScopesLen;\n }\n return b.scopeDepth - a.scopeDepth;\n };\n ThemeTrieElement.prototype.match = function (scope) {\n if (scope === '') {\n return ThemeTrieElement._sortBySpecificity([].concat(this._mainRule).concat(this._rulesWithParentScopes));\n }\n var dotIndex = scope.indexOf('.');\n var head;\n var tail;\n if (dotIndex === -1) {\n head = scope;\n tail = '';\n }\n else {\n head = scope.substring(0, dotIndex);\n tail = scope.substring(dotIndex + 1);\n }\n if (this._children.hasOwnProperty(head)) {\n return this._children[head].match(tail);\n }\n return ThemeTrieElement._sortBySpecificity([].concat(this._mainRule).concat(this._rulesWithParentScopes));\n };\n ThemeTrieElement.prototype.insert = function (scopeDepth, scope, parentScopes, fontStyle, foreground, background) {\n if (scope === '') {\n this._doInsertHere(scopeDepth, parentScopes, fontStyle, foreground, background);\n return;\n }\n var dotIndex = scope.indexOf('.');\n var head;\n var tail;\n if (dotIndex === -1) {\n head = scope;\n tail = '';\n }\n else {\n head = scope.substring(0, dotIndex);\n tail = scope.substring(dotIndex + 1);\n }\n var child;\n if (this._children.hasOwnProperty(head)) {\n child = this._children[head];\n }\n else {\n child = new ThemeTrieElement(this._mainRule.clone(), ThemeTrieElementRule.cloneArr(this._rulesWithParentScopes));\n this._children[head] = child;\n }\n child.insert(scopeDepth + 1, tail, parentScopes, fontStyle, foreground, background);\n };\n ThemeTrieElement.prototype._doInsertHere = function (scopeDepth, parentScopes, fontStyle, foreground, background) {\n if (parentScopes === null) {\n // Merge into the main rule\n this._mainRule.acceptOverwrite(scopeDepth, fontStyle, foreground, background);\n return;\n }\n // Try to merge into existing rule\n for (var i = 0, len = this._rulesWithParentScopes.length; i < len; i++) {\n var rule = this._rulesWithParentScopes[i];\n if (strArrCmp(rule.parentScopes, parentScopes) === 0) {\n // bingo! => we get to merge this into an existing one\n rule.acceptOverwrite(scopeDepth, fontStyle, foreground, background);\n return;\n }\n }\n // Must add a new rule\n // Inherit from main rule\n if (fontStyle === -1 /* NotSet */) {\n fontStyle = this._mainRule.fontStyle;\n }\n if (foreground === 0) {\n foreground = this._mainRule.foreground;\n }\n if (background === 0) {\n background = this._mainRule.background;\n }\n this._rulesWithParentScopes.push(new ThemeTrieElementRule(scopeDepth, parentScopes, fontStyle, foreground, background));\n };\n return ThemeTrieElement;\n}());\nexports.ThemeTrieElement = ThemeTrieElement;\n//# sourceMappingURL=theme.js.map","\"use strict\";\n/*---------------------------------------------------------\n * Copyright (C) Microsoft Corporation. All rights reserved.\n *--------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\n//# sourceMappingURL=types.js.map","\"use strict\";\n/*---------------------------------------------------------\n * Copyright (C) Microsoft Corporation. All rights reserved.\n *--------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.RegexSource = exports.basename = exports.mergeObjects = exports.clone = void 0;\nfunction clone(something) {\n return doClone(something);\n}\nexports.clone = clone;\nfunction doClone(something) {\n if (Array.isArray(something)) {\n return cloneArray(something);\n }\n if (typeof something === 'object') {\n return cloneObj(something);\n }\n return something;\n}\nfunction cloneArray(arr) {\n var r = [];\n for (var i = 0, len = arr.length; i < len; i++) {\n r[i] = doClone(arr[i]);\n }\n return r;\n}\nfunction cloneObj(obj) {\n var r = {};\n for (var key in obj) {\n r[key] = doClone(obj[key]);\n }\n return r;\n}\nfunction mergeObjects(target) {\n var sources = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n sources[_i - 1] = arguments[_i];\n }\n sources.forEach(function (source) {\n for (var key in source) {\n target[key] = source[key];\n }\n });\n return target;\n}\nexports.mergeObjects = mergeObjects;\nfunction basename(path) {\n var idx = ~path.lastIndexOf('/') || ~path.lastIndexOf('\\\\');\n if (idx === 0) {\n return path;\n }\n else if (~idx === path.length - 1) {\n return basename(path.substring(0, path.length - 1));\n }\n else {\n return path.substr(~idx + 1);\n }\n}\nexports.basename = basename;\nvar CAPTURING_REGEX_SOURCE = /\\$(\\d+)|\\${(\\d+):\\/(downcase|upcase)}/g;\nvar RegexSource = /** @class */ (function () {\n function RegexSource() {\n }\n RegexSource.hasCaptures = function (regexSource) {\n if (regexSource === null) {\n return false;\n }\n CAPTURING_REGEX_SOURCE.lastIndex = 0;\n return CAPTURING_REGEX_SOURCE.test(regexSource);\n };\n RegexSource.replaceCaptures = function (regexSource, captureSource, captureIndices) {\n return regexSource.replace(CAPTURING_REGEX_SOURCE, function (match, index, commandIndex, command) {\n var capture = captureIndices[parseInt(index || commandIndex, 10)];\n if (capture) {\n var result = captureSource.substring(capture.start, capture.end);\n // Remove leading dots that would make the selector invalid\n while (result[0] === '.') {\n result = result.substring(1);\n }\n switch (command) {\n case 'downcase':\n return result.toLowerCase();\n case 'upcase':\n return result.toUpperCase();\n default:\n return result;\n }\n }\n else {\n return match;\n }\n });\n };\n return RegexSource;\n}());\nexports.RegexSource = RegexSource;\n//# sourceMappingURL=utils.js.map","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(787);\n"],"sourceRoot":""} \ No newline at end of file diff --git a/src/debug.ts b/src/debug.ts index 0667b05..00d25de 100644 --- a/src/debug.ts +++ b/src/debug.ts @@ -5,3 +5,5 @@ export const DebugFlags = { InDebugMode: (typeof process !== 'undefined' && !!process.env['VSCODE_TEXTMATE_DEBUG']) }; + +export const UseOnigurumaFindOptions = false; diff --git a/src/grammar.ts b/src/grammar.ts index 8994749..e06ad0b 100644 --- a/src/grammar.ts +++ b/src/grammar.ts @@ -7,7 +7,7 @@ import { IRawGrammar, IRawRepository, IRawRule, IOnigLib, IOnigCaptureIndex, Oni import { IRuleRegistry, IRuleFactoryHelper, RuleFactory, Rule, CaptureRule, BeginEndRule, BeginWhileRule, MatchRule, CompiledRule } from './rule'; import { createMatchers, Matcher } from './matcher'; import { MetadataConsts, IGrammar, ITokenizeLineResult, ITokenizeLineResult2, IToken, IEmbeddedLanguagesMap, StandardTokenType, StackElement as StackElementDef, ITokenTypeMap } from './main'; -import { DebugFlags } from './debug'; +import { DebugFlags, UseOnigurumaFindOptions } from './debug'; import { FontStyle, ThemeTrieElementRule } from './theme'; declare let performance: { now: () => number } | undefined; @@ -664,6 +664,26 @@ function getFindOptions(allowA: boolean, allowG: boolean): number { return options; } +function prepareRuleSearch(rule: Rule, grammar: Grammar, endRegexSource: string | null, allowA: boolean, allowG: boolean): { ruleScanner: CompiledRule; findOptions: number; } { + if (UseOnigurumaFindOptions) { + const ruleScanner = rule.compile(grammar, endRegexSource); + const findOptions = getFindOptions(allowA, allowG); + return { ruleScanner, findOptions }; + } + const ruleScanner = rule.compileAG(grammar, endRegexSource, allowA, allowG); + return { ruleScanner, findOptions: FindOption.None }; +} + +function prepareRuleWhileSearch(rule: BeginWhileRule, grammar: Grammar, endRegexSource: string | null, allowA: boolean, allowG: boolean): { ruleScanner: CompiledRule; findOptions: number; } { + if (UseOnigurumaFindOptions) { + const ruleScanner = rule.compileWhile(grammar, endRegexSource); + const findOptions = getFindOptions(allowA, allowG); + return { ruleScanner, findOptions }; + } + const ruleScanner = rule.compileWhileAG(grammar, endRegexSource, allowA, allowG); + return { ruleScanner, findOptions: FindOption.None }; +} + function matchInjections(injections: Injection[], grammar: Grammar, lineText: OnigString, isFirstLine: boolean, linePos: number, stack: StackElement, anchorPosition: number): IMatchInjectionsResult | null { // The lower the better let bestMatchRating = Number.MAX_VALUE; @@ -679,8 +699,8 @@ function matchInjections(injections: Injection[], grammar: Grammar, lineText: On // injection selector doesn't match stack continue; } - const ruleScanner = grammar.getRule(injection.ruleId).compile(grammar, null); - const findOptions = getFindOptions(isFirstLine, linePos === anchorPosition); + const rule = grammar.getRule(injection.ruleId); + const { ruleScanner, findOptions } = prepareRuleSearch(rule, grammar, null, isFirstLine, linePos === anchorPosition); const matchResult = ruleScanner.scanner.findNextMatchSync(lineText, linePos, findOptions); if (DebugFlags.InDebugMode) { console.log(' scanning for injections'); @@ -726,8 +746,7 @@ interface IMatchResult { function matchRule(grammar: Grammar, lineText: OnigString, isFirstLine: boolean, linePos: number, stack: StackElement, anchorPosition: number): IMatchResult | null { const rule = stack.getRule(grammar); - const ruleScanner = rule.compile(grammar, stack.endRule); - const findOptions = getFindOptions(isFirstLine, linePos === anchorPosition); + const { ruleScanner, findOptions } = prepareRuleSearch(rule, grammar, stack.endRule, isFirstLine, linePos === anchorPosition); let perfStart = 0; if (DebugFlags.InDebugMode) { @@ -821,8 +840,7 @@ function _checkWhileConditions(grammar: Grammar, lineText: OnigString, isFirstLi } for (let whileRule = whileRules.pop(); whileRule; whileRule = whileRules.pop()) { - const ruleScanner = whileRule.rule.compileWhile(grammar, whileRule.stack.endRule); - const findOptions = getFindOptions(isFirstLine, anchorPosition === linePos); + const { ruleScanner, findOptions } = prepareRuleWhileSearch(whileRule.rule, grammar, whileRule.stack.endRule, isFirstLine, linePos === anchorPosition); const r = ruleScanner.scanner.findNextMatchSync(lineText, linePos, findOptions); if (DebugFlags.InDebugMode) { console.log(' scanning for while rule'); diff --git a/src/rule.ts b/src/rule.ts index ece1b40..5f31743 100644 --- a/src/rule.ts +++ b/src/rule.ts @@ -83,6 +83,8 @@ export abstract class Rule { public abstract collectPatternsRecursive(grammar: IRuleRegistry, out: RegExpSourceList, isFirst: boolean): void; public abstract compile(grammar: IRuleRegistry & IOnigLib, endRegexSource: string | null): CompiledRule; + + public abstract compileAG(grammar: IRuleRegistry & IOnigLib, endRegexSource: string | null, allowA: boolean, allowG: boolean): CompiledRule; } export interface ICompilePatternsResult { @@ -110,13 +112,26 @@ export class CaptureRule extends Rule { public compile(grammar: IRuleRegistry & IOnigLib, endRegexSource: string): CompiledRule { throw new Error('Not supported!'); } + + public compileAG(grammar: IRuleRegistry & IOnigLib, endRegexSource: string, allowA: boolean, allowG: boolean): CompiledRule { + throw new Error('Not supported!'); + } +} + +interface IRegExpSourceAnchorCache { + readonly A0_G0: string; + readonly A0_G1: string; + readonly A1_G0: string; + readonly A1_G1: string; } export class RegExpSource { public source: string; public readonly ruleId: number; + public hasAnchor: boolean; public readonly hasBackReferences: boolean; + private _anchorCache: IRegExpSourceAnchorCache | null; constructor(regExpSource: string, ruleId: number, handleAnchors: boolean = true) { if (handleAnchors) { @@ -125,6 +140,7 @@ export class RegExpSource { let lastPushedPos = 0; let output: string[] = []; + let hasAnchor = false; for (let pos = 0; pos < len; pos++) { const ch = regExpSource.charAt(pos); @@ -135,12 +151,15 @@ export class RegExpSource { output.push(regExpSource.substring(lastPushedPos, pos)); output.push('$(?!\\n)(? e.resolveAnchors(allowA, allowG)); + return new CompiledRule(onigLib, regExps, this._items.map(e => e.ruleId)); + } } export class MatchRule extends Rule { @@ -261,11 +433,19 @@ export class MatchRule extends Rule { } public compile(grammar: IRuleRegistry & IOnigLib, endRegexSource: string): CompiledRule { + return this._getCachedCompiledPatterns(grammar).compile(grammar); + } + + public compileAG(grammar: IRuleRegistry & IOnigLib, endRegexSource: string, allowA: boolean, allowG: boolean): CompiledRule { + return this._getCachedCompiledPatterns(grammar).compileAG(grammar, allowA, allowG); + } + + private _getCachedCompiledPatterns(grammar: IRuleRegistry & IOnigLib): RegExpSourceList { if (!this._cachedCompiledPatterns) { this._cachedCompiledPatterns = new RegExpSourceList(); this.collectPatternsRecursive(grammar, this._cachedCompiledPatterns, true); } - return this._cachedCompiledPatterns.compile(grammar); + return this._cachedCompiledPatterns; } } @@ -300,11 +480,19 @@ export class IncludeOnlyRule extends Rule { } public compile(grammar: IRuleRegistry & IOnigLib, endRegexSource: string): CompiledRule { + return this._getCachedCompiledPatterns(grammar).compile(grammar); + } + + public compileAG(grammar: IRuleRegistry & IOnigLib, endRegexSource: string, allowA: boolean, allowG: boolean): CompiledRule { + return this._getCachedCompiledPatterns(grammar).compileAG(grammar, allowA, allowG); + } + + private _getCachedCompiledPatterns(grammar: IRuleRegistry & IOnigLib): RegExpSourceList { if (!this._cachedCompiledPatterns) { this._cachedCompiledPatterns = new RegExpSourceList(); this.collectPatternsRecursive(grammar, this._cachedCompiledPatterns, true); } - return this._cachedCompiledPatterns.compile(grammar); + return this._cachedCompiledPatterns; } } @@ -371,6 +559,14 @@ export class BeginEndRule extends Rule { } public compile(grammar: IRuleRegistry & IOnigLib, endRegexSource: string): CompiledRule { + return this._getCachedCompiledPatterns(grammar, endRegexSource).compile(grammar); + } + + public compileAG(grammar: IRuleRegistry & IOnigLib, endRegexSource: string, allowA: boolean, allowG: boolean): CompiledRule { + return this._getCachedCompiledPatterns(grammar, endRegexSource).compileAG(grammar, allowA, allowG); + } + + private _getCachedCompiledPatterns(grammar: IRuleRegistry & IOnigLib, endRegexSource: string): RegExpSourceList { if (!this._cachedCompiledPatterns) { this._cachedCompiledPatterns = new RegExpSourceList(); @@ -389,7 +585,7 @@ export class BeginEndRule extends Rule { this._cachedCompiledPatterns.setSource(0, endRegexSource); } } - return this._cachedCompiledPatterns.compile(grammar); + return this._cachedCompiledPatterns; } } @@ -456,14 +652,30 @@ export class BeginWhileRule extends Rule { } public compile(grammar: IRuleRegistry & IOnigLib, endRegexSource: string): CompiledRule { + return this._getCachedCompiledPatterns(grammar).compile(grammar); + } + + public compileAG(grammar: IRuleRegistry & IOnigLib, endRegexSource: string, allowA: boolean, allowG: boolean): CompiledRule { + return this._getCachedCompiledPatterns(grammar).compileAG(grammar, allowA, allowG); + } + + private _getCachedCompiledPatterns(grammar: IRuleRegistry & IOnigLib): RegExpSourceList { if (!this._cachedCompiledPatterns) { this._cachedCompiledPatterns = new RegExpSourceList(); this.collectPatternsRecursive(grammar, this._cachedCompiledPatterns, true); } - return this._cachedCompiledPatterns.compile(grammar); + return this._cachedCompiledPatterns; } public compileWhile(grammar: IRuleRegistry & IOnigLib, endRegexSource: string | null): CompiledRule { + return this._getCachedCompiledWhilePatterns(grammar, endRegexSource).compile(grammar); + } + + public compileWhileAG(grammar: IRuleRegistry & IOnigLib, endRegexSource: string | null, allowA: boolean, allowG: boolean): CompiledRule { + return this._getCachedCompiledWhilePatterns(grammar, endRegexSource).compileAG(grammar, allowA, allowG); + } + + private _getCachedCompiledWhilePatterns(grammar: IRuleRegistry & IOnigLib, endRegexSource: string | null): RegExpSourceList { if (!this._cachedCompiledWhilePatterns) { this._cachedCompiledWhilePatterns = new RegExpSourceList(); this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences ? this._while.clone() : this._while); @@ -471,7 +683,7 @@ export class BeginWhileRule extends Rule { if (this._while.hasBackReferences) { this._cachedCompiledWhilePatterns.setSource(0, endRegexSource ? endRegexSource : '\uFFFF'); } - return this._cachedCompiledWhilePatterns.compile(grammar); + return this._cachedCompiledWhilePatterns; } }