@gdquest/gd-exercise
Version:
Core package that handles logic for the GDExercise project.
4 lines • 493 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 console.log(\"indent body\");\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 console.log(\"return null\");\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 console.log(\"Body\", context);\n return indentBody(context, context.node) ?? context.continue();\n },\n SuiteNode: (context) => {\n console.log(\"SuiteNode\", context);\n return indentBody(context, context.node) ?? context.continue();\n },\n String: () => {\n console.log(\"String\");\n return null;\n },\n Script: (context) => {\n console.log(\"Script\");\n\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 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,assert:12, PI:52, TAU:54, INF:56, NaN:58, var:64, const:74, await:82, in:112, as:118, func:136, preload:150, is:164, class_name:174, extends:178, signal:182, pass:186, return:190, class:200, if:208, elif:212, else:216, for:220, match:224, while:240}\nexport const parser = LRParser.deserialize({\n version: 14,\n states: \"LQQ`QUOOP#rOQOOO%bQYO'#CiO%lQUO'#ChO'bQUO'#CgO'iQYO'#FcOOQQ'#Cz'#CzOOQQ'#Cq'#CqO)lQUO'#CnO)qQUO'#E{O*YQUO'#CmOOQQ'#Fd'#FdO+uQYO'#EbO,PQUO'#EbO,[QUO'#DkO-{QUO'#DnO%qQUO'#DoOOQQ'#Dz'#DzO.QQUO'#ESOOQQ'#Fc'#FcOOQQ'#Fa'#FaO/qQUO'#C_OOQR'#C_'#C_O/yQUO'#EfO,SQUO'#EbOOQR'#F`'#F`OOQR'#Ey'#EyQ`QUOOOOQQ'#Cu'#CuO0XQUO'#CmO0^QUO'#DQO.QQUO'#DUO0cQUO'#EeO0hQUO'#DxO0hQUO'#C`O0mQUO'#EUO0rQUO'#EWO0wQUO'#EYOOQQ'#E['#E[O.QQUO'#E^O0|QUO'#EcO,[QUO'#EgO1RQUO'#EmO1WQUO'#EoO,[QUO'#EwP1]OUO'#F_POOO)CAR)CARO1kQUO'#C}OOQQ,59n,59nO.QQUO,59WOOQQ,5:R,5:RO1pQUO'#CeO1wQUO'#EzO1|QYO,59SOOQQ,59R,59RO4SQUO,59ROOQQ'#E{'#E{O4XQUO'#CmO5nQYO'#FbO5{QUO'#ClO6QQUO'#DqO6VQUO,59RO,[QUO,5:VO6^QUO,59YOOQR,5:|,5:|OOQQ-E8y-E8yO6xQUO,59XO6}QUO,59lO7SQUO,5:}O7XQUO,5;PO.QQUO,59rO.QQUO,59rO.QQUO,59rO.QQUO,59rO.QQUO,59rO.QQUO,59rO.QQUO,59rO.QQUO,59rO.QQUO,59rO.QQUO,59rO%qQUO,5:hO.QQUO,59rO7^QUO,59rO1kQUO,5:SO7cQUO,5:kO8rQYO'#DmO8|QUO'#FiO9UQUO,5:VO9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_!Y!]S`!T!_!r#s$b%P%t%u&q&s&u&w&y&{&}'P'R'T'V'X'Z']'u'w(U(V!S(O^y|!`#T$c$x%i&Q&r&t&v&x&z&|'O'Q'S'U'W'Y'['^'v'xu(Pbow!R!h!i!j!k!l!m!n!o!p!q!s$^$o%eR%_#zQ!y^R#y!`Q#w!^Q$s#ZR%d$PR%V#u\",\n nodeNames: \"\u26A0 Comment Script SimpleStatement AssertNode Identifier assert ) ( CallParams ] ArrayExpressionNode SubscriptExpressionNode VariableName . [ AssignmentExpressionNode VariableNode AnnotationNode @ CallParams LiteralExpressionNode True False Null BuiltinConstants PI TAU INF NaN String , 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 GetNodeExpressionNode GroupedExpressionNode IdentifierExpressionNode LambdaExpressionNode func CallParams AssignmentExpressionNode FunctionReturnType Body SuiteNode PreloadExpressionNode preload SelfExpressionNode SelfToken TernaryOperatorExpressionNode TernaryOp TernaryOp TypeTestExpressionNode is ClassName UnaryOperatorNode ArithOp ClassNameStatement class_name ExtendsStatement extends SignalStatement signal PassStatement pass ReturnNode return 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: 159,\n context: trackIndent,\n nodeProps: [\n [\"group\", -2,3,98,\"Statement\",-18,11,12,16,21,40,42,57,58,61,64,65,66,67,74,76,78,81,84,\"ExpressionNode\",-3,17,36,38,\"AssignableNode\"],\n [\"openedBy\", 7,\"(\"],\n [\"closedBy\", 8,\")\"]\n ],\n propSources: [gdscriptHighlighting],\n skippedNodes: [0,1],\n repeatNodeCount: 11,\n tokenData: \"@V~R|XY#{p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`3S#`#a<v#a#o3S~<{UT~!Q![3S!c!}3S#R#S3S#T#Y3S#Y#Z=_#Z#o3S~=fS!o~T~!Q![3S!c!}3S#R#S3S#T#o3S~=wUT~!Q![3S!c!}3S#R#S3S#T#f3S#f#g>Z#g#o3S~>`UT~!Q![3S!c!}3S#R#S3S#T#i3S#i#j>r#j#o3S~>wUT~!Q![3S!c!}3S#R#S3S#T#X3S#X#Y?Z#Y#o3S~?bSf~T~!Q![3S!c!}3S#R#S3S#T#o3S~?sO!`~~?xP!Q~#p#q?{~@QO!W~~@VO!^~\",\n tokenizers: [indentation, newlines, 0, 1, 2],\n topRules: {\"Script\":[0,2]},\n specialized: [{term: 5, get: value => spec_Identifier[value] || -1}],\n tokenPrec: 3624\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 // 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]);\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)) input.acceptToken(newlineBracketed, 1);\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 } 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 prev = input.peek(-1);\n if (prev !== -1 && prev !== newline) {\n return;\n }\n\n let spaces = 0;\n while (input.next === space || input.next === tab) {\n input.advance();\n spaces++;\n }\n\n if (\n (input.next === newline || input.next === hash) &&\n stack.canShift(blankLineStart)\n ) {\n input.acceptToken(blankLineStart, -spaces);\n } else if (spaces > stack.context.depth) {\n input.acceptToken(indent);\n } else if (spaces < stack.context.depth) {\n input.acceptToken(dedent, -spaces);\n }\n});\n", "// This file was generated by lezer-generator. You probably shouldn't edit it.\nexport const\n indent = 133,\n dedent = 134,\n newline = 135,\n blankLineStart = 136,\n newlineBracketed = 137,\n eof = 138,\n Comment = 1,\n Script = 2,\n SimpleStatement = 3,\n AssertNode = 4,\n Identifier = 5,\n ParenL = 8,\n ArrayExpressionNode = 11,\n SubscriptExpressionNode = 12,\n VariableName = 13,\n BracketL = 15,\n VariableNode = 17,\n AnnotationNode = 18,\n LiteralExpressionNode = 21,\n True = 22,\n False = 23,\n Null = 24,\n BuiltinConstants = 25,\n String = 30,\n TypeCast = 33,\n Type = 35,\n ConstantNode = 36,\n ParameterNode = 38,\n AwaitExpressionNode = 40,\n BinaryOperatorExpressionNode = 42,\n AndOp = 51,\n OrOp = 53,\n NotOp = 55,\n CallExpressionNode = 57,\n CastExpressionNode = 58,\n DictionaryExpressionNode = 61,\n BraceL = 62,\n DictionaryEntry = 63,\n GetNodeExpressionNode = 64,\n GroupedExpressionNode = 65,\n IdentifierExpressionNode = 66,\n LambdaExpressionNode = 67,\n FunctionReturnType = 71,\n Body = 72,\n SuiteNode = 73,\n PreloadExpressionNode = 74,\n SelfToken = 77,\n TernaryOperatorExpressionNode = 78,\n TypeTestExpressionNode = 81,\n ClassName = 83,\n UnaryOperatorNode = 84,\n ClassNameStatement = 86,\n ExtendsStatement = 88,\n SignalStatement = 90,\n PassStatement = 92,\n ReturnNode = 94,\n CompoundStatement = 98,\n ClassNode = 99,\n FunctionNode = 101,\n IfNode = 102,\n IfClause = 103,\n ElifClause = 105,\n ElseClause = 107,\n ForNode = 109,\n MatchNode = 111,\n MatchBranchNode = 113,\n PatternNode = 114,\n WhileNode = 119\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._tree.type.name; }\n get to() { return this.from + this._tree.length; }\n nextChild(i, dir, pos, side, mode = 0) {\n for (let parent = this;;) {\n for (let { children, positions } = parent._tree, e = dir > 0 ? children.length : -1; i != e; i += dir) {\n let next = children[i], start = positions[i] + parent.from;\n if (!checkSide(side, pos, start, start + next.length))\n continue;\n if (next instanceof TreeBuffer) {\n if (mode & IterMode.ExcludeBuffers)\n continue;\n let index = next.findChild(0, next.buffer.length, dir, pos - start, side);\n