mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-04 02:39:20 +00:00
feat:(els): ELS parser can be customized
This commit is contained in:
parent
74103e5a1a
commit
9a6af2cd07
16 changed files with 68 additions and 27 deletions
|
@ -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),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue