@gdquest/gd-exercise
Version:
Core package that handles logic for the GDExercise project.
4 lines • 494 kB
Source Map (JSON)
{
"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:88, in:118, as:124, func:140, preload:164, is:178, class_name:188, extends:192, signal:196, pass:200, return:204, class:216, if:224, elif:228, else:232, for:236, match:240, while:256}\nexport const parser = LRParser.deserialize({\n version: 14,\n states: \"KhQ`QUOOP#rOQOOOOQQ'#Cq'#CqOOQQ'#Ch'#ChO#wQUO'#CbO#|QUO'#CaO%xQYO'#CyO&iQUO'#CzO&nQUO'#CxO(mQYO'#FnO*eQUO'#CwO*lQYO'#FnO*yQUO'#DOOOQQ'#Fr'#FrO,fQYO'#C`O,sQYO'#C}O,xQUO'#DnO(tQUO'#DqOOQQ'#ER'#ERO(tQUO'#EZOOQQ'#Fn'#FnOOQQ'#C`'#C`O.iQUO'#C_OOQR'#C_'#C_O.tQVO'#EnOOQR'#Ej'#EjOOQR'#Fh'#FhOOQR'#FR'#FRQ`QUOOOOQQ'#Cl'#ClO1jQUO'#DOO1oQUO'#DTO(tQUO'#DXO1tQUO'#EmO1yQUO'#EPO1yQUO'#CsO2OQUO'#E]O2TQUO'#E_O2YQUO'#EaOOQQ'#Ec'#EcO(tQUO'#EeO2_QUO'#EkO,xQUO'#EoO2dQUO'#EuO2iQUO'#EwO,xQUO'#FPP2nOUO'#FgPOOO)CAZ)CAZO2yQUO,58|O3hQUO'#DQOOQQ,59q,59qO(tQUO,59iOOQQ,5:U,5:UO3mQUO'#CuO3tQYO,59fO5tQUO'#FUO5yQYO,59dOOQQ,59c,59cO8PQUO,59cOOQQ'#FV'#FVO8UQUO'#DOO8aQYO'#FmO8nQUO'#DsO8sQUO,59cO,xQUO,5:YOOQQ-E9T-E9TO8zQUO,59jO9PQUO,59oO9UQUO,5;VO9ZQUO,5;XO(tQUO,59uO(tQUO,59uO(tQUO,59uO(tQUO,59uO(tQUO,59uO(tQUO,59uO(tQUO,59uO(tQUO,59uO(tQUO,59uO(tQUO,59uO(tQUO,5:oO(tQUO,59uO9`QUO,59uO3hQUO,5:VO9eQUO,5:rO:tQYO'#DpO;OQUO'#FsO;WQU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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 AssignOp 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,106,\"Statement\",-18,12,27,28,30,33,43,45,60,61,64,67,68,69,81,83,85,88,91,\"ExpressionNode\",-3,34,39,41,\"AssignableNode\"],\n [\"openedBy\", 9,\"(\"],\n [\"closedBy\", 10,\")\"]\n ],\n propSources: [gdscriptHighlighting],\n skippedNodes: [0,1],\n repeatNodeCount: 11,\n tokenData: \"@j~R|XY#{pq#{qr$Wrs$est(Vtu(quv(vvw)Vwx)dxy-Uyz-Zz{-`{|-m|}-w}!O-|!O!P.`!P!Q/k!Q!R/u!R![0g![!]2X!]!^2`!^!_2e!_!`2u!`!a2}!a!b3Y!b!c3_!c!}3d!}#O3u#P#Q3z#Q#R4P#R#S4X#T#U4l#U#Y3d#Y#Z6P#Z#b3d#b#c8a#c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d#R#S3d#T#i3d#i#j?V#j#o3d~?[UW~!Q![3d!c!}3d#R#S3d#T#X3d#X#Y?n#Y#o3d~?uS]~W~!Q![3d!c!}3d#R#S3d#T#o3d~@WO!c~~@]P!T~#p#q@`~@eO!Z~~@jO!a~\",\n tokenizers: [indentation, newlines, 0, 1, 2],\n topRules: {\"Script\":[0,2]},\n specialized: [{term: 8, get: value => spec_Identifier[value] || -1}],\n tokenPrec: 3480\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 = 141,\n dedent = 142,\n newline = 143,\n blankLineStart = 144,\n newlineBracketed = 145,\n eof = 146,\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 = 43,\n BinaryOperatorExpressionNode = 45,\n AndOp = 54,\n OrOp = 56,\n NotOp = 58,\n CallExpressionNode = 60,\n CastExpressionNode = 61,\n DictionaryExpressionNode = 64,\n BraceL = 65,\n DictionaryEntry = 66,\n GroupedExpressionNode = 67,\n IdentifierExpressionNode = 68,\n LambdaExpressionNode = 69,\n CallParamsParameterNode = 71,\n FunctionReturnType = 73,\n Body = 74,\n SuiteNodeBody = 75,\n Newline = 76,\n SuiteNode = 77,\n Indent = 78,\n Dedent = 79,\n ExpressionNodeBody = 80,\n PreloadExpressionNode = 81,\n SelfToken = 84,\n TernaryOperatorExpressionNode = 85,\n TypeTestExpressionNode = 88,\n ClassName = 90,\n UnaryOperatorNode = 91,\n ClassNameStatement = 93,\n ExtendsStatement = 95,\n SignalStatement = 97,\n PassStatement = 99,\n ReturnNode = 101,\n Eof = 103,\n CompoundStatement = 106,\n ClassNode = 107,\n FunctionNode = 109,\n IfNode = 110,\n IfClause = 111,\n ElifClause = 113,\n ElseClause = 115,\n ForNode = 117,\n MatchNode = 119,\n MatchBranchNode = 121,\n PatternNode = 122,\n WhileNode = 127\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 }\n}\nclass TreeNode {\n constructor(_tree, from, \n // Index in parent node, set to -1 if the node is not a direct child of _parent.node (overlay)\n index, _parent) {\n this._tree = _tree;\n this.from = from;\n this.index = index;\n this._parent = _parent;\n }\n get type() { return this._tree.type; }\n get name() { return this.