Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert-M-Lucas committed Aug 2, 2024
1 parent ec10c9f commit a072c6e
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 109 deletions.
133 changes: 41 additions & 92 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 5 additions & 14 deletions src/root.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
use crate::root::parser::parse::parse;
// use crate::root::assembler::assemble::generate_assembly;
// use crate::root::name_resolver::processor::process;
use crate::root::compiler::compile::compile;
use crate::root::errors::WErr;
use crate::root::name_resolver::resolve::resolve;
Expand All @@ -19,17 +17,6 @@ use std::time::Instant;
#[cfg(debug_assertions)]
pub const DEBUG_ON_ERROR: bool = false;

// #[cfg(target_os = "windows")]
// use crate::root::runner::run;
// #[cfg(target_os = "windows")]
// use runner::link;
//
// #[cfg(target_os = "linux")]
// use crate::root::runner::run_wine_experimental;
// #[cfg(target_os = "linux")]
// use runner::link_gcc_experimental;
// use crate::root::parser::parse::parse;

pub mod assembler;
pub mod builtin;
pub mod compiler;
Expand Down Expand Up @@ -108,13 +95,13 @@ pub fn main_args(args: Args) -> Result<(), WErr> {
let t = Instant::now();
link_gcc(&args.output).unwrap();
let end = t.elapsed();
// TODO: Don't unwrap
let size = File::open(format!("{}.out", args.output))
.unwrap()
.metadata()
.unwrap()
.len()
.to_formatted_string(&Locale::en);

cprintln!("<g,bold>Completed [{:?}] - {} bytes</>", end, size);

if args.build {
Expand All @@ -141,6 +128,10 @@ pub fn main_args(args: Args) -> Result<(), WErr> {
run(&args.output);
}
}
#[cfg(not(target_os = "linux"))]
{
println!("Not linking / executing as OS is not Linux");
}

cprintln!("<g,bold>Done!</>");
Ok(())
Expand Down
4 changes: 2 additions & 2 deletions src/root/name_resolver/resolve_names.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::collections::HashMap;

use b_box::b;
use crate::root::errors::evaluable_errors::EvalErrs;
use crate::root::errors::name_resolver_errors::NRErrs;
use crate::root::errors::WErr;
Expand Down Expand Up @@ -187,7 +187,7 @@ pub fn resolve_names(
}

for (id, user_type) in final_types {
global_table.add_user_type(id, Box::new(user_type));
global_table.add_user_type(id, b!(user_type));
}

// (final_types, type_names, unprocessed_functions)
Expand Down
2 changes: 1 addition & 1 deletion src/root/parser/parse_function/parse_evaluable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ pub fn parse_evaluable<'a, 'b>(

Ok((
remaining,
TempOperation::Prefix(operator.clone(), Box::new(operand)),
TempOperation::Prefix(operator.clone(), b!(operand)),
))
}

Expand Down

0 comments on commit a072c6e

Please sign in to comment.