From 663ae3a9f141b6864c93771faeb1c9554e6b94df Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Mon, 3 Sep 2018 15:48:48 -0700 Subject: [PATCH] [lexer] move char::is_hash() to chars::Lexable --- lexer/src/chars.rs | 5 +++++ lexer/src/states/begin.rs | 8 -------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/lexer/src/chars.rs b/lexer/src/chars.rs index 6ef0375..f1507b1 100644 --- a/lexer/src/chars.rs +++ b/lexer/src/chars.rs @@ -11,6 +11,7 @@ pub trait Lexable { fn is_exactness(&self) -> bool; fn is_radix(&self) -> bool; + fn is_hash(&self) -> bool; } impl Lexable for char { @@ -42,6 +43,10 @@ impl Lexable for char { let radishes = &['b', 'd', 'o', 'x']; radishes.contains(self) } + + fn is_hash(&self) -> bool { + *self == '#' + } } trait LexableSpecial { diff --git a/lexer/src/states/begin.rs b/lexer/src/states/begin.rs index b4d9732..670b0dc 100644 --- a/lexer/src/states/begin.rs +++ b/lexer/src/states/begin.rs @@ -29,11 +29,3 @@ impl State for Begin { Ok(None) } } - -trait BeginLexable { - fn is_hash(&self) -> bool; -} - -impl BeginLexable for char { - fn is_hash(&self) -> bool { *self == '#' } -}