MCPcopy Create free account
hub / github.com/AlexErrant/Pentive / getLabel

Function getLabel

shared-dom/src/language/query2sql.ts:157–170  ·  view source on GitHub ↗
(node: SyntaxNodeRef)

Source from the content-addressed store, hash-verified

155}
156
157export function getLabel(node: SyntaxNodeRef) {
158 if (node.type.is(qt.Group) || node.type.isTop) return undefined
159 if (!node.type.is(qt.Label)) node = node.node.parent! // "if not label, set node to its parent". Note that we reassign `node`.
160 let child = node.node.firstChild
161 while (child != null && !stringLabels.includes(child.type.name)) {
162 child = child.nextSibling
163 }
164 const label = child?.name
165 console.assert(
166 labels.includes(label as never),
167 `Expected Label but got ${label}.`,
168 )
169 return label as Label
170}
171
172function buildContent(node: SyntaxNodeRef, input: string, negate: boolean) {
173 let valueFrom

Callers 3

inLabelFunction · 0.90
inLabelsFunction · 0.90
astEnterFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected