pub struct ASTWithValidityInfo { /* private fields */ }
Expand description
Contains a GrammarAST
structure produced from a grammar source file.
As well as any errors which occurred during the construction of the AST.
Implementations§
source§impl ASTWithValidityInfo
impl ASTWithValidityInfo
sourcepub fn new(yacc_kind: YaccKind, s: &str) -> Self
pub fn new(yacc_kind: YaccKind, s: &str) -> Self
Parses a source file into an AST, returning an ast and any errors that were
encountered during the construction of it. The ASTWithValidityInfo
can be
then unused to construct a YaccGrammar
, which will either produce an
Ok(YaccGrammar)
or an Err
which includes these errors.
sourcepub fn ast(&self) -> &GrammarAST
pub fn ast(&self) -> &GrammarAST
Returns a GrammarAST
constructed as the result of parsing a source file.
When errors have occurred and is_valid
returns false, this AST is the
subset of the source file which parsed correctly while not encountering
any errors. As such even when an AST is not valid, it will return an AST.
sourcepub fn is_valid(&self) -> bool
pub fn is_valid(&self) -> bool
Returns whether any errors where encountered during the parsing and validation of the AST during it’s construction.
sourcepub fn errors(&self) -> &[YaccGrammarError]
pub fn errors(&self) -> &[YaccGrammarError]
Returns all errors which were encountered during AST construction.