pub struct DebugInfo<'a> { /* private fields */ }Available on crate feature
debug only.Expand description
A catch-all box of tricks for debugging a parser.
Implementations§
Source§impl<'a> DebugInfo<'a>
impl<'a> DebugInfo<'a>
Sourcepub fn to_ebnf(&self) -> String
pub fn to_ebnf(&self) -> String
Generate a string containing an eBNF grammar for this parser.
The exact format of the grammar definition is not specified, and is only intended to be read by a human being.
Sourcepub fn to_railroad_svg(&self) -> impl Display + Clone
pub fn to_railroad_svg(&self) -> impl Display + Clone
Generate a human-readable railroad diagram that describes the grammar.
The resulting diagram is in SVG format and may be printed to the console, written to a file, etc.
The exact format of the diagram is not specified and its quality may depend heavily on annotations, such as Parser::labelled.
Aspects of the grammar may also not be captured. For example, context-sensitive parsers are largely ignored today.
§Examples
Here is a generated railroad diagram for the example JSON parser. See examples/json.rs in the repository.
Auto Trait Implementations§
impl<'a> Freeze for DebugInfo<'a>
impl<'a> RefUnwindSafe for DebugInfo<'a>
impl<'a> Send for DebugInfo<'a>
impl<'a> Sync for DebugInfo<'a>
impl<'a> Unpin for DebugInfo<'a>
impl<'a> UnsafeUnpin for DebugInfo<'a>
impl<'a> UnwindSafe for DebugInfo<'a>
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T, S> SpanWrap<S> for Twhere
S: WrappingSpan<T>,
impl<T, S> SpanWrap<S> for Twhere
S: WrappingSpan<T>,
Source§fn with_span(self, span: S) -> S::Spanned
fn with_span(self, span: S) -> S::Spanned
Invokes
WrappingSpan::make_wrapped to wrap an AST node in a span.