From f35fe5fd08e4e49e954c9b868d6e83adff83b016 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Sun, 2 Sep 2018 13:50:33 -0700 Subject: [PATCH] [lexer] Implement Hash::new() --- lexer/src/states/begin.rs | 2 +- lexer/src/states/hash.rs | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lexer/src/states/begin.rs b/lexer/src/states/begin.rs index 432ba9a..cea8aa5 100644 --- a/lexer/src/states/begin.rs +++ b/lexer/src/states/begin.rs @@ -19,7 +19,7 @@ impl State for Begin { // TODO: Figure out some way to track newlines. c if c.is_whitespace() => StateResult::Continue, c if c.is_identifier_initial() => StateResult::Advance { to: Box::new(IdSub{}) }, - c if c.is_hash() => StateResult::Advance { to: Box::new(Hash{}) }, + c if c.is_hash() => StateResult::Advance { to: Box::new(Hash::new()) }, _ => { let msg = format!("Invalid character: {}", c); StateResult::Fail { msg } diff --git a/lexer/src/states/hash.rs b/lexer/src/states/hash.rs index 53eb0b3..2ff45c3 100644 --- a/lexer/src/states/hash.rs +++ b/lexer/src/states/hash.rs @@ -16,6 +16,10 @@ const FALSE: &'static str = "false"; #[derive(Debug)] pub struct Hash; #[derive(Debug)] pub struct BoolSub(String); +impl Hash { + pub fn new() { Hash{} } +} + impl State for Hash { fn lex(&mut self, c: char) -> StateResult { match c {