rsjsonnet_lang/lexer/
error.rs

1use crate::span::SpanId;
2
3#[derive(Clone, Debug, PartialEq, Eq)]
4pub enum LexError {
5    /// Invalid character that does not represent any Jsonnet token
6    InvalidChar { span: SpanId, chr: char },
7    /// Invalid UTF-8 sequence outside a string or comment
8    InvalidUtf8 { span: SpanId, seq: Vec<u8> },
9    /// End-of-file reached before finding closing `*/`
10    UnfinishedMultilineComment { span: SpanId },
11    /// Leading zero in number
12    LeadingZeroInNumber { span: SpanId },
13    /// Missing fractional digits after `.` in number
14    MissingFracDigits { span: SpanId },
15    /// Missing exponent digits after `e` in number
16    MissingExpDigits { span: SpanId },
17    /// Missing exponent digits after `e` in number
18    ExpOverflow { span: SpanId },
19    /// Invalid escape sequence in string
20    InvalidEscapeInString { span: SpanId, chr: char },
21    /// Incomplete Unicode escape sequence (`\uXXXX`) in string
22    IncompleteUnicodeEscape { span: SpanId },
23    /// Invalid codepoint in Unicode escape sequence (`\uXXXX` or
24    /// `\uXXXX\uYYYY`) in string
25    InvalidUtf16EscapeSequence {
26        span: SpanId,
27        cu1: u16,
28        cu2: Option<u16>,
29    },
30    /// File ended before ending a string
31    UnfinishedString { span: SpanId },
32    /// Missing line break after `|||`
33    MissingLineBreakAfterTextBlockStart { span: SpanId },
34    /// Missing whitespace at the beginning of the first file of a text block.
35    MissingWhitespaceTextBlockStart { span: SpanId },
36    /// Text block is not ended correctly.
37    InvalidTextBlockTermination { span: SpanId },
38}