Skip to main content

scan

Function scan 

Source
pub fn scan(src: &str) -> (Vec<Token>, Vec<ParseError>)
Expand description

Scan Quilt source into spanned tokens and diagnostics. Never fails.

The tokens tile the source: concatenating &src[t.span] in order reproduces it exactly, with no gaps and no overlaps (tokens_tile_the_source pins that). A consumer walking them therefore sees every byte, which is what lets quilt-lsp build its projections by copying spans.

Recovery is: a bracket still open at end of input is reported and closed, a closer that does not match the open bracket closes it anyway, and anything else unparseable becomes a TokenKind::Error token and the scan carries on. Errors come back in source order.