[parser] Expand ParseError; add a ProgramParser to start things off
This commit is contained in:
parent
6aed66d2b5
commit
80bf4b7bf1
1 changed files with 6 additions and 2 deletions
|
@ -21,7 +21,10 @@ use sym_parser::SymParser;
|
||||||
pub type Result = std::result::Result<Obj, ParseError>;
|
pub type Result = std::result::Result<Obj, ParseError>;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct ParseError;
|
pub enum ParseError {
|
||||||
|
LexerError{msg: String},
|
||||||
|
ParserError{msg: String}
|
||||||
|
}
|
||||||
|
|
||||||
pub struct Parser<T> where T: Iterator<Item=LexerResult> {
|
pub struct Parser<T> where T: Iterator<Item=LexerResult> {
|
||||||
input: Peekable<T>,
|
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> {
|
impl<T> Parser<T> where T: Iterator<Item=LexerResult> {
|
||||||
pub fn new(input: T) -> Parser<T> {
|
pub fn new(input: T) -> Parser<T> {
|
||||||
|
let program_parser = Box::new(ProgramParser::new());
|
||||||
Parser {
|
Parser {
|
||||||
input: input.peekable(),
|
input: input.peekable(),
|
||||||
parsers: Vec::new(),
|
parsers: vec!(program_parser)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue