1use oak_core::{SyntaxKind, Token};
2use serde::{Deserialize, Serialize};
3
4pub type PowerShellToken = Token<PowerShellSyntaxKind>;
5
6#[derive(Copy, Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
7pub enum PowerShellSyntaxKind {
8 Whitespace,
10 Newline,
11 Comment,
12
13 Begin,
15 Break,
16 Catch,
17 Class,
18 Continue,
19 Data,
20 Define,
21 Do,
22 DynamicParam,
23 Else,
24 ElseIf,
25 End,
26 Exit,
27 Filter,
28 Finally,
29 For,
30 ForEach,
31 From,
32 Function,
33 If,
34 In,
35 Param,
36 Process,
37 Return,
38 Switch,
39 Throw,
40 Trap,
41 Try,
42 Until,
43 Using,
44 Var,
45 While,
46 Workflow,
47
48 Plus,
50 Minus,
51 Multiply,
52 Divide,
53 Modulo,
54 Equal,
55 NotEqual,
56 GreaterThan,
57 LessThan,
58 GreaterEqual,
59 LessEqual,
60 Like,
61 NotLike,
62 Match,
63 NotMatch,
64 Contains,
65 NotContains,
66 NotIn,
67 Replace,
68 Split,
69 Join,
70 Is,
71 IsNot,
72 As,
73 And,
74 Or,
75 Xor,
76 Not,
77 Band,
78 Bor,
79 Bxor,
80 Bnot,
81 Shl,
82 Shr,
83
84 LeftParen,
86 RightParen,
87 LeftBrace,
88 RightBrace,
89 LeftBracket,
90 RightBracket,
91 Semicolon,
92 Comma,
93 Dot,
94 DotDot,
95 Colon,
96 DoubleColon,
97 Pipe,
98 Ampersand,
99 At,
100 Dollar,
101 Question,
102 Exclamation,
103 Backtick,
104 SingleQuote,
105 DoubleQuote,
106
107 StringLiteral,
109 NumberLiteral,
110 BooleanLiteral,
111 NullLiteral,
112 ArrayLiteral,
113 HashLiteral,
114
115 Identifier,
117 Variable,
118 AutomaticVariable,
119 PreferenceVariable,
120
121 Root,
123 Error,
124 Eof,
125}
126
127impl SyntaxKind for PowerShellSyntaxKind {
128 fn is_trivia(&self) -> bool {
129 matches!(self, Self::Whitespace | Self::Newline | Self::Comment)
130 }
131
132 fn is_comment(&self) -> bool {
133 matches!(self, Self::Comment)
134 }
135
136 fn is_whitespace(&self) -> bool {
137 matches!(self, Self::Whitespace | Self::Newline)
138 }
139
140 fn is_token_type(&self) -> bool {
141 !matches!(self, Self::Root)
142 }
143
144 fn is_element_type(&self) -> bool {
145 matches!(self, Self::Root)
146 }
147}