pub enum SkipPolicy {
None,
Whitespace,
Newlines,
}Expand description
How chars(P, skip:) trims between matches (§7.5).
Read the two non-None variants as an inclusion, because the names do not
say so. Whitespace is horizontal whitespace; Newlines is horizontal
whitespace and line endings. So Newlines skips strictly more than
Whitespace — whitespace is the narrower policy despite being the broader
English word, and skip: newlines means “newlines as well”, not “newlines
only”.
That inversion is not academic: chars(one_of("^v<>"), skip: whitespace) —
§7.5’s own example — looks like it should absorb an input file’s trailing
\n. It does not, and it does not have to: the terminator is inside the
root region — the root region is the whole buffer, and nothing is trimmed off
it — and it is forgiven because it is whitespace the character parser
declined (walk_characters asks the child first and accepts a
whitespace-only leftover through ByteRegion::is_all_whitespace, the bound
half of ADR-078’s rule). No skip policy has to account for it. The sets are
the ones §7.5’s example needs, and swapping them would silently change what
every existing skip: newlines program accepts. walk_characters /
skip_chars in praxis-runtime is the implementation, and
SkipPolicy::skips below is the single description both the runtime comment
and the skip: diagnostic quote.
Variants§
None
No trimming between matches: every byte of the region is the child’s.
Whitespace
Skip horizontal whitespace — spaces and tabs — between matches. Not line endings: see the type’s own documentation.
Newlines
Skip horizontal whitespace and line endings between matches. The broader of the two policies.
Implementations§
Source§impl SkipPolicy
impl SkipPolicy
Sourcepub const ALL: &'static [SkipPolicy]
pub const ALL: &'static [SkipPolicy]
Every policy, in §7.5’s order. The list is closed: a test sweeps it.
Sourcepub fn from_keyword(name: &str) -> Option<Self>
pub fn from_keyword(name: &str) -> Option<Self>
Parse a skip: keyword value, or None if unknown.
Trait Implementations§
Source§impl Clone for SkipPolicy
impl Clone for SkipPolicy
Source§fn clone(&self) -> SkipPolicy
fn clone(&self) -> SkipPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more