Skip to main content

DebugInfo

Struct DebugInfo 

Source
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>

Source

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.

Source

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.

A railroad diagram of the grammar for JSON

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<'src, T> IntoMaybe<'src, T> for T
where T: 'src,

Source§

type Proj<U: 'src> = U

Source§

fn map_maybe<R>( self, _f: impl FnOnce(&'src T) -> &'src R, g: impl FnOnce(T) -> R, ) -> <T as IntoMaybe<'src, T>>::Proj<R>
where R: 'src,

Source§

impl<T, S> SpanWrap<S> for T
where S: WrappingSpan<T>,

Source§

fn with_span(self, span: S) -> S::Spanned

Invokes WrappingSpan::make_wrapped to wrap an AST node in a span.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.