From 58897dd8ddfd08ef494b7bc05ac15f5b1e3a4e1a Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 11 Feb 2019 19:28:39 +0300 Subject: assign ids to tokens --- crates/ra_tt/src/lib.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'crates/ra_tt') 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; use smol_str::SmolStr; +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] +pub struct TokenId(pub u32); + +impl TokenId { + pub const fn unspecified() -> TokenId { + TokenId(!0) + } +} + #[derive(Debug, Clone)] pub enum TokenTree { Leaf(Leaf), @@ -67,6 +76,7 @@ pub enum Spacing { #[derive(Debug, Clone)] pub struct Ident { pub text: SmolStr, + pub id: TokenId, } impl fmt::Display for TokenTree { -- cgit v1.2.3