Skip to main content

parse

Function parse 

Source
pub fn parse(
    tokens: &[Token],
    unit_range: SourceRange,
    packing: &PackMap,
    targets: &TargetOptionMap,
    options: &Options,
    diags: &mut Diagnostics,
) -> TranslationUnit
Expand description

Parses a token list into a TranslationUnit.

The tokens are the preprocessor’s, so there are no directives left to see and every range already points where a diagnostic should land — at the invocation, for a token a macro produced.

unit_range is the range the whole translation unit covers — normally crate::Source::root_range. The token list must end with TokenKind::Eof. Diagnostics are pushed into diags; the returned tree is a best effort and may contain TypeKind::Error/StmtKind::Error placeholders.