Expand description
Error types for mathlex parsing operations.
This module defines comprehensive error types for reporting parsing failures, including precise location information and helpful error messages.
§Error Architecture
Position: A point in source text (line, column, offset)Span: A range in source text (start and end positions)ParseErrorKind: The specific type of parsing errorParseError: Complete error with kind, location, and contextParseResult<T>: Standard Result type for parsing operations
§Example
use mathlex::error::{Position, Span, ParseError, ParseErrorKind};
let pos = Position::new(1, 5, 5);
let error = ParseError::new(
ParseErrorKind::UnexpectedEof {
expected: vec!["number".to_string()],
},
Some(Span::new(pos, pos)),
);
assert_eq!(error.to_string(), "unexpected end of input, expected number at 1:5");Structs§
- Error
Builder - Builder for constructing parse errors ergonomically.
- Parse
Error - A parsing error with location and context information.
- Position
- A position in the source text.
- Span
- A span representing a range in the source text.
Enums§
- Parse
Error Kind - The kind of parsing error that occurred.
Type Aliases§
- Parse
Result - Result type for parsing operations.