[lexer] Implement Hash::new()
This commit is contained in:
		
							parent
							
								
									aa4de7d4bd
								
							
						
					
					
						commit
						f35fe5fd08
					
				
					 2 changed files with 5 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -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 }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue