pub fn parse_root(
path: PathBuf,
glyph_map: Option<&GlyphMap>,
resolver: Box<dyn SourceResolver>,
) -> Result<(ParseTree, DiagnosticSet), SourceLoadError>
Expand description
Entry point for parsing.
This method provides full control over how sources are located and include
statements are resolved, by allowing you to provide a custom SourceResolver
.
The path
argument is identifies the root source; it will be resolved against
the provided resolver
.
The glyph_map
, if provided, is used to disambiguate between certain tokens
that are allowed in FEA syntax but which are also legal glyph names. If you
are not compiling the parse results, you can omit it.
This returns an error if a source could not be located; otherwise it returns
a parse tree and a set of diagnostics, even if parsing fails. The caller must
check that there are no errors (via DiagnosticSet::has_errors
) to know
whether or not parsing was successful.