Make compilation controllable
This commit is contained in:
parent
aac3ca40fe
commit
1d8102b9fa
@ -28,7 +28,7 @@ fn main() {
|
|||||||
run_repl();
|
run_repl();
|
||||||
},
|
},
|
||||||
[_, ref filename, ..] => {
|
[_, ref filename, ..] => {
|
||||||
run_noninteractive(filename);
|
run_noninteractive(filename, !option_matches.opt_present("i"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -39,7 +39,7 @@ fn program_options() -> getopts::Options {
|
|||||||
options
|
options
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run_noninteractive(filename: &String) {
|
fn run_noninteractive(filename: &str, compile: bool) {
|
||||||
let mut source_file = File::open(&Path::new(filename)).unwrap();
|
let mut source_file = File::open(&Path::new(filename)).unwrap();
|
||||||
let mut buffer = String::new();
|
let mut buffer = String::new();
|
||||||
source_file.read_to_string(&mut buffer).unwrap();
|
source_file.read_to_string(&mut buffer).unwrap();
|
||||||
@ -54,8 +54,6 @@ fn run_noninteractive(filename: &String) {
|
|||||||
Err(err) => { println!("Parse error: {:?}", err); return; }
|
Err(err) => { println!("Parse error: {:?}", err); return; }
|
||||||
};
|
};
|
||||||
|
|
||||||
let compile = true;
|
|
||||||
|
|
||||||
if compile {
|
if compile {
|
||||||
compilation_sequence(ast, filename);
|
compilation_sequence(ast, filename);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user