Skip to main content

doc_for_phrase

Function doc_for_phrase 

Source
pub fn doc_for_phrase(
    source: &str,
    tokens: &[Token],
    at: usize,
) -> Option<(&'static ConstructDoc, Span)>
Expand description

The comparison a run of English tokens spells, read around the token at at: is less than, greater than or equal to, at least, is equal to, not equal to, equals. The lexer hands most of these to the parser one word at a time (less is a comparative, than is than), so no single token carries the meaning; this reads the words the parser reads. Gives the lesson and the span of the whole phrase, for a hover to cover and an editor to colour.