aboutsummaryrefslogtreecommitdiff
path: root/src/tree.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tree.rs')
-rw-r--r--src/tree.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/tree.rs b/src/tree.rs
new file mode 100644
index 000000000..0924f38d0
--- /dev/null
+++ b/src/tree.rs
@@ -0,0 +1,31 @@
1use text::{TextUnit};
2use syntax_kinds::syntax_info;
3
4use std::fmt;
5
6#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
7pub struct SyntaxKind(pub(crate) u32);
8
9impl SyntaxKind {
10 fn info(self) -> &'static SyntaxInfo {
11 syntax_info(self)
12 }
13}
14
15impl fmt::Debug for SyntaxKind {
16 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
17 let name = self.info().name;
18 f.write_str(name)
19 }
20}
21
22
23pub(crate) struct SyntaxInfo {
24 pub name: &'static str,
25}
26
27#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
28pub struct Token {
29 pub kind: SyntaxKind,
30 pub len: TextUnit,
31} \ No newline at end of file