oak_scheme/kind/
mod.rs

1use oak_core::SyntaxKind;
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
4pub enum SchemeSyntaxKind {
5    // 空白字符和换行
6    Whitespace,
7    Newline,
8    Comment,
9
10    // 注释
11    LineComment,
12
13    // 字面量
14    NumberLiteral,
15    StringLiteral,
16    CharacterLiteral,
17    BooleanLiteral,
18
19    // 标识符和符号
20    Identifier,
21    Symbol,
22
23    // 关键字
24    Keyword,
25    Define,
26    Lambda,
27    If,
28    Cond,
29    Case,
30    Let,
31    LetStar,
32    Letrec,
33    Begin,
34    Do,
35    Quote,
36    Quasiquote,
37    Unquote,
38    UnquoteSplicing,
39    And,
40    Or,
41    Not,
42    Set,
43
44    // 分隔符
45    LeftParen,
46    RightParen,
47    LeftBracket,
48    RightBracket,
49    LeftBrace,
50    RightBrace,
51    Dot,
52
53    // 特殊符号
54    Hash,
55    Quote_,
56    Quasiquote_,
57    Unquote_,
58    UnquoteSplicing_,
59
60    // 错误和结束
61    Error,
62    Eof,
63}
64
65impl SyntaxKind for SchemeSyntaxKind {
66    fn is_trivia(&self) -> bool {
67        matches!(self, Self::Whitespace | Self::Newline | Self::LineComment)
68    }
69
70    fn is_comment(&self) -> bool {
71        matches!(self, Self::LineComment)
72    }
73
74    fn is_whitespace(&self) -> bool {
75        matches!(self, Self::Whitespace | Self::Newline)
76    }
77
78    fn is_token_type(&self) -> bool {
79        !matches!(self, Self::Error | Self::Eof)
80    }
81
82    fn is_element_type(&self) -> bool {
83        false
84    }
85}