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 digit after `_` in number
18 MissingDigitAfterUnderscore { span: SpanId },
19 /// Missing exponent digits after `e` in number
20 ExpOverflow { span: SpanId },
21 /// Invalid escape sequence in string
22 InvalidEscapeInString { span: SpanId, chr: char },
23 /// Incomplete Unicode escape sequence (`\uXXXX`) in string
24 IncompleteUnicodeEscape { span: SpanId },
25 /// Invalid codepoint in Unicode escape sequence (`\uXXXX` or
26 /// `\uXXXX\uYYYY`) in string
27 InvalidUtf16EscapeSequence {
28 span: SpanId,
29 cu1: u16,
30 cu2: Option<u16>,
31 },
32 /// File ended before ending a string
33 UnfinishedString { span: SpanId },
34 /// Missing line break after `|||`
35 MissingLineBreakAfterTextBlockStart { span: SpanId },
36 /// Missing whitespace at the beginning of the first file of a text block.
37 MissingWhitespaceTextBlockStart { span: SpanId },
38 /// Text block is not ended correctly.
39 InvalidTextBlockTermination { span: SpanId },
40}