[lexer] Implement Hash::new()

This commit is contained in:
Eryn Wells 2018-09-02 13:50:33 -07:00
parent aa4de7d4bd
commit f35fe5fd08
2 changed files with 5 additions and 1 deletions

View file

@ -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 }

View file

@ -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 {