cleanup in parser example

This commit is contained in:
damirka 2022-02-22 12:31:57 +03:00
parent 239f06b3af
commit ec1ac99f6f

View File

@ -19,7 +19,7 @@ use leo_span::symbol::create_session_if_not_set_then;
use std::{env, fs, path::Path};
fn to_leo_tree(input_filepath: &Path) -> Result<String, String> {
fn to_input_tree(input_filepath: &Path) -> Result<String, String> {
// Loads the inputs a string from the given file path.
let input_string = fs::read_to_string(&input_filepath.to_path_buf()).expect("failed to open an input file");
@ -44,7 +44,7 @@ fn main() -> Result<(), String> {
if cli_arguments.len() < 2 || cli_arguments.len() > 3 {
eprintln!("Warning - an invalid number of command-line arguments were provided.");
println!(
"\nCommand-line usage:\n\n\tleo_ast {{PATH/TO/INPUT_FILENAME}}.in {{PATH/TO/STATE_FILENAME}}.in {{PATH/TO/OUTPUT_DIRECTORY (optional)}}\n"
"\nCommand-line usage:\n\n\tleo_ast {{PATH/TO/INPUT_FILENAME}}.in {{PATH/TO/OUTPUT_DIRECTORY (optional)}}\n"
);
return Ok(()); // Exit innocently
}
@ -53,7 +53,7 @@ fn main() -> Result<(), String> {
let input_filepath = Path::new(&cli_arguments[1]);
// Construct the serialized syntax tree.
let serialized_leo_tree = to_leo_tree(input_filepath)?;
let serialized_leo_tree = to_input_tree(input_filepath)?;
println!("{}", serialized_leo_tree);
// Determine the output directory.