1use oak_core::SyntaxKind;
2use serde::{Deserialize, Serialize};
3
4#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
5pub enum NginxSyntaxKind {
6 Root,
8 Directive,
9 Block,
10 Parameter,
11 Value,
12 Comment,
13
14 ServerKeyword, LocationKeyword, UpstreamKeyword, HttpKeyword, EventsKeyword, ListenKeyword, ServerNameKeyword, RootKeyword, IndexKeyword, ProxyPassKeyword, LeftBrace, RightBrace, Semicolon, Identifier,
33 String,
34 Number,
35 Path,
36 Url,
37
38 Whitespace,
40 Newline,
41 CommentToken,
42 Eof,
43 Error,
44}
45
46impl SyntaxKind for NginxSyntaxKind {
47 fn is_trivia(&self) -> bool {
48 matches!(self, Self::Whitespace | Self::Newline | Self::CommentToken)
49 }
50
51 fn is_comment(&self) -> bool {
52 matches!(self, Self::CommentToken)
53 }
54
55 fn is_whitespace(&self) -> bool {
56 matches!(self, Self::Whitespace | Self::Newline)
57 }
58
59 fn is_token_type(&self) -> bool {
60 !matches!(self, Self::Root | Self::Directive | Self::Block | Self::Parameter | Self::Value | Self::Comment)
61 }
62
63 fn is_element_type(&self) -> bool {
64 matches!(self, Self::Root | Self::Directive | Self::Block | Self::Parameter | Self::Value | Self::Comment)
65 }
66}