pub enum ParsingError<'input> {
Grammar(Error<Rule>),
CouldntBuildAST(SimpleError<'input>),
}Expand description
Error happened while parsing, this can happen due to a grammar parsing error, or if the syntax it’s right, because the of a series of ASTBuildingError.
Variants§
Grammar(Error<Rule>)
Happens if the script doesn’t match Moon Script’s grammar.
CouldntBuildAST(SimpleError<'input>)
Happens if the grammar is right, but at least one ASTBuildingError happens.
Why isn’t this a series of ASTBuildingErrors?: Individual programs are extremely unlikely to manually use them internally, but rather want a clear output telling why the script is wrong, with simple_detailed_error::SimpleError, Moon Script is able to specifies as many errors as possible using a clear tree structure, and errors are given with colors* when printing errors, showing with clarity where the error happens.
- For accessibility, please, read the colored create used by simple_detailed_error, which uses NO_COLOR.
Implementations§
Source§impl<'input> ParsingError<'input>
impl<'input> ParsingError<'input>
pub fn couldnt_build_ast_error(self) -> Option<SimpleError<'input>>
Source§impl<'input> ParsingError<'input>
impl<'input> ParsingError<'input>
Sourcepub fn to_simple_error(self) -> SimpleError<'input>
pub fn to_simple_error(self) -> SimpleError<'input>
Turns this parsing error into a SimpleError that can easily be displayed to developers for discovering what was wrong when they wrote a Script.
Trait Implementations§
Source§impl<'input> Clone for ParsingError<'input>
impl<'input> Clone for ParsingError<'input>
Source§fn clone(&self) -> ParsingError<'input>
fn clone(&self) -> ParsingError<'input>
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'input> Debug for ParsingError<'input>
impl<'input> Debug for ParsingError<'input>
Source§impl<'input> Display for ParsingError<'input>
impl<'input> Display for ParsingError<'input>
Source§impl<'input> Error for ParsingError<'input>
Available on crate feature std only.
impl<'input> Error for ParsingError<'input>
std only.1.30.0§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0§fn description(&self) -> &str
fn description(&self) -> &str
Source§impl<'input> From<ParsingError<'input>> for SimpleError<'input>
impl<'input> From<ParsingError<'input>> for SimpleError<'input>
Source§fn from(value: ParsingError<'input>) -> Self
fn from(value: ParsingError<'input>) -> Self
Auto Trait Implementations§
impl<'input> Freeze for ParsingError<'input>
impl<'input> !RefUnwindSafe for ParsingError<'input>
impl<'input> !Send for ParsingError<'input>
impl<'input> !Sync for ParsingError<'input>
impl<'input> Unpin for ParsingError<'input>
impl<'input> !UnwindSafe for ParsingError<'input>
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)