Skip to main content

ErrorHandler

Trait ErrorHandler 

Source
pub trait ErrorHandler<ET: EngineTypes> {
Show 15 methods // Required method fn new() -> Self; // Provided methods fn invalid_character( &self, _out: &ET::Outputs, _memory: &MemoryManager<ET::Token>, _state: &ET::State, _c: ET::Char, ) -> Result<Option<StringLineSource<ET::Char>>, ()> { ... } fn wrong_definition( &self, _out: &ET::Outputs, _memory: &MemoryManager<ET::Token>, _state: &ET::State, _found: &ET::Token, _expected: &ET::Token, _in_macro: &ET::Token, ) -> Result<Option<StringLineSource<ET::Char>>, ()> { ... } fn file_end_while_use( &self, _out: &ET::Outputs, _memory: &MemoryManager<ET::Token>, _state: &ET::State, _in_macro: &ET::Token, ) -> Result<Option<StringLineSource<ET::Char>>, ()> { ... } fn too_many_closebraces( &self, _out: &ET::Outputs, _memory: &MemoryManager<ET::Token>, _state: &ET::State, ) -> Result<Option<StringLineSource<ET::Char>>, ()> { ... } fn missing_begingroup( &self, _out: &ET::Outputs, _memory: &MemoryManager<ET::Token>, _state: &ET::State, ) -> Result<Option<StringLineSource<ET::Char>>, ()> { ... } fn missing_dollar( &self, _out: &ET::Outputs, _memory: &MemoryManager<ET::Token>, _state: &ET::State, ) -> Result<Option<StringLineSource<ET::Char>>, ()> { ... } fn missing_endgroup( &self, _out: &ET::Outputs, _memory: &MemoryManager<ET::Token>, _state: &ET::State, ) -> Result<Option<StringLineSource<ET::Char>>, ()> { ... } fn incomplete_conditional( &self, _out: &ET::Outputs, _memory: &MemoryManager<ET::Token>, _state: &ET::State, _name: PrimitiveIdentifier, _line_no: usize, ) -> Result<Option<StringLineSource<ET::Char>>, ()> { ... } fn undefined( &self, _out: &ET::Outputs, _memory: &MemoryManager<ET::Token>, _state: &ET::State, _token: &ET::Token, ) -> Result<Option<StringLineSource<ET::Char>>, ()> { ... } fn paragraph_ended( &self, _out: &ET::Outputs, _memory: &MemoryManager<ET::Token>, _state: &ET::State, _token: &ET::Token, ) -> Result<Option<StringLineSource<ET::Char>>, ()> { ... } fn not_allowed_in_mode( &self, _out: &ET::Outputs, _memory: &MemoryManager<ET::Token>, _state: &ET::State, _name: PrimitiveIdentifier, _mode: TeXMode, ) -> Result<Option<StringLineSource<ET::Char>>, ()> { ... } fn missing_keyword( &self, _out: &ET::Outputs, _memory: &MemoryManager<ET::Token>, _state: &ET::State, _kws: &'static [&'static str], ) -> Result<Option<StringLineSource<ET::Char>>, ()> { ... } fn missing_number( &self, _out: &ET::Outputs, _memory: &MemoryManager<ET::Token>, _state: &ET::State, ) -> Result<Option<StringLineSource<ET::Char>>, ()> { ... } fn other( &self, _out: &ET::Outputs, _memory: &MemoryManager<ET::Token>, _state: &ET::State, _msg: &str, ) -> Result<Option<StringLineSource<ET::Char>>, ()> { ... }
}
Expand description

Trait for error recovery, to be implemented for an engine.

Required Methods§

Source

fn new() -> Self

Provided Methods§

Source

fn invalid_character( &self, _out: &ET::Outputs, _memory: &MemoryManager<ET::Token>, _state: &ET::State, _c: ET::Char, ) -> Result<Option<StringLineSource<ET::Char>>, ()>

“Text line contains an invalid character”.

§Errors

because that’s what it’s supposed to do

Source

