1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
use thiserror::Error;
#[derive(Error, Debug)]
pub enum CompilerError {
/// returned when `over` receives an amount that does not parse correctly
#[error("could not parse an amount")]
CouldNotParseAnAmount,
/// returned when a quantifier range (`3 to 5 of ...`) does not
/// parse correctly or when the start of the range is larger then the end
#[error("usage of an invalid quantifier range")]
InvalidQuantifierRange,
/// returned when an expected positional node does not exist
#[error("encountered a missing positional node")]
MissingNode,
/// returned if the root node does not exist
#[error("missing root node")]
MissingRootNode,
/// returned if `not <end>` is encountered
#[error("negative end not allowed")]
NegativeEndNotAllowed,
/// returned if `not <start>` is encountered
#[error("negative start not allowed")]
NegativeStartNotAllowed,
/// returned if the given input cannot be parsed
#[error("{0}")]
ParseError(String),
/// returned if an assertion is quantified
#[error("unexpected assertion in quantifier")]
UnexpectedAssertionInQuantifier,
/// returned if a non capture group (e.g. match) has an identifier
#[error("unexpected identifier for non capture group")]
UnexpectedIdentifierForNonCaptureGroup,
/// returned if a quantfier is nested
#[error("unexpected quantifier in quantifier")]
UnexpectedQuantifierInQuantifier,
/// (unreachable) returned if a skipped node (currently only EOF) is quantified
#[error("unexpected skipped node in quantifier")]
UnexpectedSkippedNodeInQuantifier,
/// returned if a special symbol (`<start>` or `<end>`) is quantified
#[error("unexpected special symbol in quantifier")]
UnexpectedSpecialSymbolInQuantifier,
/// returned if a variable invocation is quantified
#[error("unexpected variable invocation in quantifier")]
UnexpectedVariableInvocationInQuantifier,
/// returned if a variable invocation is not preceeded by a declaration
#[error("usage of an uninitialized variable")]
UninitializedVariable,
/// (unreachable) returned if an assertion is not of a recognized kind
#[error("usage of an unrecognized assertion")]
UnrecognizedAssertion,
/// (unreachable) returned if a group is not of a recognized kind
#[error("usage of an unrecognized group")]
UnrecognizedGroup,
/// (unreachable) returned if any parsed syntax is not recognized
#[error("usage of unrecognized syntax")]
UnrecognizedSyntax,
/// returned if any parsed symbol is not recognized
#[error("usage of an unrecognized symbol")]
UnrecognizedSymbol,
/// returned if any parsed symbol namespace is not recognized
#[error("usage of an unrecognized symbol namespace")]
UnrecognizedSymbolNamespace,
/// returned if any parsed unicode category
#[error("usage of an unrecognized unicode category")]
UnrecognizedUnicodeCategory,
}