diff options
author | Aleksey Kladov <[email protected]> | 2019-02-11 16:28:39 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-02-11 18:02:19 +0000 |
commit | 58897dd8ddfd08ef494b7bc05ac15f5b1e3a4e1a (patch) | |
tree | fdd3ffbdca1ee8a9711d4080931e71f13d72e154 /crates/ra_tt | |
parent | b356ab46f2b7482bf1ae0c0f6cd5a87ece8742bf (diff) |
assign ids to tokens
Diffstat (limited to 'crates/ra_tt')
-rw-r--r-- | crates/ra_tt/src/lib.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/crates/ra_tt/src/lib.rs b/crates/ra_tt/src/lib.rs index df31f72f3..e0a4cdb8b 100644 --- a/crates/ra_tt/src/lib.rs +++ b/crates/ra_tt/src/lib.rs | |||
@@ -18,6 +18,15 @@ use std::fmt; | |||
18 | 18 | ||
19 | use smol_str::SmolStr; | 19 | use smol_str::SmolStr; |
20 | 20 | ||
21 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] | ||
22 | pub struct TokenId(pub u32); | ||
23 | |||
24 | impl TokenId { | ||
25 | pub const fn unspecified() -> TokenId { | ||
26 | TokenId(!0) | ||
27 | } | ||
28 | } | ||
29 | |||
21 | #[derive(Debug, Clone)] | 30 | #[derive(Debug, Clone)] |
22 | pub enum TokenTree { | 31 | pub enum TokenTree { |
23 | Leaf(Leaf), | 32 | Leaf(Leaf), |
@@ -67,6 +76,7 @@ pub enum Spacing { | |||
67 | #[derive(Debug, Clone)] | 76 | #[derive(Debug, Clone)] |
68 | pub struct Ident { | 77 | pub struct Ident { |
69 | pub text: SmolStr, | 78 | pub text: SmolStr, |
79 | pub id: TokenId, | ||
70 | } | 80 | } |
71 | 81 | ||
72 | impl fmt::Display for TokenTree { | 82 | impl fmt::Display for TokenTree { |