From c18321a4c24b1bae9b935e3434aa114f930ca5f5 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Wed, 15 Sep 2021 12:29:42 +0200 Subject: Bugfix and tidying --- src/syntax/ident.rs | 13 +++++++++++++ src/syntax/token.rs | 3 --- 2 files changed, 13 insertions(+), 3 deletions(-) (limited to 'src/syntax') diff --git a/src/syntax/ident.rs b/src/syntax/ident.rs index c47e6fb1..398e2ff9 100644 --- a/src/syntax/ident.rs +++ b/src/syntax/ident.rs @@ -1,3 +1,4 @@ +use std::borrow::Borrow; use std::ops::Deref; use unicode_xid::UnicodeXID; @@ -53,6 +54,18 @@ impl AsRef for Ident { } } +impl Borrow for Ident { + fn borrow(&self) -> &str { + self + } +} + +impl From<&Ident> for EcoString { + fn from(ident: &Ident) -> Self { + ident.string.clone() + } +} + /// Whether a string is a valid identifier. pub fn is_ident(string: &str) -> bool { let mut chars = string.chars(); diff --git a/src/syntax/token.rs b/src/syntax/token.rs index 219395cf..22dd104b 100644 --- a/src/syntax/token.rs +++ b/src/syntax/token.rs @@ -39,8 +39,6 @@ pub enum Token<'s> { Hyph, /// A slash: `/`. Slash, - /// An exlamation mark. - Excl, /// A single equals sign: `=`. Eq, /// Two equals signs: `==`. @@ -223,7 +221,6 @@ impl<'s> Token<'s> { Self::Plus => "plus", Self::Hyph => "minus", Self::Slash => "slash", - Self::Excl => "exclamation mark", Self::Eq => "assignment operator", Self::EqEq => "equality operator", Self::ExclEq => "inequality operator", -- cgit v1.2.3