[parser] Skeleton IdParser and ListParser for Ids and Lists respectively
This commit is contained in:
parent
281c29ee26
commit
cabe40bd7a
2 changed files with 40 additions and 8 deletions
|
@ -5,17 +5,18 @@
|
||||||
extern crate sibillexer;
|
extern crate sibillexer;
|
||||||
extern crate sibiltypes;
|
extern crate sibiltypes;
|
||||||
|
|
||||||
|
mod node_parser;
|
||||||
|
|
||||||
use std::iter::Peekable;
|
use std::iter::Peekable;
|
||||||
use sibillexer::Result as LexerResult;
|
use sibillexer::Result as LexerResult;
|
||||||
|
use sibillexer::Token;
|
||||||
use sibiltypes::Object;
|
use sibiltypes::Object;
|
||||||
|
use node_parser::{NodeParser, IdParser, ListParser};
|
||||||
#[derive(Debug)]
|
|
||||||
pub struct ParseError;
|
|
||||||
|
|
||||||
pub type Result = std::result::Result<Object, ParseError>;
|
pub type Result = std::result::Result<Object, ParseError>;
|
||||||
|
|
||||||
trait NodeParser {
|
#[derive(Debug)]
|
||||||
}
|
pub struct ParseError;
|
||||||
|
|
||||||
pub struct Parser<T> where T: Iterator<Item=LexerResult> {
|
pub struct Parser<T> where T: Iterator<Item=LexerResult> {
|
||||||
input: Peekable<T>,
|
input: Peekable<T>,
|
||||||
|
@ -37,9 +38,10 @@ impl<T> Iterator for Parser<T> where T: Iterator<Item=LexerResult> {
|
||||||
fn next(&mut self) -> Option<Self::Item> {
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
loop {
|
loop {
|
||||||
if let Some(lex) = self.input.next() {
|
if let Some(lex) = self.input.next() {
|
||||||
println!("{:?}", lex)
|
if let Ok(lex) = lex {
|
||||||
|
} else {
|
||||||
}
|
}
|
||||||
else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
30
parser/src/node_parser.rs
Normal file
30
parser/src/node_parser.rs
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
/* node_parser.rs
|
||||||
|
* Eryn Wells <eryn@erynwells.me>
|
||||||
|
*/
|
||||||
|
|
||||||
|
pub trait NodeParser {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct IdParser {
|
||||||
|
}
|
||||||
|
|
||||||
|
impl IdParser {
|
||||||
|
pub fn new() -> IdParser {
|
||||||
|
IdParser { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl NodeParser for IdParser {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct ListParser {
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ListParser {
|
||||||
|
pub fn new() -> ListParser {
|
||||||
|
ListParser { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl NodeParser for ListParser {
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue