UNPKG

@gdquest/gd-exercise

Version:

Core package that handles logic for the GDExercise project.

4 lines 491 kB
{ "version": 3, "sources": ["../../codemirror-gdscript/src/index.mts", "../../lezer-gdscript/src/parser.js", "../../lezer-gdscript/src/tokens.js", "../../lezer-gdscript/src/parser.terms.js", "../../lezer-gdscript/src/highlight.js", "../../../node_modules/.pnpm/@lezer+common@1.0.3/node_modules/@lezer/common/dist/index.js", "../../codemirror-gdscript/src/complete.mts", "../../../node_modules/.pnpm/@lezer+common@1.0.3/node_modules/@lezer/common/dist/index.js", "../../../node_modules/.pnpm/@lezer+lr@1.3.9/node_modules/@lezer/lr/dist/index.js", "../../../node_modules/.pnpm/@lezer+highlight@1.1.6/node_modules/@lezer/highlight/dist/index.js", "../../../node_modules/.pnpm/@codemirror+autocomplete@6.8.1_@codemirror+language@6.9.0_@codemirror+state@6.2.1_@codemirror_xdyrjbo3jiz3uawtkjryt6trui/node_modules/@codemirror/autocomplete/dist/index.js"], "sourcesContent": ["import {\n foldNodeProp,\n foldInside,\n indentNodeProp,\n LRLanguage,\n LanguageSupport,\n type TreeIndentContext,\n} from \"@codemirror/language\";\n\nimport { parser } from \"@gdquest/lezer-gdscript\";\n\nimport { globalCompletion, localCompletionSource } from \"./complete.mts\";\nimport { type SyntaxNode } from \"@lezer/common\";\nexport { globalCompletion, localCompletionSource };\n\nfunction indentBody(\n context: TreeIndentContext,\n node: SyntaxNode\n): number | null {\n const base = context.baseIndentFor(node);\n const line = context.lineAt(context.pos, -1);\n const to = line.from + line.text.length;\n // Don't consider blank, deindented lines at the end of the\n // block part of the block\n if (\n /^\\s*($|#)/.test(line.text) &&\n context.node.to < to + 100 &&\n !/\\S/.test(context.state.sliceDoc(to, context.node.to)) &&\n context.lineIndent(context.pos, -1) <= base\n ) {\n return null;\n }\n // A normally deindenting keyword that appears at a higher\n // indentation than the block should probably be handled by the next\n // level\n if (\n /^\\s*(else:|elif)/.test(context.textAfter) &&\n context.lineIndent(context.pos, -1) > base\n ) {\n return null;\n }\n return base + context.unit;\n}\n\nexport const gdscriptLanguage = LRLanguage.define({\n name: \"gdscript\",\n parser: parser.configure({\n props: [\n indentNodeProp.add({\n Body: (context) => {\n return indentBody(context, context.node) ?? context.continue();\n },\n IfNode: (context) => {\n return /^\\s*(else:|elif )/.test(context.textAfter)\n ? context.baseIndent\n : context.continue();\n },\n SuiteNode: (context) => {\n return indentBody(context, context.node) ?? context.continue();\n },\n String: () => {\n return null;\n },\n Script: (context) => {\n if (\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n context.pos + /\\s*/.exec(context.textAfter)![0].length >=\n context.node.to\n ) {\n let endBody = null;\n for (let cur: SyntaxNode | null = context.node, to = cur.to; ; ) {\n cur = cur.lastChild;\n if (cur == null || cur.to !== to) break;\n if (cur.type.name === \"Body\") endBody = cur;\n }\n if (endBody != null) {\n const bodyIndent = indentBody(context, endBody);\n if (bodyIndent != null) return bodyIndent;\n }\n }\n return context.continue();\n },\n }),\n foldNodeProp.add({\n \"ArrayExpressionNode DictionaryExpressionNode\": foldInside,\n Body: (node, state) => ({\n from: node.from + 1,\n to: node.to - (node.to === state.doc.length ? 0 : 1),\n }),\n }),\n ],\n }),\n languageData: {\n closeBrackets: {\n brackets: [\"(\", \"[\", \"{\", \"'\", '\"', \"'''\", '\"\"\"'],\n },\n commentTokens: { line: \"#\" },\n // eslint-disable-next-line no-useless-escape\n indentOnInput: /^\\s*([\\}\\]\\)]|else:|elif )$/,\n },\n});\n\nexport function gdscript(): LanguageSupport {\n return new LanguageSupport(gdscriptLanguage, [\n gdscriptLanguage.data.of({ autocomplete: localCompletionSource }),\n gdscriptLanguage.data.of({ autocomplete: globalCompletion }),\n ]);\n}\n", "// This file was generated by lezer-generator. You probably shouldn't edit it.\nimport {LRParser} from \"@lezer/lr\"\nimport {indentation, newlines, trackIndent} from \"./tokens.js\"\nimport {gdscriptHighlighting} from \"./highlight\"\nconst spec_Identifier = {__proto__:null,PI:34, TAU:36, INF:38, NaN:40, assert:48, var:70, const:80, await:86, in:116, as:122, func:138, preload:162, is:176, class_name:186, extends:190, signal:194, pass:198, return:202, class:214, if:222, elif:226, else:230, for:234, match:238, while:254}\nexport const parser = LRParser.deserialize({\n version: 14,\n states: \"KtQ`QUOOP#rOQOOOOQQ'#Cq'#CqOOQQ'#Ch'#ChO#wQUO'#CbO#|QUO'#CaO&OQYO'#CyO&lQUO'#CzO&qQUO'#CxO(pQYO'#FmO*hQUO'#CwO*oQYO'#FmO*|QUO'#DOOOQQ'#Fq'#FqO,lQYO'#C`O,dQYO'#C}O,yQUO'#DmO(wQUO'#DpOOQQ'#EQ'#EQO(wQUO'#EYOOQQ'#Fm'#FmOOQQ'#C`'#C`O.jQUO'#C_OOQR'#C_'#C_O.uQVO'#EmOOQR'#Ei'#EiOOQR'#Fg'#FgOOQR'#FQ'#FQQ`QUOOOOQQ'#Cl'#ClO1kQUO'#DOO1pQUO'#DTO(wQUO'#DWO1uQUO'#ElO1zQUO'#EOO1zQUO'#CsO2PQUO'#E[O2UQUO'#E^O2ZQUO'#E`OOQQ'#Eb'#EbO(wQUO'#EdO2`QUO'#EjO,yQUO'#EnO2eQUO'#EtO2jQUO'#EvO,yQUO'#FOP2oOUO'#FfPOOO)CAY)CAYO2zQUO,58|O3iQUO'#DQOOQQ,59q,59qO(wQUO,59iOOQQ,5:T,5:TO3nQUO'#CuO3uQYO,59fO5uQUO'#FTO5zQYO,59dOOQQ,59c,59cO8QQUO,59cOOQQ'#FU'#FUO8VQUO'#DOO8bQYO'#FlO8oQUO'#DrO8tQUO,59cO,yQUO,5:XOOQQ-E9S-E9SO8{QUO,59jO9QQUO,59oO9VQUO,5;UO9[QUO,5;WO(wQUO,59tO(wQUO,59tO(wQUO,59tO(wQUO,59tO(wQUO,59tO(wQUO,59tO(wQUO,59tO(wQUO,59tO(wQUO,59tO(wQUO,59tO(wQUO,5:nO(wQUO,59tO9aQUO,59tO3iQUO,5:UO9fQUO,5:qO:uQYO'#DoO;PQUO'#FtO;XQUO,5:XO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Q'_'SQ'`'TQ'a'UQ'b'VQ'j'cQ'k'xQ'l'iQ'r'{Q's'|Q'v(PR'w(Q!h_OYaclpx!T!V!a!h!i!j!k!l!m!n!o!p!q!r!s#O#x$a$f$q%W%i%{%|&X&f'd(P!_'m`z}!b#U$e$g$z%n&V&x&y&z&{&|&}'O'P'Q'R'S'T'U'V'c'i'x'{'|(QQ!y`R$O!bQ#|!`Q$u#[Q%h$SQ'e'pR'h'uR%^#z\",\n nodeNames: \"\u26A0 Comment Script SimpleStatement SmallStatement StandaloneAnnotationNode AnnotationNode @ Identifier ) ( CallParamsLiteralExpressionNode LiteralExpressionNode True False Null BuiltinConstants PI TAU INF NaN String , AssertNode assert CallParamsExpressionNode ] ArrayExpressionNode SubscriptExpressionNode VariableName GetNodeExpressionNode . [ AssignmentExpressionNode VariableNode var TypeCast : Type ConstantNode const ParameterNode AwaitExpressionNode await BinaryOperatorExpressionNode ArithOp ArithOp ArithOp BitOp CompareOp BitOp BitOp BitOp AndOp LogicOp OrOp LogicOp NotOp in CallExpressionNode CastExpressionNode as } DictionaryExpressionNode { DictionaryEntry GroupedExpressionNode IdentifierExpressionNode LambdaExpressionNode func CallParamsParameterNode AssignmentExpressionNode FunctionReturnType Body SuiteNodeBody Newline SuiteNode Indent Dedent ExpressionNodeBody PreloadExpressionNode preload SelfExpressionNode SelfToken TernaryOperatorExpressionNode TernaryOp TernaryOp TypeTestExpressionNode is ClassName UnaryOperatorNode ArithOp ClassNameStatement class_name ExtendsStatement extends SignalStatement signal PassStatement pass ReturnNode return Eof StatementGroup ; CompoundStatement ClassNode class FunctionNode IfNode IfClause if ElifClause elif ElseClause else ForNode for MatchNode match MatchBranchNode PatternNode VarPatternNode IdentifierPatternNode LiteralPatternNode WildcardPatternNode WhileNode while\",\n maxTerm: 166,\n context: trackIndent,\n nodeProps: [\n [\"group\", -2,3,105,\"Statement\",-18,12,27,28,30,33,42,44,59,60,63,66,67,68,80,82,84,87,90,\"ExpressionNode\",-3,34,39,41,\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c!}4X#R#S4X#T#X4X#X#Y8q#Y#o4X~8xS^~W~!Q![4X!c!}4X#R#S4X#T#o4X~9ZWW~!Q![4X!c!}4X#R#S4X#T#c4X#c#d9s#d#i4X#i#j:o#j#o4X~9xUW~!Q![4X!c!}4X#R#S4X#T#h4X#h#i:[#i#o4X~:cS!Z~W~!Q![4X!c!}4X#R#S4X#T#o4X~:tUW~!Q![4X!c!}4X#R#S4X#T#`4X#`#a;W#a#o4X~;]UW~!Q![4X!c!}4X#R#S4X#T#`4X#`#a;o#a#o4X~;vS_~W~!Q![4X!c!}4X#R#S4X#T#o4X~<XUW~!Q![4X!c!}4X#R#S4X#T#f4X#f#g<k#g#o4X~<rS!X~W~!Q![4X!c!}4X#R#S4X#T#o4X~=TUW~!Q![4X!c!}4X#R#S4X#T#X4X#X#Y=g#Y#o4X~=lUW~!Q![4X!c!}4X#R#S4X#T#`4X#`#a>O#a#o4X~>TUW~!Q![4X!c!}4X#R#S4X#T#Y4X#Y#Z>g#Z#o4X~>nS!u~W~!Q![4X!c!}4X#R#S4X#T#o4X~?PUW~!Q![4X!c!}4X#R#S4X#T#f4X#f#g?c#g#o4X~?hUW~!Q![4X!c!}4X#R#S4X#T#i4X#i#j?z#j#o4X~@PUW~!Q![4X!c!}4X#R#S4X#T#X4X#X#Y@c#Y#o4X~@jS]~W~!Q![4X!c!}4X#R#S4X#T#o4X~@{O!b~~AQQ!S~!_!`)Q#p#qAW~A]P!Y~!_!`)Q~AeO!`~\",\n tokenizers: [indentation, newlines, 0, 1, 2],\n topRules: {\"Script\":[0,2]},\n specialized: [{term: 8, get: value => spec_Identifier[value] || -1}],\n tokenPrec: 3645\n})\n", "import { ContextTracker, ExternalTokenizer } from \"@lezer/lr\";\nimport {\n // created\n // indentation\n indent,\n dedent,\n // newlines\n newline as newlineToken,\n blankLineStart,\n newlineBracketed,\n eof,\n // existing\n GroupedExpressionNode,\n ArrayExpressionNode,\n DictionaryExpressionNode,\n CallExpressionNode,\n CallParamsExpressionNode,\n CallParamsLiteralExpressionNode,\n CallParamsParameterNode,\n // tokens\n ParenL,\n BracketL,\n BraceL,\n} from \"./parser.terms\";\n\nconst bracketed = new Set([\n GroupedExpressionNode,\n ArrayExpressionNode,\n DictionaryExpressionNode,\n CallExpressionNode,\n CallParamsExpressionNode,\n CallParamsLiteralExpressionNode,\n CallParamsParameterNode,\n]);\n\nconst newline = \"\\n\".charCodeAt(0);\nconst carriageReturn = \"\\r\".charCodeAt(0);\nconst space = \" \".charCodeAt(0);\nconst tab = \"\\t\".charCodeAt(0);\nconst hash = \"#\".charCodeAt(0);\n\nclass IndentLevel {\n constructor(parent, depth) {\n this.parent = parent;\n // -1 means this is not an actual indent level but a set of brackets\n this.depth = depth;\n this.hash =\n (parent ? (parent.hash + parent.hash) << 8 : 0) + depth + (depth << 4);\n }\n}\n\nconst topIndent = new IndentLevel(null, 0);\n\nfunction isLineBreak(ch) {\n return ch === newline || ch === carriageReturn;\n}\n\nexport const newlines = new ExternalTokenizer(\n (input, stack) => {\n let prev;\n if (input.next < 0) {\n input.acceptToken(eof);\n } else if (stack.context.depth < 0) {\n if (isLineBreak(input.next)) {\n input.acceptToken(newlineBracketed, 1);\n }\n } else if (\n ((prev = input.peek(-1)) < 0 || isLineBreak(prev)) &&\n stack.canShift(blankLineStart)\n ) {\n let spaces = 0;\n while (input.next === space || input.next === tab) {\n input.advance();\n spaces++;\n }\n if (\n input.next === newline ||\n input.next === carriageReturn ||\n input.next === hash\n ) {\n input.acceptToken(blankLineStart, -spaces);\n }\n } else if (isLineBreak(input.next)) {\n input.acceptToken(newlineToken, 1);\n }\n },\n { contextual: true }\n);\n\nfunction countIndent(space) {\n let depth = 0;\n for (let i = 0; i < space.length; i++)\n depth += space.charCodeAt(i) === tab ? 8 - (depth % 8) : 1;\n return depth;\n}\n\nexport const trackIndent = new ContextTracker({\n start: topIndent,\n reduce(context, term) {\n return context.depth < 0 && bracketed.has(term) ? context.parent : context;\n },\n shift(context, term, stack, input) {\n switch (term) {\n case indent:\n return new IndentLevel(\n context,\n countIndent(input.read(input.pos, stack.pos))\n );\n case dedent:\n return context.parent;\n case ParenL:\n case BracketL:\n case BraceL:\n return new IndentLevel(context, -1);\n default:\n return context;\n }\n },\n hash(context) {\n return context.hash;\n },\n});\n\nexport const indentation = new ExternalTokenizer((input, stack) => {\n const contextDepth = stack.context.depth;\n if (contextDepth < 0) return;\n\n const prev = input.peek(-1);\n\n if (!(prev === newline || prev === carriageReturn)) {\n return;\n }\n\n let chars = 0;\n let depth = 0;\n\n while (true) {\n if (input.next === space) {\n depth++;\n } else if (input.next === tab) {\n depth += 8 - (depth % 8);\n } else {\n break;\n }\n\n input.advance();\n chars += 1;\n }\n\n if (\n depth !== contextDepth &&\n input.next !== newline &&\n input.next !== carriageReturn &&\n input.next !== hash\n ) {\n if (depth < contextDepth) {\n input.acceptToken(dedent, -chars);\n } else {\n input.acceptToken(indent);\n }\n }\n});\n", "// This file was generated by lezer-generator. You probably shouldn't edit it.\nexport const\n indent = 140,\n dedent = 141,\n newline = 142,\n blankLineStart = 143,\n newlineBracketed = 144,\n eof = 145,\n Comment = 1,\n Script = 2,\n SimpleStatement = 3,\n SmallStatement = 4,\n AnnotationNode = 6,\n Identifier = 8,\n ParenL = 10,\n CallParamsLiteralExpressionNode = 11,\n LiteralExpressionNode = 12,\n True = 13,\n False = 14,\n Null = 15,\n BuiltinConstants = 16,\n String = 21,\n AssertNode = 23,\n CallParamsExpressionNode = 25,\n ArrayExpressionNode = 27,\n SubscriptExpressionNode = 28,\n VariableName = 29,\n GetNodeExpressionNode = 30,\n BracketL = 32,\n VariableNode = 34,\n TypeCast = 36,\n Type = 38,\n ConstantNode = 39,\n ParameterNode = 41,\n AwaitExpressionNode = 42,\n BinaryOperatorExpressionNode = 44,\n AndOp = 53,\n OrOp = 55,\n NotOp = 57,\n CallExpressionNode = 59,\n CastExpressionNode = 60,\n DictionaryExpressionNode = 63,\n BraceL = 64,\n DictionaryEntry = 65,\n GroupedExpressionNode = 66,\n IdentifierExpressionNode = 67,\n LambdaExpressionNode = 68,\n CallParamsParameterNode = 70,\n FunctionReturnType = 72,\n Body = 73,\n SuiteNodeBody = 74,\n Newline = 75,\n SuiteNode = 76,\n Indent = 77,\n Dedent = 78,\n ExpressionNodeBody = 79,\n PreloadExpressionNode = 80,\n SelfToken = 83,\n TernaryOperatorExpressionNode = 84,\n TypeTestExpressionNode = 87,\n ClassName = 89,\n UnaryOperatorNode = 90,\n ClassNameStatement = 92,\n ExtendsStatement = 94,\n SignalStatement = 96,\n PassStatement = 98,\n ReturnNode = 100,\n Eof = 102,\n CompoundStatement = 105,\n ClassNode = 106,\n FunctionNode = 108,\n IfNode = 109,\n IfClause = 110,\n ElifClause = 112,\n ElseClause = 114,\n ForNode = 116,\n MatchNode = 118,\n MatchBranchNode = 120,\n PatternNode = 121,\n WhileNode = 126\n", "import { styleTags, tags as t } from \"@lezer/highlight\";\n\nexport const gdscriptHighlighting = styleTags({\n \"for while if elif else return break continue pass assert await match case\":\n t.controlKeyword,\n \"in not and or is del\": t.operatorKeyword,\n \"func class class_name extends const var\": t.definitionKeyword,\n \"preload load\": t.moduleKeyword,\n \"as PI TAU INF NaN\": t.keyword,\n True: t.bool,\n False: t.bool,\n Null: t.bool,\n Comment: t.lineComment,\n Number: t.number,\n String: t.string,\n UpdateOp: t.updateOperator,\n ArithOp: t.arithmeticOperator,\n BitOp: t.bitwiseOperator,\n CompareOp: t.compareOperator,\n AssignOp: t.definitionOperator,\n \"ClassNode/Identifier ClassNode/ExtendsStatement/Identifier VariableNode/TypeCast/Type/Identifier\":\n t.definition(t.className),\n \"( )\": t.paren,\n \"[ ]\": t.squareBracket,\n \"{ }\": t.brace,\n \".\": t.derefOperator,\n \", ;\": t.separator,\n});\n", "// FIXME profile adding a per-Tree TreeNode cache, validating it by\n// parent pointer\n/// The default maximum length of a `TreeBuffer` node.\nconst DefaultBufferLength = 1024;\nlet nextPropID = 0;\nclass Range {\n constructor(from, to) {\n this.from = from;\n this.to = to;\n }\n}\n/// Each [node type](#common.NodeType) or [individual tree](#common.Tree)\n/// can have metadata associated with it in props. Instances of this\n/// class represent prop names.\nclass NodeProp {\n /// Create a new node prop type.\n constructor(config = {}) {\n this.id = nextPropID++;\n this.perNode = !!config.perNode;\n this.deserialize = config.deserialize || (() => {\n throw new Error(\"This node type doesn't define a deserialize function\");\n });\n }\n /// This is meant to be used with\n /// [`NodeSet.extend`](#common.NodeSet.extend) or\n /// [`LRParser.configure`](#lr.ParserConfig.props) to compute\n /// prop values for each node type in the set. Takes a [match\n /// object](#common.NodeType^match) or function that returns undefined\n /// if the node type doesn't get this prop, and the prop's value if\n /// it does.\n add(match) {\n if (this.perNode)\n throw new RangeError(\"Can't add per-node props to node types\");\n if (typeof match != \"function\")\n match = NodeType.match(match);\n return (type) => {\n let result = match(type);\n return result === undefined ? null : [this, result];\n };\n }\n}\n/// Prop that is used to describe matching delimiters. For opening\n/// delimiters, this holds an array of node names (written as a\n/// space-separated string when declaring this prop in a grammar)\n/// for the node types of closing delimiters that match it.\nNodeProp.closedBy = new NodeProp({ deserialize: str => str.split(\" \") });\n/// The inverse of [`closedBy`](#common.NodeProp^closedBy). This is\n/// attached to closing delimiters, holding an array of node names\n/// of types of matching opening delimiters.\nNodeProp.openedBy = new NodeProp({ deserialize: str => str.split(\" \") });\n/// Used to assign node types to groups (for example, all node\n/// types that represent an expression could be tagged with an\n/// `\"Expression\"` group).\nNodeProp.group = new NodeProp({ deserialize: str => str.split(\" \") });\n/// The hash of the [context](#lr.ContextTracker.constructor)\n/// that the node was parsed in, if any. Used to limit reuse of\n/// contextual nodes.\nNodeProp.contextHash = new NodeProp({ perNode: true });\n/// The distance beyond the end of the node that the tokenizer\n/// looked ahead for any of the tokens inside the node. (The LR\n/// parser only stores this when it is larger than 25, for\n/// efficiency reasons.)\nNodeProp.lookAhead = new NodeProp({ perNode: true });\n/// This per-node prop is used to replace a given node, or part of a\n/// node, with another tree. This is useful to include trees from\n/// different languages in mixed-language parsers.\nNodeProp.mounted = new NodeProp({ perNode: true });\n/// A mounted tree, which can be [stored](#common.NodeProp^mounted) on\n/// a tree node to indicate that parts of its content are\n/// represented by another tree.\nclass MountedTree {\n constructor(\n /// The inner tree.\n tree, \n /// If this is null, this tree replaces the entire node (it will\n /// be included in the regular iteration instead of its host\n /// node). If not, only the given ranges are considered to be\n /// covered by this tree. This is used for trees that are mixed in\n /// a way that isn't strictly hierarchical. Such mounted trees are\n /// only entered by [`resolveInner`](#common.Tree.resolveInner)\n /// and [`enter`](#common.SyntaxNode.enter).\n overlay, \n /// The parser used to create this subtree.\n parser) {\n this.tree = tree;\n this.overlay = overlay;\n this.parser = parser;\n }\n}\nconst noProps = Object.create(null);\n/// Each node in a syntax tree has a node type associated with it.\nclass NodeType {\n /// @internal\n constructor(\n /// The name of the node type. Not necessarily unique, but if the\n /// grammar was written properly, different node types with the\n /// same name within a node set should play the same semantic\n /// role.\n name, \n /// @internal\n props, \n /// The id of this node in its set. Corresponds to the term ids\n /// used in the parser.\n id, \n /// @internal\n flags = 0) {\n this.name = name;\n this.props = props;\n this.id = id;\n this.flags = flags;\n }\n /// Define a node type.\n static define(spec) {\n let props = spec.props && spec.props.length ? Object.create(null) : noProps;\n let flags = (spec.top ? 1 /* NodeFlag.Top */ : 0) | (spec.skipped ? 2 /* NodeFlag.Skipped */ : 0) |\n (spec.error ? 4 /* NodeFlag.Error */ : 0) | (spec.name == null ? 8 /* NodeFlag.Anonymous */ : 0);\n let type = new NodeType(spec.name || \"\", props, spec.id, flags);\n if (spec.props)\n for (let src of spec.props) {\n if (!Array.isArray(src))\n src = src(type);\n if (src) {\n if (src[0].perNode)\n throw new RangeError(\"Can't store a per-node prop on a node type\");\n props[src[0].id] = src[1];\n }\n }\n return type;\n }\n /// Retrieves a node prop for this type. Will return `undefined` if\n /// the prop isn't present on this node.\n prop(prop) { return this.props[prop.id]; }\n /// True when this is the top node of a grammar.\n get isTop() { return (this.flags & 1 /* NodeFlag.Top */) > 0; }\n /// True when this node is produced by a skip rule.\n get isSkipped() { return (this.flags & 2 /* NodeFlag.Skipped */) > 0; }\n /// Indicates whether this is an error node.\n get isError() { return (this.flags & 4 /* NodeFlag.Error */) > 0; }\n /// When true, this node type doesn't correspond to a user-declared\n /// named node, for example because it is used to cache repetition.\n get isAnonymous() { return (this.flags & 8 /* NodeFlag.Anonymous */) > 0; }\n /// Returns true when this node's name or one of its\n /// [groups](#common.NodeProp^group) matches the given string.\n is(name) {\n if (typeof name == 'string') {\n if (this.name == name)\n return true;\n let group = this.prop(NodeProp.group);\n return group ? group.indexOf(name) > -1 : false;\n }\n return this.id == name;\n }\n /// Create a function from node types to arbitrary values by\n /// specifying an object whose property names are node or\n /// [group](#common.NodeProp^group) names. Often useful with\n /// [`NodeProp.add`](#common.NodeProp.add). You can put multiple\n /// names, separated by spaces, in a single property name to map\n /// multiple node names to a single value.\n static match(map) {\n let direct = Object.create(null);\n for (let prop in map)\n for (let name of prop.split(\" \"))\n direct[name] = map[prop];\n return (node) => {\n for (let groups = node.prop(NodeProp.group), i = -1; i < (groups ? groups.length : 0); i++) {\n let found = direct[i < 0 ? node.name : groups[i]];\n if (found)\n return found;\n }\n };\n }\n}\n/// An empty dummy node type to use when no actual type is available.\nNodeType.none = new NodeType(\"\", Object.create(null), 0, 8 /* NodeFlag.Anonymous */);\n/// A node set holds a collection of node types. It is used to\n/// compactly represent trees by storing their type ids, rather than a\n/// full pointer to the type object, in a numeric array. Each parser\n/// [has](#lr.LRParser.nodeSet) a node set, and [tree\n/// buffers](#common.TreeBuffer) can only store collections of nodes\n/// from the same set. A set can have a maximum of 2**16 (65536) node\n/// types in it, so that the ids fit into 16-bit typed array slots.\nclass NodeSet {\n /// Create a set with the given types. The `id` property of each\n /// type should correspond to its position within the array.\n constructor(\n /// The node types in this set, by id.\n types) {\n this.types = types;\n for (let i = 0; i < types.length; i++)\n if (types[i].id != i)\n throw new RangeError(\"Node type ids should correspond to array positions when creating a node set\");\n }\n /// Create a copy of this set with some node properties added. The\n /// arguments to this method can be created with\n /// [`NodeProp.add`](#common.NodeProp.add).\n extend(...props) {\n let newTypes = [];\n for (let type of this.types) {\n let newProps = null;\n for (let source of props) {\n let add = source(type);\n if (add) {\n if (!newProps)\n newProps = Object.assign({}, type.props);\n newProps[add[0].id] = add[1];\n }\n }\n newTypes.push(newProps ? new NodeType(type.name, newProps, type.id, type.flags) : type);\n }\n return new NodeSet(newTypes);\n }\n}\nconst CachedNode = new WeakMap(), CachedInnerNode = new WeakMap();\n/// Options that control iteration. Can be combined with the `|`\n/// operator to enable multiple ones.\nvar IterMode;\n(function (IterMode) {\n /// When enabled, iteration will only visit [`Tree`](#common.Tree)\n /// objects, not nodes packed into\n /// [`TreeBuffer`](#common.TreeBuffer)s.\n IterMode[IterMode[\"ExcludeBuffers\"] = 1] = \"ExcludeBuffers\";\n /// Enable this to make iteration include anonymous nodes (such as\n /// the nodes that wrap repeated grammar constructs into a balanced\n /// tree).\n IterMode[IterMode[\"IncludeAnonymous\"] = 2] = \"IncludeAnonymous\";\n /// By default, regular [mounted](#common.NodeProp^mounted) nodes\n /// replace their base node in iteration. Enable this to ignore them\n /// instead.\n IterMode[IterMode[\"IgnoreMounts\"] = 4] = \"IgnoreMounts\";\n /// This option only applies in\n /// [`enter`](#common.SyntaxNode.enter)-style methods. It tells the\n /// library to not enter mounted overlays if one covers the given\n /// position.\n IterMode[IterMode[\"IgnoreOverlays\"] = 8] = \"IgnoreOverlays\";\n})(IterMode || (IterMode = {}));\n/// A piece of syntax tree. There are two ways to approach these\n/// trees: the way they are actually stored in memory, and the\n/// convenient way.\n///\n/// Syntax trees are stored as a tree of `Tree` and `TreeBuffer`\n/// objects. By packing detail information into `TreeBuffer` leaf\n/// nodes, the representation is made a lot more memory-efficient.\n///\n/// However, when you want to actually work with tree nodes, this\n/// representation is very awkward, so most client code will want to\n/// use the [`TreeCursor`](#common.TreeCursor) or\n/// [`SyntaxNode`](#common.SyntaxNode) interface instead, which provides\n/// a view on some part of this data structure, and can be used to\n/// move around to adjacent nodes.\nclass Tree {\n /// Construct a new tree. See also [`Tree.build`](#common.Tree^build).\n constructor(\n /// The type of the top node.\n type, \n /// This node's child nodes.\n children, \n /// The positions (offsets relative to the start of this tree) of\n /// the children.\n positions, \n /// The total length of this tree\n length, \n /// Per-node [node props](#common.NodeProp) to associate with this node.\n props) {\n this.type = type;\n this.children = children;\n this.positions = positions;\n this.length = length;\n /// @internal\n this.props = null;\n if (props && props.length) {\n this.props = Object.create(null);\n for (let [prop, value] of props)\n this.props[typeof prop == \"number\" ? prop : prop.id] = value;\n }\n }\n /// @internal\n toString() {\n let mounted = this.prop(NodeProp.mounted);\n if (mounted && !mounted.overlay)\n return mounted.tree.toString();\n let children = \"\";\n for (let ch of this.children) {\n let str = ch.toString();\n if (str) {\n if (children)\n children += \",\";\n children += str;\n }\n }\n return !this.type.name ? children :\n (/\\W/.test(this.type.name) && !this.type.isError ? JSON.stringify(this.type.name) : this.type.name) +\n (children.length ? \"(\" + children + \")\" : \"\");\n }\n /// Get a [tree cursor](#common.TreeCursor) positioned at the top of\n /// the tree. Mode can be used to [control](#common.IterMode) which\n /// nodes the cursor visits.\n cursor(mode = 0) {\n return new TreeCursor(this.topNode, mode);\n }\n /// Get a [tree cursor](#common.TreeCursor) pointing into this tree\n /// at the given position and side (see\n /// [`moveTo`](#common.TreeCursor.moveTo).\n cursorAt(pos, side = 0, mode = 0) {\n let scope = CachedNode.get(this) || this.topNode;\n let cursor = new TreeCursor(scope);\n cursor.moveTo(pos, side);\n CachedNode.set(this, cursor._tree);\n return cursor;\n }\n /// Get a [syntax node](#common.SyntaxNode) object for the top of the\n /// tree.\n get topNode() {\n return new TreeNode(this, 0, 0, null);\n }\n /// Get the [syntax node](#common.SyntaxNode) at the given position.\n /// If `side` is -1, this will move into nodes that end at the\n /// position. If 1, it'll move into nodes that start at the\n /// position. With 0, it'll only enter nodes that cover the position\n /// from both sides.\n ///\n /// Note that this will not enter\n /// [overlays](#common.MountedTree.overlay), and you often want\n /// [`resolveInner`](#common.Tree.resolveInner) instead.\n resolve(pos, side = 0) {\n let node = resolveNode(CachedNode.get(this) || this.topNode, pos, side, false);\n CachedNode.set(this, node);\n return node;\n }\n /// Like [`resolve`](#common.Tree.resolve), but will enter\n /// [overlaid](#common.MountedTree.overlay) nodes, producing a syntax node\n /// pointing into the innermost overlaid tree at the given position\n /// (with parent links going through all parent structure, including\n /// the host trees).\n resolveInner(pos, side = 0) {\n let node = resolveNode(CachedInnerNode.get(this) || this.topNode, pos, side, true);\n CachedInnerNode.set(this, node);\n return node;\n }\n /// Iterate over the tree and its children, calling `enter` for any\n /// node that touches the `from`/`to` region (if given) before\n /// running over such a node's children, and `leave` (if given) when\n /// leaving the node. When `enter` returns `false`, that node will\n /// not have its children iterated over (or `leave` called).\n iterate(spec) {\n let { enter, leave, from = 0, to = this.length } = spec;\n let mode = spec.mode || 0, anon = (mode & IterMode.IncludeAnonymous) > 0;\n for (let c = this.cursor(mode | IterMode.IncludeAnonymous);;) {\n let entered = false;\n if (c.from <= to && c.to >= from && (!anon && c.type.isAnonymous || enter(c) !== false)) {\n if (c.firstChild())\n continue;\n entered = true;\n }\n for (;;) {\n if (entered && leave && (anon || !c.type.isAnonymous))\n leave(c);\n if (c.nextSibling())\n break;\n if (!c.parent())\n return;\n entered = true;\n }\n }\n }\n /// Get the value of the given [node prop](#common.NodeProp) for this\n /// node. Works with both per-node and per-type props.\n prop(prop) {\n return !prop.perNode ? this.type.prop(prop) : this.props ? this.props[prop.id] : undefined;\n }\n /// Returns the node's [per-node props](#common.NodeProp.perNode) in a\n /// format that can be passed to the [`Tree`](#common.Tree)\n /// constructor.\n get propValues() {\n let result = [];\n if (this.props)\n for (let id in this.props)\n result.push([+id, this.props[id]]);\n return result;\n }\n /// Balance the direct children of this tree, producing a copy of\n /// which may have children grouped into subtrees with type\n /// [`NodeType.none`](#common.NodeType^none).\n balance(config = {}) {\n return this.children.length <= 8 /* Balance.BranchFactor */ ? this :\n balanceRange(NodeType.none, this.children, this.positions, 0, this.children.length, 0, this.length, (children, positions, length) => new Tree(this.type, children, positions, length, this.propValues), config.makeTree || ((children, positions, length) => new Tree(NodeType.none, children, positions, length)));\n }\n /// Build a tree from a postfix-ordered buffer of node information,\n /// or a cursor over such a buffer.\n static build(data) { return buildTree(data); }\n}\n/// The empty tree\nTree.empty = new Tree(NodeType.none, [], [], 0);\nclass FlatBufferCursor {\n constructor(buffer, index) {\n this.buffer = buffer;\n this.index = index;\n }\n get id() { return this.buffer[this.index - 4]; }\n get start() { return this.buffer[this.index - 3]; }\n get end() { return this.buffer[this.index - 2]; }\n get size() { return this.buffer[this.index - 1]; }\n get pos() { return this.index; }\n next() { this.index -= 4; }\n fork() { return new FlatBufferCursor(this.buffer, this.index); }\n}\n/// Tree buffers contain (type, start, end, endIndex) quads for each\n/// node. In such a buffer, nodes are stored in prefix order (parents\n/// before children, with the endIndex of the parent indicating which\n/// children belong to it).\nclass TreeBuffer {\n /// Create a tree buffer.\n constructor(\n /// The buffer's content.\n buffer, \n /// The total length of the group of nodes in the buffer.\n length, \n /// The node set used in this buffer.\n set) {\n this.buffer = buffer;\n this.length = length;\n this.set = set;\n }\n /// @internal\n get type() { return NodeType.none; }\n /// @internal\n toString() {\n let result = [];\n for (let index = 0; index < this.buffer.length;) {\n result.push(this.childString(index));\n index = this.buffer[index + 3];\n }\n return result.join(\",\");\n }\n /// @internal\n childString(index) {\n let id = this.buffer[index], endIndex = this.buffer[index + 3];\n let type = this.set.types[id], result = type.name;\n if (/\\W/.test(result) && !type.isError)\n result = JSON.stringify(result);\n index += 4;\n if (endIndex == index)\n return result;\n let children = [];\n while (index < endIndex) {\n children.push(this.childString(index));\n index = this.buffer[index + 3];\n }\n return result + \"(\" + children.join(\",\") + \")\";\n }\n /// @internal\n findChild(startIndex, endIndex, dir, pos, side) {\n let { buffer } = this, pick = -1;\n for (let i = startIndex; i != endIndex; i = buffer[i + 3]) {\n if (checkSide(side, pos, buffer[i + 1], buffer[i + 2])) {\n pick = i;\n if (dir > 0)\n break;\n }\n }\n return pick;\n }\n /// @internal\n slice(startI, endI, from) {\n let b = this.buffer;\n let copy = new Uint16Array(endI - startI), len = 0;\n for (let i = startI, j = 0; i < endI;) {\n copy[j++] = b[i++];\n copy[j++] = b[i++] - from;\n let to = copy[j++] = b[i++] - from;\n copy[j++] = b[i++] - startI;\n len = Math.max(len, to);\n }\n return new TreeBuffer(copy, len, this.set);\n }\n}\nfunction checkSide(side, pos, from, to) {\n switch (side) {\n case -2 /* Side.Before */: return from < pos;\n case -1 /* Side.AtOrBefore */: return to >= pos && from < pos;\n case 0 /* Side.Around */: return from < pos && to > pos;\n case 1 /* Side.AtOrAfter */: return from <= pos && to > pos;\n case 2 /* Side.After */: return to > pos;\n case 4 /* Side.DontCare */: return true;\n }\n}\nfunction enterUnfinishedNodesBefore(node, pos) {\n let scan = node.childBefore(pos);\n while (scan) {\n let last = scan.lastChild;\n if (!last || last.to != scan.to)\n break;\n if (last.type.isError && last.from == last.to) {\n node = scan;\n scan = last.prevSibling;\n }\n else {\n scan = last;\n }\n }\n return node;\n}\nfunction resolveNode(node, pos, side, overlays) {\n var _a;\n // Move up to a node that actually holds the position, if possible\n while (node.from == node.to ||\n (side < 1 ? node.from >= pos : node.from > pos) ||\n (side > -1 ? node.to <= pos : node.to < pos)) {\n let parent = !overlays && node instanceof TreeNode && node.index < 0 ? null : node.parent;\n if (!parent)\n return node;\n node = parent;\n }\n let mode = overlays ? 0 : IterMode.IgnoreOverlays;\n // Must go up out of overlays when those do not overlap with pos\n if (overlays)\n for (let scan = node, parent = scan.parent; parent; scan = parent, parent = scan.parent) {\n if (scan instanceof TreeNode && scan.index < 0 && ((_a = parent.enter(pos, side, mode)) === null || _a === void 0 ? void 0 : _a.from) != scan.from)\n node = parent;\n }\n for (;;) {\n let inner = node.enter(pos, side, mode);\n if (!inner)\n return node;\n node = inner;\n