fn wrong_definition( &self, _out: &ET::Outputs, _memory: &MemoryManager<ET::Token>, _state: &ET::State, _found: &ET::Token, _expected: &ET::Token, _in_macro: &ET::Token, ) -> Result<Option<StringLineSource<ET::Char>>, ()>

“Use of \foo doesn’t match its definition”.

§Errors

because that’s what it’s supposed to do

Source

fn file_end_while_use( &self, _out: &ET::Outputs, _memory: &MemoryManager<ET::Token>, _state: &ET::State, _in_macro: &ET::Token, ) -> Result<Option<StringLineSource<ET::Char>>, ()>

“File ended while scanning use of \foo”.

§Errors

because that’s what it’s supposed to do

Source

fn too_many_closebraces( &self, _out: &ET::Outputs, _memory: &MemoryManager<ET::Token>, _state: &ET::State, ) -> Result<Option<StringLineSource<ET::Char>>, ()>

“Too many }’s”.

§Errors

because that’s what it’s supposed to do

Source

fn missing_begingroup( &self, _out: &ET::Outputs, _memory: &MemoryManager<ET::Token>, _state: &ET::State, ) -> Result<Option<StringLineSource<ET::Char>>, ()>

“Missing { inserted”.

§Errors

because that’s what it’s supposed to do

Source

fn missing_dollar( &self, _out: &ET::Outputs, _memory: &MemoryManager<ET::Token>, _state: &ET::State, ) -> Result<Option<StringLineSource<ET::Char>>, ()>

“Missing $ inserted”.

§Errors

because that’s what it’s supposed to do

Source

fn missing_endgroup( &self, _out: &ET::Outputs, _memory: &MemoryManager<ET::Token>, _state: &ET::State, ) -> Result<Option<StringLineSource<ET::Char>>, ()>

“Missing } inserted”.

§Errors

because that’s what it’s supposed to do

Source

fn incomplete_conditional( &self, _out: &ET::Outputs, _memory: &MemoryManager<ET::Token>, _state: &ET::State, _name: PrimitiveIdentifier, _line_no: usize, ) -> Result<Option<StringLineSource<ET::Char>>, ()>

“Incomplete \if…; all text was ignored after line n”.

§Errors

because that’s what it’s supposed to do

Source

fn undefined( &self, _out: &ET::Outputs, _memory: &MemoryManager<ET::Token>, _state: &ET::State, _token: &ET::Token, ) -> Result<Option<StringLineSource<ET::Char>>, ()>

“Undefined [control sequence|active character]

§Errors

because that’s what it’s supposed to do

Source

fn paragraph_ended( &self, _out: &ET::Outputs, _memory: &MemoryManager<ET::Token>, _state: &ET::State, _token: &ET::Token, ) -> Result<Option<StringLineSource<ET::Char>>, ()>

“Runaway argument? Paragraph ended before \foo was complete.”

§Errors

because that’s what it’s supposed to do

Source

fn not_allowed_in_mode( &self, _out: &ET::Outputs, _memory: &MemoryManager<ET::Token>, _state: &ET::State, _name: PrimitiveIdentifier, _mode: TeXMode, ) -> Result<Option<StringLineSource<ET::Char>>, ()>

“You can’t use \foo in M mode.”

§Errors

because that’s what it’s supposed to do

Source

fn missing_keyword( &self, _out: &ET::Outputs, _memory: &MemoryManager<ET::Token>, _state: &ET::State, _kws: &'static [&'static str], ) -> Result<Option<StringLineSource<ET::Char>>, ()>

“Missing x inserted”

§Errors

because that’s what it’s supposed to do

Source

fn missing_number( &self, _out: &ET::Outputs, _memory: &MemoryManager<ET::Token>, _state: &ET::State, ) -> Result<Option<StringLineSource<ET::Char>>, ()>

“Missing number, treated as zero.”

§Errors

because that’s what it’s supposed to do

Source

fn other( &self, _out: &ET::Outputs, _memory: &MemoryManager<ET::Token>, _state: &ET::State, _msg: &str, ) -> Result<Option<StringLineSource<ET::Char>>, ()>

Any other possibly recoverable error.

§Errors

because that’s what it’s supposed to do

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§