Strip down the parser (again...)
This commit is contained in:
		
							parent
							
								
									0133bbed19
								
							
						
					
					
						commit
						d783e561da
					
				
					 2 changed files with 2 additions and 19 deletions
				
			
		| 
						 | 
				
			
			@ -5,18 +5,14 @@
 | 
			
		|||
extern crate sibillexer;
 | 
			
		||||
extern crate sibiltypes;
 | 
			
		||||
 | 
			
		||||
mod list;
 | 
			
		||||
mod program;
 | 
			
		||||
 | 
			
		||||
use sibillexer::Lexer;
 | 
			
		||||
use sibiltypes::Object;
 | 
			
		||||
 | 
			
		||||
struct ParseError { }
 | 
			
		||||
 | 
			
		||||
type Result<T> = std::result::Result<T, ParseError>;
 | 
			
		||||
 | 
			
		||||
trait Parsable: Sized {
 | 
			
		||||
    fn parse(lexer: &Lexer) -> Result<Self>;
 | 
			
		||||
}
 | 
			
		||||
type Result = std::result::Result<Object, ParseError>;
 | 
			
		||||
 | 
			
		||||
#[cfg(test)]
 | 
			
		||||
mod tests {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,18 +4,5 @@
 | 
			
		|||
 | 
			
		||||
use sibillexer::Lexer;
 | 
			
		||||
use super::Result;
 | 
			
		||||
use super::Parsable;
 | 
			
		||||
use super::ParseError;
 | 
			
		||||
use list::SExpression;
 | 
			
		||||
 | 
			
		||||
struct Program {
 | 
			
		||||
    commands: Vec<SExpression>,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl Parsable for Program {
 | 
			
		||||
    fn parse(lexer: &Lexer) -> Result<Program> {
 | 
			
		||||
        let mut commands: Vec<SExpression> = Vec::new();
 | 
			
		||||
        // TODO: Actually parse commands.
 | 
			
		||||
        Ok(Program { commands: commands })
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue