Skip to main content

Module scan

Module scan 

Source
Expand description

Interior re-scan of a backtick template (§7.2, §7.3).

A BacktickTemplate token spans both backticks but its interior is opaque at lex time. This module re-scans the interior into a sequence of TemplateParts: literal runs and {...} captures. Whitespace policy escapes (\s*, \s+, \n, \t, \x20) are recognized here (§7.2).

A capture body is a full parser expression (D10). {items:csv(int)} is §7.7’s own monkey example, so “atomics only” is not a smaller language — it is a language that cannot run the design document’s text. The body is parsed here, by crate::body, and not handed back to praxis-parser: ADR-023 fixes the dependency direction, and this crate must not depend on the ordinary grammar.

§The cursor

Every position here is a scalar boundary with its absolute byte offset in interior. The scanner walks char_indices, never bytes: char::from(u8) is a Latin-1 decode, and it would both split a multi-byte scalar and turn λ= into λ=.

Enums§

ScanError
An error encountered while scanning a template interior or a capture body.

Constants§

MAX_NESTING
How deeply captures and nested templates may nest before the scanner refuses (D10).

Functions§

scan_template
Re-scan the interior of a backtick template into template parts.