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 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more