pub struct ParseTree { /* private fields */ }
Expand description
A fully parsed feature file, with attached imports and a sourcemap.
As well as representing the entire AST, this type also allows mapping tokens and other spans back to a position in a particular source file.
This is cheap to clone, so it can be attached to diagnostics, allowing them to print themselves where needed.
Implementations§
Source§impl ParseTree
impl ParseTree
Sourcepub fn typed_root(&self) -> Root
pub fn typed_root(&self) -> Root
The root node, as typed AST node
Sourcepub fn source_map(&self) -> &SourceMap
pub fn source_map(&self) -> &SourceMap
Return a refernce to the source map
Sourcepub fn get_source(&self, id: FileId) -> Option<&Source>
pub fn get_source(&self, id: FileId) -> Option<&Source>
Return the source for this id, if it exists in the source map
Sourcepub fn format_diagnostic(&self, err: &Diagnostic, colorize: bool) -> String
pub fn format_diagnostic(&self, err: &Diagnostic, colorize: bool) -> String
Generate a string suitable for presenting a Diagnostic
to the user.
This associates the message with the appropriate source location and syntax highlighting.
Trait Implementations§
impl StructuralPartialEq for ParseTree
Auto Trait Implementations§
impl Freeze for ParseTree
impl RefUnwindSafe for ParseTree
impl Send for ParseTree
impl Sync for ParseTree
impl Unpin for ParseTree
impl UnwindSafe for ParseTree
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
Source§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
Convert this type into
T
, using the provided data to resolve any offsets.