pub fn tokenize_recovering_in(
source: &str,
file: FileId,
) -> (Vec<Token>, Vec<CompileError>)Expand description
#2807: tokenise source, recovering from lexical errors instead of
stopping at the first. Every error is returned, in source order, beside the
tokens of everything the lexer could read: a bad character, a malformed or
out-of-range literal, an unterminated string, an unclosed doc block and a
/// doc habit each yield an error and are then skipped (a string to the end
of its line), so the text after them still lexes. The skipped text produces
no token, which the parser sees as a gap; without_lex_echoes drops the
syntax errors that gap causes.
The strict entry points (tokenize and kin) are this function with the
first error kept and the tokens dropped. Callers that must not act on a file
holding any lex error (the formatter, which would delete the skipped text)
use those.