Read a string_lit value (skipping the quotes / template start/end tokens).
(node: SyntaxNode, source: string)
| 40 | |
| 41 | /** Read a string_lit value (skipping the quotes / template start/end tokens). */ |
| 42 | function stringLitValue(node: SyntaxNode, source: string): string { |
| 43 | const literal = node.namedChildren.find((c) => c?.type === 'template_literal'); |
| 44 | if (literal) return getNodeText(literal, source); |
| 45 | // Empty string ("") parses as quoted_template_start + quoted_template_end |
| 46 | // with no template_literal — return empty. |
| 47 | return ''; |
| 48 | } |
| 49 | |
| 50 | /** Block "type" and its label values. Returns null if the block is malformed. */ |
| 51 | function readBlockHeader(block: SyntaxNode, source: string): { type: string; labels: string[] } | null { |
no test coverage detected