Skip to main content

Module trace

Module trace 

Source
Expand description

Parse tracing: log events as the parser runs.

The canonical TypeScript runtime defines SIX selectable kinds — step, rule, lex, parse, node, stack — driven by the engine’s ctx.log callback. The Rust engine has no ctx.log; it exposes typed subscribers instead, so each kind is wired to the subscriber that carries its information:

KindRust source
lexsubscribe_lex
rulesubscribe_rules
stacksubscribe_rules (the context’s rule stack)
parsesubscribe_rule_done (the matched alternate)
nodesubscribe_rule_done (the completed node)
stepno engine hook — see below

step is the raw passthrough kind: in TypeScript the engine itself calls ctx.log('step', …) once per parse step. The Rust engine emits no such event, so selecting step here is accepted (the option name stays in step with the other runtimes) but nothing is ever logged for it. That is an engine-API limit, recorded in docs/reference.md.

Structs§

TraceKinds
Which trace kinds are logged.

Constants§

TRACE_BANNER
The banner written once at the start of each traced parse.