[parser] Expand ParseError; add a ProgramParser to start things off

This commit is contained in:
Eryn Wells 2018-08-23 20:21:59 -07:00
parent 6aed66d2b5
commit 80bf4b7bf1

View file

@ -21,7 +21,10 @@ use sym_parser::SymParser;
pub type Result = std::result::Result<Obj, ParseError>;
#[derive(Debug)]
pub struct ParseError;
pub enum ParseError {
LexerError{msg: String},
ParserError{msg: String}
}
pub struct Parser<T> where T: Iterator<Item=LexerResult> {
input: Peekable<T>,
@ -30,9 +33,10 @@ pub struct Parser<T> where T: Iterator<Item=LexerResult> {
impl<T> Parser<T> where T: Iterator<Item=LexerResult> {
pub fn new(input: T) -> Parser<T> {
let program_parser = Box::new(ProgramParser::new());
Parser {
input: input.peekable(),
parsers: Vec::new(),
parsers: vec!(program_parser)
}
}
}