#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u16)]
pub enum SyntaxKind {
Error = 0,
LeftParen,
RightParen,
LeftBracket,
RightBracket,
LeftBrace,
RightBrace,
Dot,
Comma,
Plus,
Percent,
Minus,
Semicolon,
Not,
NotEqual,
Equal,
EqualEqual,
Greater,
GreaterEqual,
Less,
QuestionMark,
LessEqual,
Slash,
Colon,
Star,
And,
Or,
RawString,
String,
Bytes,
RawBytes,
Ident,
Int,
Uint,
Double,
As,
Break,
Const,
Else,
For,
Function,
If,
Import,
Let,
Loop,
Null,
In,
True,
False,
Var,
Package,
Namespace,
Void,
While,
Dyn,
Root,
Expr,
BinaryOp,
UnaryOp,
Call,
FieldAccess,
Index,
List,
Map,
Ternary,
}
impl SyntaxKind {
pub const fn from_raw(raw: u16) -> Self {
match raw {
1 => Self::LeftParen,
2 => Self::RightParen,
3 => Self::LeftBracket,
4 => Self::RightBracket,
5 => Self::LeftBrace,
6 => Self::RightBrace,
7 => Self::Dot,
8 => Self::Comma,
9 => Self::Plus,
10 => Self::Percent,
11 => Self::Minus,
12 => Self::Semicolon,
13 => Self::Not,
14 => Self::NotEqual,
15 => Self::Equal,
16 => Self::EqualEqual,
17 => Self::Greater,
18 => Self::GreaterEqual,
19 => Self::Less,
20 => Self::QuestionMark,
21 => Self::LessEqual,
22 => Self::Slash,
23 => Self::Colon,
24 => Self::Star,
25 => Self::And,
26 => Self::Or,
27 => Self::RawString,
28 => Self::String,
29 => Self::Bytes,
30 => Self::RawBytes,
31 => Self::Ident,
32 => Self::Int,
33 => Self::Uint,
34 => Self::Double,
35 => Self::As,
36 => Self::Break,
37 => Self::Const,
38 => Self::Else,
39 => Self::For,
40 => Self::Function,
41 => Self::If,
42 => Self::Import,
43 => Self::Let,
44 => Self::Loop,
45 => Self::Null,
46 => Self::In,
47 => Self::True,
48 => Self::False,
49 => Self::Var,
50 => Self::Package,
51 => Self::Namespace,
52 => Self::Void,
53 => Self::While,
54 => Self::Dyn,
55 => Self::Root,
56 => Self::Expr,
57 => Self::BinaryOp,
58 => Self::UnaryOp,
59 => Self::Call,
60 => Self::FieldAccess,
61 => Self::Index,
62 => Self::List,
63 => Self::Map,
64 => Self::Ternary,
_ => Self::Error,
}
}
}
impl From<SyntaxKind> for rowan::SyntaxKind {
fn from(kind: SyntaxKind) -> Self {
rowan::SyntaxKind(kind as u16)
}
}