Function convert_directive

Source
pub fn convert_directive<'a>(
    directive: &'a Directive<'a>,
    location: SourceLocation,
    language: Language,
    config: &ParserConfig,
) -> Result<DirectiveIR, ConversionError>
Expand description

Convert a parser Directive to IR DirectiveIR

ยงExample

let directive = Directive {
    name: "parallel".into(),
    clauses: vec![
        Clause {
            name: "default".into(),
            kind: ClauseKind::Parenthesized("shared".into()),
        },
    ],
};

let config = ParserConfig::default();
let ir = convert_directive(&directive, SourceLocation::start(), Language::C, &config).unwrap();
assert!(ir.kind().is_parallel());