1use oak_core::SyntaxKind;
2use serde::Serialize;
3
4#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize)]
5pub enum PurescriptSyntaxKind {
6 Whitespace,
8 Newline,
9 Comment,
10
11 Ado,
13 Case,
14 Class,
15 Data,
16 Derive,
17 Do,
18 Else,
19 False,
20 Forall,
21 Foreign,
22 If,
23 Import,
24 In,
25 Infix,
26 Infixl,
27 Infixr,
28 Instance,
29 Let,
30 Module,
31 Newtype,
32 Of,
33 Then,
34 True,
35 Type,
36 Where,
37
38 Arrow, FatArrow, Backslash, Pipe, Equal, ColonColon, Dot, DotDot, Plus, Minus, Star, Slash, Percent, Caret, EqualEqual, NotEqual, Less, Greater, LessEqual, GreaterEqual, And, Or, Append, Compose, ComposeFlipped, Apply, ApplyFlipped, Bind, BindFlipped, LeftParen, RightParen, LeftBrace, RightBrace, LeftBracket, RightBracket, Comma, Semicolon, Colon, Question, Exclamation, At, Underscore, Backtick, IntLiteral,
87 NumberLiteral,
88 StringLiteral,
89 CharLiteral,
90 BooleanLiteral,
91
92 Identifier,
94 UpperIdentifier,
95 Operator,
96 QualifiedIdentifier,
97
98 Root,
100 Error,
101 Eof,
102}
103
104impl SyntaxKind for PurescriptSyntaxKind {
105 fn is_trivia(&self) -> bool {
106 matches!(self, Self::Whitespace | Self::Newline | Self::Comment)
107 }
108
109 fn is_comment(&self) -> bool {
110 matches!(self, Self::Comment)
111 }
112
113 fn is_whitespace(&self) -> bool {
114 matches!(self, Self::Whitespace | Self::Newline)
115 }
116
117 fn is_token_type(&self) -> bool {
118 !matches!(self, Self::Root)
119 }
120
121 fn is_element_type(&self) -> bool {
122 matches!(self, Self::Root)
123 }
124}