Skip to content

Commit 05a4c4f

Browse files
committed
refactor(parser): refactor number parsing to support generic number types
1 parent 0940bb1 commit 05a4c4f

File tree

2 files changed

+207
-87
lines changed

2 files changed

+207
-87
lines changed

Diff for: src/error.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ pub struct KdlDiagnostic {
7878
pub kind: KdlErrorKind,
7979
}
8080

81-
/// A type reprenting additional information specific to the type of error being returned.
81+
/// A type representing additional information specific to the type of error being returned.
8282
#[derive(Debug, Diagnostic, Clone, Eq, PartialEq, Error)]
8383
pub enum KdlErrorKind {
8484
/// An error occurred while parsing an integer.
@@ -91,6 +91,11 @@ pub enum KdlErrorKind {
9191
#[diagnostic(code(kdl::parse_float))]
9292
ParseFloatError(ParseFloatError),
9393

94+
/// Tried to parse a negative number as an unsigned integer.
95+
#[error("Tried to parse a negative number as an unsigned integer.")]
96+
#[diagnostic(code(kdl::negative_unsigned))]
97+
NegativeUnsignedError,
98+
9499
/// Generic parsing error. The given context string denotes the component
95100
/// that failed to parse.
96101
#[error("Expected {0}.")]

0 commit comments

Comments
 (0)