Add `ExitStatus`
Fix REPL tests
This commit is contained in:
Shunsuke Shibayama 2023-01-25 00:11:48 +09:00
parent 846aac89a7
commit fa5bb4f615
7 changed files with 80 additions and 90 deletions

View file

@ -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() {