feat:(els): ELS parser can be customized

This commit is contained in:
Shunsuke Shibayama 2023-05-28 23:45:53 +09:00
parent 74103e5a1a
commit 9a6af2cd07
16 changed files with 68 additions and 27 deletions

View file

@ -96,6 +96,20 @@ macro_rules! expect_pop {
};
}
pub trait Parsable {
fn parse(code: String) -> Result<Module, ParseErrors>;
}
pub struct SimpleParser {}
impl Parsable for SimpleParser {
fn parse(code: String) -> Result<Module, ParseErrors> {
let ts = Lexer::from_str(code).lex()?;
let mut parser = Parser::new(ts);
parser.parse()
}
}
enum ExprOrOp {
Expr(Expr),
Op(Token),