pub struct ParseContext {
pub file: SourceFile,
pub config: ParserConfig,
pub diagnostics: ParseDiagnostics,
}Expand description
A parse context: wraps a source file plus configuration.
Fields§
§file: SourceFileThe source file being parsed.
config: ParserConfigParser configuration.
diagnostics: ParseDiagnosticsAccumulated diagnostics during parsing.
Implementations§
Source§impl ParseContext
impl ParseContext
Sourcepub fn new(file: SourceFile, config: ParserConfig) -> Self
pub fn new(file: SourceFile, config: ParserConfig) -> Self
Create a new parse context.
Sourcepub fn from_source(source: impl Into<String>) -> Self
pub fn from_source(source: impl Into<String>) -> Self
Create a context from a source string with default config.
Sourcepub fn has_errors(&self) -> bool
pub fn has_errors(&self) -> bool
Check if any errors occurred during parsing.
Sourcepub fn emit_error(&mut self, msg: impl Into<String>)
pub fn emit_error(&mut self, msg: impl Into<String>)
Emit an error diagnostic.
Trait Implementations§
Source§impl Clone for ParseContext
impl Clone for ParseContext
Source§fn clone(&self) -> ParseContext
fn clone(&self) -> ParseContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ParseContext
impl RefUnwindSafe for ParseContext
impl Send for ParseContext
impl Sync for ParseContext
impl Unpin for ParseContext
impl UnsafeUnpin for ParseContext
impl UnwindSafe for ParseContext
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