1#![allow(non_camel_case_types)]
2
3use oak_core::SyntaxKind;
4
5#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
6#[repr(u16)]
7pub enum CssSyntaxKind {
8 Whitespace = 0,
10 Newline,
11 Comment,
12
13 StringLiteral,
15 NumberLiteral,
16 ColorLiteral,
17 UrlLiteral,
18
19 Identifier,
21 ClassName,
22 IdSelector,
23 TagName,
24 PseudoClass,
25 PseudoElement,
26 AttributeName,
27 PropertyName,
28 FunctionName,
29
30 Important,
32 Inherit,
33 Initial,
34 Unset,
35 Auto,
36 None,
37 Normal,
38
39 Px,
41 Em,
42 Rem,
43 Percent,
44 Vh,
45 Vw,
46 Pt,
47 Cm,
48 Mm,
49 In,
50 Pc,
51 Ex,
52 Ch,
53 Vmin,
54 Vmax,
55
56 Colon, Semicolon, Comma, Dot, Hash, Plus, Minus, Star, Slash, Equals, Tilde, Pipe, Caret, Dollar, GreaterThan, LeftParen, RightParen, LeftBrace, RightBrace, LeftBracket, RightBracket, AtRule,
83 AtImport,
84 AtMedia,
85 AtKeyframes,
86 AtFontFace,
87 AtCharset,
88 AtNamespace,
89 AtSupports,
90 AtPage,
91 AtDocument,
92
93 MediaQuery,
95 Selector,
96 Declaration,
97 Value,
98 Function,
99 Url,
100 CalcExpression,
101
102 SourceFile,
104 Error,
105 Eof,
106}
107
108impl SyntaxKind for CssSyntaxKind {
109 fn is_trivia(&self) -> bool {
110 matches!(self, Self::Whitespace | Self::Newline | Self::Comment)
111 }
112
113 fn is_comment(&self) -> bool {
114 matches!(self, Self::Comment)
115 }
116
117 fn is_whitespace(&self) -> bool {
118 matches!(self, Self::Whitespace | Self::Newline)
119 }
120
121 fn is_token_type(&self) -> bool {
122 !matches!(
123 self,
124 Self::SourceFile
125 | Self::MediaQuery
126 | Self::Selector
127 | Self::Declaration
128 | Self::Value
129 | Self::Function
130 | Self::Url
131 | Self::CalcExpression
132 )
133 }
134
135 fn is_element_type(&self) -> bool {
136 matches!(
137 self,
138 Self::SourceFile
139 | Self::MediaQuery
140 | Self::Selector
141 | Self::Declaration
142 | Self::Value
143 | Self::Function
144 | Self::Url
145 | Self::CalcExpression
146 )
147 }
148}