Skip to content

Commit

Permalink
Improve LexerErrorKind and Loc documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
osa1 committed Nov 17, 2023
1 parent 56e6f6e commit b9691fe
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions crates/lexgen_util/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,23 @@ pub struct LexerError<E> {

#[derive(Debug, Clone, PartialEq, Eq)]
pub enum LexerErrorKind<E> {
/// Lexer error, raised by lexgen-generated code
/// A lexer error, returned by lexgen.
InvalidToken,

/// Custom error, raised by a semantic action
/// A custom error, returned by a semantic action.
Custom(E),
}

/// A location, used in errors
/// A location in an input.
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
pub struct Loc {
/// Zero-based line number in the input.
pub line: u32,

/// Zero-based character index of this location in its line.
pub col: u32,

/// Zero-based UTF-8 byte index of this location in the input.
pub byte_idx: usize,
}

Expand Down

0 comments on commit b9691fe

Please sign in to comment.