1use oak_core::SyntaxKind;
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
5pub enum GraphQLSyntaxKind {
6 StringLiteral,
8 IntLiteral,
9 FloatLiteral,
10 BooleanLiteral,
11 NullLiteral,
12
13 Name,
15
16 QueryKeyword,
18 MutationKeyword,
19 SubscriptionKeyword,
20 FragmentKeyword,
21 OnKeyword,
22 TypeKeyword,
23 InterfaceKeyword,
24 UnionKeyword,
25 ScalarKeyword,
26 EnumKeyword,
27 InputKeyword,
28 ExtendKeyword,
29 SchemaKeyword,
30 DirectiveKeyword,
31 ImplementsKeyword,
32 RepeatsKeyword,
33
34 Spread, LeftParen, RightParen, LeftBracket, RightBracket, LeftBrace, RightBrace, Comma, Colon, Semicolon, Pipe, Ampersand, Equals, Exclamation, At, Dollar, Whitespace,
56 Comment,
57
58 Newline,
60 Eof,
61 Error,
62}
63
64impl SyntaxKind for GraphQLSyntaxKind {
65 fn is_trivia(&self) -> bool {
66 matches!(self, Self::Whitespace | Self::Comment | Self::Newline)
67 }
68
69 fn is_comment(&self) -> bool {
70 matches!(self, Self::Comment)
71 }
72
73 fn is_whitespace(&self) -> bool {
74 matches!(self, Self::Whitespace | Self::Newline)
75 }
76
77 fn is_token_type(&self) -> bool {
78 !matches!(self, Self::Eof | Self::Error)
79 }
80
81 fn is_element_type(&self) -> bool {
82 matches!(self, Self::Eof | Self::Error)
83 }
84}