en Exports - chiba233/yume-dsl-token-walker GitHub Wiki

Exports

Home | Interpret

Complete export reference. For detailed documentation, follow the links to individual wiki pages.

Synchronous

Export Kind Description Details
interpretText function Parse DSL text + interpret in one call Interpret
interpretTokens function Walk a token tree and yield output nodes Interpret
flattenText function Extract plain text from a token value Interpret
createRuleset helper Identity function for type inference Interpret
fromHandlerMap helper Build interpret from a handler record Interpret
dropToken helper Handler that emits nothing Interpret
unwrapChildren helper Handler that passes through children Interpret
wrapHandlers helper Wrap every handler with shared logic Interpret
debugUnhandled helper Render unhandled tokens as placeholders Interpret
collectNodes helper Array.from sugar for generators Interpret

Structural Query

Export Kind Description Details
findFirst function DFS — first matching node Structural Query
findAll function DFS — all matching nodes Structural Query
walkStructural function DFS — visit every node with context Structural Query
nodeAtOffset function Deepest node at source offset Structural Query
nodePathAtOffset function Full path from root to deepest node at offset Structural Query
enclosingNode function Deepest tag node at source offset Structural Query

Lint

Export Kind Description Details
lintStructural function Run rules, return sorted diagnostics Lint
applyLintFixes function Apply fixable diagnostics atomically Lint

Structural Slice

Export Kind Description Details
parseSlice function Re-parse a region with position mapping (optional fullTree for shorthand fallback optimization) Structural Slice

Incremental Sugar

Export Kind Description Details
toSliceEdit function Convert SourceSpan to IncrementalEdit Incremental Sugar
replaceSliceText function Pure string replace by span offsets Incremental Sugar
createSliceSession function Create an incremental session Incremental Sugar
applyIncrementalEditBySpan function Apply span edit to session Incremental Sugar

Asynchronous

Export Kind Description Details
interpretTextAsync function Async parse + interpret Async Interpret
interpretTokensAsync function Async token tree walk Async Interpret
fromAsyncHandlerMap helper Async version of fromHandlerMap Async Interpret
wrapAsyncHandlers helper Async version of wrapHandlers Async Interpret
collectNodesAsync helper Collect AsyncIterable to array Async Interpret

Types

Interpret (sync)

Type What it is Details
InterpretRuleset<TNode, TEnv> The ruleset you pass to interpretTokenscreateText, interpret, onUnhandled?, onError? Interpret
InterpretResult<TNode> Return type of interpret — 5 variants: nodes, text, flatten, unhandled, drop Interpret
ResolvedResult<TNode> InterpretResult minus unhandled — return type for onUnhandled strategy functions Interpret
InterpretHelpers<TNode, TEnv> Object passed to interpretinterpretChildren, flattenText, env Interpret
UnhandledStrategy<TNode, TEnv> "throw" | "flatten" | "drop" | function — what to do with unhandled tokens Interpret
TokenHandler<TNode, TEnv> Shorthand for a single sync handler function: (token, helpers) => ResolvedResult Interpret
TextResult { type: "text"; text: string } — return type of debugUnhandled's callback Interpret

Interpret (async)

Type What it is Details
AsyncInterpretRuleset<TNode, TEnv> Async version of InterpretRulesetinterpret can return Promise Async Interpret
AsyncInterpretResult<TNode> Like InterpretResult but nodes can be AsyncIterable Async Interpret
AsyncResolvedResult<TNode> AsyncInterpretResult minus unhandled Async Interpret
AsyncInterpretHelpers<TNode, TEnv> Like InterpretHelpers but interpretChildren returns AsyncIterable Async Interpret
AsyncUnhandledStrategy<TNode, TEnv> Like UnhandledStrategy but callback can return Awaitable Async Interpret
AsyncTokenHandler<TNode, TEnv> Shorthand for an async handler function Async Interpret
Awaitable<T> T | Promise<T> — used throughout async API signatures Async Interpret

Parser

Type What it is Details
ParserLike Any object with parse(input, overrides?)createParser(...) satisfies this Structural Slice
ParseOverrides Options for ParserLike.parsetrackPositions, baseOffset, tracker Structural Slice

Incremental Sugar

Type What it is Details
SliceSession Stateful incremental session — getDocument, applyEdit, rebuild Incremental Sugar
SliceSessionApplyResult Result of applyEditdoc, mode, fallbackReason? Incremental Sugar

Structural Query

Type What it is Details
StructuralTagNode Extract<StructuralNode, { type: "inline" | "raw" | "block" }> — narrowed tag node Structural Query
StructuralVisitContext { parent, depth, index } — context for predicates and visitors Structural Query
StructuralPredicate (node, ctx) => boolean — predicate for findFirst / findAll Structural Query
StructuralVisitor (node, ctx) => void — visitor for walkStructural Structural Query

Lint

Type What it is Details
LintRule Rule interface — id, severity?, check(ctx) Lint
LintContext Context in checksource, tree, report, findFirst, findAll, walk Lint
LintOptions Options for lintStructuralrules, overrides?, parseOptions?, onRuleError?, failFast? Lint
Diagnostic Lint result — ruleId, severity, message, span, node?, fix? Lint
DiagnosticSeverity "error" | "warning" | "info" | "hint" Lint
Fix Auto-fix — description, edits: TextEdit[] Lint
TextEdit Source edit — span: SourceSpan, newText: string Lint
ReportInfo Argument to ctx.report()Diagnostic minus ruleId, severity optional Lint
⚠️ **GitHub.com Fallback** ⚠️