Skip to main content

preprocess_singletons

Function preprocess_singletons 

Source
pub fn preprocess_singletons(
    tokens: TokenStream,
    found: &mut Vec<SingletonRef>,
) -> TokenStream
Expand description

Finds all the singleton references and appends them to found. Returns the TokenStream but with the #, {N}, and mut removed from the varnames.

Syntax: #var, #mut var, #{N} var, #{N} mut var

The returned tokens are used for “preflight” parsing, to check that the rest of the syntax is OK. However the returned tokens are not used in the codegen as we need to use postprocess_singletons later to substitute-in the context referencing code for each singleton