cairo_lang_parser/
recovery.rs

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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/// Macro that produces an inline function that gets a token kind and returns true iff it is in one
/// of the supplied groups.
macro_rules! is_of_kind {
    ($($element:ident),*) => {
        |kind: SyntaxKind| {
            match kind{
                $($crate::recovery::$element!() => true,)*
                SyntaxKind::TerminalEndOfFile => true,
                _ => false
            }
        }
    };
}
pub(crate) use is_of_kind;

macro_rules! match_arrow {
    () => {
        SyntaxKind::TerminalMatchArrow
    };
}
pub(crate) use match_arrow;

macro_rules! lbrace {
    () => {
        SyntaxKind::TerminalLBrace
    };
}
pub(crate) use lbrace;

macro_rules! rbrace {
    () => {
        SyntaxKind::TerminalRBrace
    };
}
pub(crate) use rbrace;

macro_rules! rparen {
    () => {
        SyntaxKind::TerminalRParen
    };
}
pub(crate) use rparen;

macro_rules! rbrack {
    () => {
        SyntaxKind::TerminalRBrack
    };
}
pub(crate) use rbrack;

macro_rules! rangle {
    () => {
        SyntaxKind::TerminalGT
    };
}
pub(crate) use rangle;

macro_rules! or {
    () => {
        SyntaxKind::TerminalOr
    };
}
pub(crate) use or;

macro_rules! comma {
    () => {
        SyntaxKind::TerminalComma
    };
}
pub(crate) use comma;

macro_rules! semicolon {
    () => {
        SyntaxKind::TerminalSemicolon
    };
}
pub(crate) use semicolon;

macro_rules! eq {
    () => {
        SyntaxKind::TerminalEq
    };
}
pub(crate) use eq;

macro_rules! module_item_kw {
    () => {
        SyntaxKind::TerminalConst
            | SyntaxKind::TerminalEnum
            | SyntaxKind::TerminalExtern
            | SyntaxKind::TerminalFunction
            | SyntaxKind::TerminalImpl
            | SyntaxKind::TerminalModule
            | SyntaxKind::TerminalStruct
            | SyntaxKind::TerminalTrait
            | SyntaxKind::TerminalType
            | SyntaxKind::TerminalUse
    };
}
pub(crate) use module_item_kw;

macro_rules! block {
    () => {
        SyntaxKind::TerminalLet | SyntaxKind::TerminalMatch | SyntaxKind::TerminalReturn
    };
}
pub(crate) use block;