1use oak_core::SyntaxKind;
2use serde::{Deserialize, Serialize};
3
4#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
5pub enum WolframSyntaxKind {
6 Whitespace,
8 Newline,
9
10 Identifier,
12 Integer,
13 Real,
14 String,
15
16 If,
18 Then,
19 Else,
20 While,
21 For,
22 Do,
23 Function,
24 Module,
25 Block,
26 With,
27 Table,
28 Map,
29 Apply,
30 Select,
31 Cases,
32 Rule,
33 RuleDelayed,
34 Set,
35 SetDelayed,
36 Unset,
37 Clear,
38 ClearAll,
39 Return,
40 Break,
41 Continue,
42 True,
43 False,
44 Null,
45 Export,
46 Import,
47
48 Plus, Minus, Times, Divide, Power, Equal, NotEqual, Less, Greater, LessEqual, GreaterEqual, And, Or, Not, Assign, AddTo, SubtractFrom, TimesBy, DivideBy, LeftParen, RightParen, LeftBracket, RightBracket, LeftBrace, RightBrace, Comma, Semicolon, Colon, Dot, Arrow, DoubleArrow, Question, Underscore, DoubleUnderscore, TripleUnderscore, Slot, SlotSequence, Comment,
95
96 Text,
98
99 Error,
101
102 Eof,
104}
105
106impl SyntaxKind for WolframSyntaxKind {
107 fn is_trivia(&self) -> bool {
108 matches!(self, WolframSyntaxKind::Whitespace | WolframSyntaxKind::Newline | WolframSyntaxKind::Comment)
109 }
110
111 fn is_comment(&self) -> bool {
112 matches!(self, WolframSyntaxKind::Comment)
113 }
114
115 fn is_whitespace(&self) -> bool {
116 matches!(self, WolframSyntaxKind::Whitespace | WolframSyntaxKind::Newline)
117 }
118
119 fn is_token_type(&self) -> bool {
120 !matches!(self, WolframSyntaxKind::Error | WolframSyntaxKind::Eof)
121 }
122
123 fn is_element_type(&self) -> bool {
124 matches!(self, WolframSyntaxKind::Error | WolframSyntaxKind::Eof)
125 }
126}