diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-09-15 12:29:42 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-09-15 13:05:00 +0200 |
| commit | c18321a4c24b1bae9b935e3434aa114f930ca5f5 (patch) | |
| tree | e6b0aa69c6c7a2855ca498d7c7e8aabe0347297c /src/syntax | |
| parent | 87e776fcebd40cb9628124c19e7e9190b1bd24a5 (diff) | |
Bugfix and tidying
Diffstat (limited to 'src/syntax')
| -rw-r--r-- | src/syntax/ident.rs | 13 | ||||
| -rw-r--r-- | src/syntax/token.rs | 3 |
2 files changed, 13 insertions, 3 deletions
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<str> for Ident { } } +impl Borrow<str> 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", |
