mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-31 07:38:02 +00:00
parent
846aac89a7
commit
fa5bb4f615
7 changed files with 80 additions and 90 deletions
|
@ -5,7 +5,7 @@ use std::process;
|
|||
|
||||
use erg_common::config::{ErgConfig, ErgMode::*};
|
||||
use erg_common::spawn::exec_new_thread;
|
||||
use erg_common::traits::Runnable;
|
||||
use erg_common::traits::{ExitStatus, Runnable};
|
||||
|
||||
use erg_parser::build_ast::ASTBuilder;
|
||||
use erg_parser::lex::LexerRunner;
|
||||
|
@ -13,21 +13,16 @@ use erg_parser::ParserRunner;
|
|||
|
||||
fn run() {
|
||||
let cfg = ErgConfig::parse();
|
||||
match cfg.mode {
|
||||
Lex => {
|
||||
LexerRunner::run(cfg);
|
||||
}
|
||||
Parse => {
|
||||
ParserRunner::run(cfg);
|
||||
}
|
||||
Desugar | Execute => {
|
||||
ASTBuilder::run(cfg);
|
||||
}
|
||||
let stat = match cfg.mode {
|
||||
Lex => LexerRunner::run(cfg),
|
||||
Parse => ParserRunner::run(cfg),
|
||||
Desugar | Execute => ASTBuilder::run(cfg),
|
||||
other => {
|
||||
eprintln!("invalid mode: {other}");
|
||||
process::exit(1);
|
||||
ExitStatus::ERR1
|
||||
}
|
||||
}
|
||||
};
|
||||
process::exit(stat.code);
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue