1use oak_core::SyntaxKind;
2use serde::Serialize;
3
4#[derive(Copy, Clone, Debug, PartialEq, Eq, Serialize)]
5pub enum PrologSyntaxKind {
6 Whitespace,
8 Newline,
9 Comment,
10
11 Atom,
13 Integer,
14 Float,
15 String,
16 Variable,
17
18 Unify, NotUnify, Equal, NotEqual, ArithEqual, ArithNotEqual, Less, Greater, LessEqual, GreaterEqual, Is, Plus, Minus, Multiply, Divide, IntDivide, Modulo, Power, BitwiseAnd, BitwiseOr, BitwiseXor, BitwiseNot, LeftShift, RightShift, LeftParen, RightParen, LeftBracket, RightBracket, LeftBrace, RightBrace, Comma, Dot, Pipe, Semicolon, Cut, Question, Colon, ColonMinus, QuestionMinus, Functor,
63 Clause,
64 Rule,
65 Fact,
66 Query,
67 Directive,
68 List,
69 Structure,
70
71 Root,
73 Error,
74 Eof,
75}
76
77impl SyntaxKind for PrologSyntaxKind {
78 fn is_trivia(&self) -> bool {
79 matches!(self, Self::Whitespace | Self::Newline | Self::Comment)
80 }
81
82 fn is_comment(&self) -> bool {
83 matches!(self, Self::Comment)
84 }
85
86 fn is_whitespace(&self) -> bool {
87 matches!(self, Self::Whitespace | Self::Newline)
88 }
89
90 fn is_token_type(&self) -> bool {
91 !matches!(
92 self,
93 Self::Root | Self::Clause | Self::Rule | Self::Fact | Self::Query | Self::Directive | Self::List | Self::Structure
94 )
95 }
96
97 fn is_element_type(&self) -> bool {
98 matches!(
99 self,
100 Self::Root | Self::Clause | Self::Rule | Self::Fact | Self::Query | Self::Directive | Self::List | Self::Structure
101 )
102 }
103}