pub struct ParseError {
pub message: String,
pub range: Range,
pub expected: Vec<String>,
pub found: String,
pub recovery_hint: Option<String>,
}Expand description
Error information with recovery context for comprehensive Perl parsing error handling.
This structure encapsulates all information needed for intelligent error recovery in the Perl parser, enabling continued parsing after syntax errors and providing detailed diagnostic information for IDE integration.
Fields§
§message: StringHuman-readable error message describing the parsing issue
range: RangeSource code range where the error occurred
expected: Vec<String>List of token types that were expected at this position
found: StringThe token that was actually found instead of expected
recovery_hint: Option<String>Optional hint for error recovery or fixing the issue
Implementations§
Source§impl ParseError
impl ParseError
Sourcepub fn new(message: String, range: Range) -> ParseError
pub fn new(message: String, range: Range) -> ParseError
Create a new parse error
Sourcepub fn with_expected(self, expected: Vec<String>) -> ParseError
pub fn with_expected(self, expected: Vec<String>) -> ParseError
Add expected tokens
Sourcepub fn with_found(self, found: String) -> ParseError
pub fn with_found(self, found: String) -> ParseError
Add found token
Sourcepub fn with_hint(self, hint: String) -> ParseError
pub fn with_hint(self, hint: String) -> ParseError
Add recovery hint
Trait Implementations§
Source§impl Clone for ParseError
impl Clone for ParseError
Source§fn clone(&self) -> ParseError
fn clone(&self) -> ParseError
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ParseError
impl RefUnwindSafe for ParseError
impl Send for ParseError
impl Sync for ParseError
impl Unpin for ParseError
impl UnsafeUnpin for ParseError
impl UnwindSafe for ParseError
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