mirror of
https://codeberg.org/icewind/php-literal-parser.git
synced 2026-06-03 18:44:07 +02:00
clonable errors
This commit is contained in:
parent
8c8b1a6904
commit
ba0b66e1bb
2 changed files with 4 additions and 4 deletions
|
|
@ -28,7 +28,7 @@ use thiserror::Error;
|
||||||
/// 6 |
|
/// 6 |
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct ParseError {
|
pub struct ParseError {
|
||||||
span: Option<Span>,
|
span: Option<Span>,
|
||||||
error: RawParseError,
|
error: RawParseError,
|
||||||
|
|
@ -148,7 +148,7 @@ fn get_position(text: &str, index: usize) -> Position {
|
||||||
pos
|
pos
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Error, Debug)]
|
#[derive(Error, Debug, Clone)]
|
||||||
pub enum RawParseError {
|
pub enum RawParseError {
|
||||||
#[error("{0}")]
|
#[error("{0}")]
|
||||||
UnexpectedToken(#[from] UnexpectedTokenError),
|
UnexpectedToken(#[from] UnexpectedTokenError),
|
||||||
|
|
@ -183,7 +183,7 @@ impl From<UnescapeError> for RawParseError {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct UnexpectedTokenError {
|
pub struct UnexpectedTokenError {
|
||||||
pub expected: Vec<Token>,
|
pub expected: Vec<Token>,
|
||||||
pub found: Option<Token>,
|
pub found: Option<Token>,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error, Clone)]
|
||||||
pub enum ParseIntError {
|
pub enum ParseIntError {
|
||||||
#[error("cannot parse integer from empty string")]
|
#[error("cannot parse integer from empty string")]
|
||||||
Empty,
|
Empty,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue