oak_ada/kind/
mod.rs

1use oak_core::SyntaxKind;
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, serde::Serialize)]
4#[repr(u16)]
5pub enum AdaSyntaxKind {
6    // Trivia
7    Whitespace,
8    Newline,
9    Comment,
10
11    // Literals
12    StringLiteral,
13    CharacterLiteral,
14    NumberLiteral,
15
16    // Identifiers
17    Identifier,
18
19    // Keywords
20    AbortKeyword,
21    AbsKeyword,
22    AbstractKeyword,
23    AcceptKeyword,
24    AccessKeyword,
25    AliasedKeyword,
26    AllKeyword,
27    AndKeyword,
28    ArrayKeyword,
29    AtKeyword,
30    BeginKeyword,
31    BodyKeyword,
32    CaseKeyword,
33    ConstantKeyword,
34    DeclareKeyword,
35    DelayKeyword,
36    DeltaKeyword,
37    DigitsKeyword,
38    DoKeyword,
39    ElseKeyword,
40    ElsifKeyword,
41    EndKeyword,
42    EntryKeyword,
43    ExceptionKeyword,
44    ExitKeyword,
45    ForKeyword,
46    FunctionKeyword,
47    GenericKeyword,
48    GotoKeyword,
49    IfKeyword,
50    InKeyword,
51    InterfaceKeyword,
52    IsKeyword,
53    LimitedKeyword,
54    LoopKeyword,
55    ModKeyword,
56    NewKeyword,
57    NotKeyword,
58    NullKeyword,
59    OfKeyword,
60    OrKeyword,
61    OthersKeyword,
62    OutKeyword,
63    OverridingKeyword,
64    PackageKeyword,
65    PragmaKeyword,
66    PrivateKeyword,
67    ProcedureKeyword,
68    ProtectedKeyword,
69    RaiseKeyword,
70    RangeKeyword,
71    RecordKeyword,
72    RemKeyword,
73    RenamesKeyword,
74    RequeueKeyword,
75    ReturnKeyword,
76    ReverseKeyword,
77    SelectKeyword,
78    SeparateKeyword,
79    SubtypeKeyword,
80    SynchronizedKeyword,
81    TaggedKeyword,
82    TaskKeyword,
83    TerminateKeyword,
84    ThenKeyword,
85    TypeKeyword,
86    UntilKeyword,
87    UseKeyword,
88    WhenKeyword,
89    WhileKeyword,
90    WithKeyword,
91    XorKeyword,
92
93    // Operators
94    Plus,
95    Minus,
96    Multiply,
97    Divide,
98    Star,
99    Slash,
100    Power,
101    DoubleStar,
102    Equal,
103    NotEqual,
104    Less,
105    LessEqual,
106    Greater,
107    GreaterEqual,
108    Assignment,
109    ColonEqual,
110    Arrow,
111    LeftShift,
112    RightShift,
113    Box,
114    Ampersand,
115    Pipe,
116
117    // Delimiters
118    LeftParen,
119    RightParen,
120    LeftBracket,
121    RightBracket,
122    LeftBrace,
123    RightBrace,
124    Comma,
125    Semicolon,
126    Colon,
127    Dot,
128    DotDot,
129
130    // Composite nodes
131    SourceFile,
132
133    // Error handling
134    Error,
135    Eof,
136}
137
138impl SyntaxKind for AdaSyntaxKind {
139    fn is_trivia(&self) -> bool {
140        matches!(self, Self::Whitespace | Self::Newline | Self::Comment)
141    }
142
143    fn is_comment(&self) -> bool {
144        matches!(self, Self::Comment)
145    }
146
147    fn is_whitespace(&self) -> bool {
148        matches!(self, Self::Whitespace | Self::Newline)
149    }
150
151    fn is_token_type(&self) -> bool {
152        !matches!(self, Self::SourceFile)
153    }
154
155    fn is_element_type(&self) -> bool {
156        matches!(self, Self::SourceFile)
157    }
158}
159
160pub type AdaToken = oak_core::Token<AdaSyntaxKind>;