litcheck_filecheck/parse/lexer/
error.rs1use litcheck::diagnostics::{Diagnostic, SourceSpan};
2
3#[derive(Debug, Diagnostic, thiserror::Error, Clone)]
4pub enum LexerError {
5 #[error("invalid CHECK-COUNT")]
6 #[diagnostic()]
7 BadCount {
8 #[label("the count value for this directive was invalid: {error}")]
9 span: SourceSpan,
10 #[source]
11 error: core::num::ParseIntError,
12 },
13 #[error("invalid number")]
14 #[diagnostic()]
15 InvalidNumber {
16 #[label("this numeric value could not be parsed: {error}")]
17 span: SourceSpan,
18 #[source]
19 error: core::num::ParseIntError,
20 },
21 #[error("invalid identifier")]
22 #[diagnostic()]
23 InvalidIdentifier {
24 #[label("this identifier has characters outside the allowed alphabet")]
25 span: SourceSpan,
26 },
27 #[error("unexpected character '{unexpected}'")]
28 #[diagnostic()]
29 UnexpectedCharacter {
30 #[label("'{unexpected}' is not valid here")]
31 span: SourceSpan,
32 unexpected: char,
33 },
34}