[parser] Add ProgramParser in its own module
This commit is contained in:
parent
4fa07ceec7
commit
6aed66d2b5
3 changed files with 26 additions and 19 deletions
|
@ -7,12 +7,14 @@ extern crate sibiltypes;
|
||||||
|
|
||||||
mod list_parser;
|
mod list_parser;
|
||||||
mod node_parser;
|
mod node_parser;
|
||||||
|
mod program_parser;
|
||||||
mod sym_parser;
|
mod sym_parser;
|
||||||
|
|
||||||
use std::iter::Peekable;
|
use std::iter::Peekable;
|
||||||
use sibillexer::Result as LexerResult;
|
use sibillexer::Result as LexerResult;
|
||||||
use sibiltypes::Obj;
|
use sibiltypes::Obj;
|
||||||
use node_parser::NodeParser;
|
use node_parser::{NodeParser, NodeParseResult};
|
||||||
|
use program_parser::ProgramParser;
|
||||||
use sym_parser::SymParser;
|
use sym_parser::SymParser;
|
||||||
|
|
||||||
/// The output of calling `parse()` on a Parser is one of these Result objects.
|
/// The output of calling `parse()` on a Parser is one of these Result objects.
|
||||||
|
|
|
@ -34,21 +34,3 @@ impl NodeParseResult {
|
||||||
pub trait NodeParser: Debug {
|
pub trait NodeParser: Debug {
|
||||||
fn parse(&mut self, lex: Lex) -> NodeParseResult;
|
fn parse(&mut self, lex: Lex) -> NodeParseResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub struct ProgramParser {
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ProgramParser {
|
|
||||||
pub fn new() -> ProgramParser {
|
|
||||||
ProgramParser { }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl NodeParser for ProgramParser {
|
|
||||||
fn parse(&mut self, lex: Lex) -> NodeParseResult {
|
|
||||||
NodeParseResult::Error { msg: "womp".to_string() }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
23
parser/src/program_parser.rs
Normal file
23
parser/src/program_parser.rs
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
/* parser/src/program_parser.rs
|
||||||
|
* Eryn Wells <eryn@erynwells.me>
|
||||||
|
*/
|
||||||
|
|
||||||
|
use std::fmt::Debug;
|
||||||
|
use sibillexer::{Lex, Token};
|
||||||
|
use node_parser::{NodeParser, NodeParseResult};
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct ProgramParser;
|
||||||
|
|
||||||
|
impl ProgramParser {
|
||||||
|
pub fn new() -> ProgramParser {
|
||||||
|
ProgramParser { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl NodeParser for ProgramParser {
|
||||||
|
fn parse(&mut self, lex: Lex) -> NodeParseResult {
|
||||||
|
NodeParseResult::Error { msg: "womp".to_string() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue