pub struct DebuggerContext { /* private fields */ }
Expand description

Debugger for pest grammars.

Implementations§

source§

impl DebuggerContext

source

pub fn load_grammar( &mut self, path: impl AsRef<Path> ) -> Result<(), DebuggerError>

Loads a grammar from a file.

source

pub fn load_grammar_direct( &mut self, grammar_name: &str, grammar: &str ) -> Result<(), DebuggerError>

Loads a grammar from a string.

source

pub fn load_input( &mut self, path: impl AsRef<Path> ) -> Result<(), DebuggerError>

Loads a parsing input from a file.

source

pub fn load_input_direct(&mut self, input: String)

Loads a parsing input from a string.

source

pub fn add_all_rules_breakpoints(&mut self) -> Result<(), DebuggerError>

Adds all grammar rules as breakpoints. This is useful for stepping through the entire parsing process. It returns an error if the grammar hasn’t been loaded yet.

source

pub fn add_breakpoint(&mut self, rule: String)

Adds a rule to breakpoints.

source

pub fn delete_breakpoint(&mut self, rule: &str)

Removes a rule from breakpoints.

source

pub fn delete_all_breakpoints(&mut self)

Removes all breakpoints.

source

pub fn list_breakpoints(&self) -> Vec<String>

Returns a list of all breakpoints.

source

pub fn run( &mut self, rule: &str, sender: Sender<DebuggerEvent> ) -> Result<(), DebuggerError>

Starts a debugger session: runs a rule on an input and stops at breakpoints. When the debugger is stopped, an event is sent to the channel using sender. The debugger can be resumed by calling cont. This naturally returns errors if the grammar or input haven’t been loaded yet etc.

source

pub fn cont(&self) -> Result<(), DebuggerError>

Continue the debugger session from the breakpoint. It returns an error if the session finished or wasn’t started yet.

source

pub fn get_position(&self, pos: usize) -> Result<Position<'_>, DebuggerError>

Returns a Position from the loaded input.

Trait Implementations§

source§

impl Default for DebuggerContext

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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, U> TryFrom<U> for T
where U: Into<T>,

§

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

§

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.