Skip to content

Commit

Permalink
Cargo fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert-M-Lucas committed Jun 19, 2024
1 parent 0bf5de0 commit 5c1b9ec
Show file tree
Hide file tree
Showing 45 changed files with 49 additions and 222 deletions.
18 changes: 14 additions & 4 deletions .idea/workspace.xml

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

3 changes: 0 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
use std::mem::MaybeUninit;
use std::hint::black_box;
use std::mem;

mod root;

Expand Down
4 changes: 1 addition & 3 deletions src/root/builtin/functions/exit.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
use unique_type_id::UniqueTypeId;
use crate::root::builtin::{BuiltinInlineFunction, f_id, InlineFunctionGenerator};
use crate::root::builtin::types::int::IntType;
use crate::root::errors::WErr;
use crate::root::name_resolver::name_resolvers::NameResult::Function;
use crate::root::name_resolver::resolve_function_signatures::FunctionSignature;

use crate::root::shared::common::{FunctionID, Indirection, LocalAddress, TypeID, TypeRef};
use crate::root::shared::common::{FunctionID, LocalAddress, TypeID};

#[derive(UniqueTypeId)]
#[UniqueTypeIdType = "u16"]
Expand Down
1 change: 0 additions & 1 deletion src/root/builtin/functions/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
mod exit;

use b_box::b;
use crate::root::builtin::functions::exit::ExitFunction;
use crate::root::name_resolver::name_resolvers::GlobalDefinitionTable;

Expand Down
2 changes: 0 additions & 2 deletions src/root/builtin/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ use crate::root::builtin::functions::register_functions;
use crate::root::builtin::types::bool::register_bool;
use crate::root::builtin::types::int::register_int;
use crate::root::compiler::global_tracker::GlobalTracker;
use crate::root::errors::WErr;
use crate::root::name_resolver::name_resolvers::{GlobalDefinitionTable};
use crate::root::name_resolver::resolve_function_signatures::FunctionSignature;
use crate::root::shared::common::{ByteSize, FunctionID, LocalAddress, TypeID};
use crate::root::shared::types::Type;

pub fn register_builtin(global_table: &mut GlobalDefinitionTable) {
register_functions(global_table);
Expand Down
5 changes: 1 addition & 4 deletions src/root/builtin/types/bool/printb.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
use unique_type_id::UniqueTypeId;
use crate::root::builtin::{BuiltinInlineFunction, f_id, InlineFunctionGenerator};
use crate::root::builtin::types::bool::BoolType;
use crate::root::builtin::types::int::IntType;
use crate::root::errors::WErr;
use crate::root::name_resolver::name_resolvers::NameResult::Function;
use crate::root::name_resolver::resolve_function_signatures::FunctionSignature;

use crate::root::shared::common::{FunctionID, Indirection, LocalAddress, TypeID, TypeRef};
use crate::root::shared::common::{FunctionID, LocalAddress, TypeID};

#[derive(UniqueTypeId)]
#[UniqueTypeIdType = "u16"]
Expand Down
4 changes: 1 addition & 3 deletions src/root/builtin/types/int/add.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
use unique_type_id::UniqueTypeId;
use crate::root::builtin::{BuiltinInlineFunction, InlineFunctionGenerator, f_id};
use crate::root::builtin::types::int::IntType;
use crate::root::errors::WErr;
use crate::root::name_resolver::name_resolvers::NameResult::Function;
use crate::root::name_resolver::resolve_function_signatures::FunctionSignature;

use crate::root::shared::common::{FunctionID, Indirection, LocalAddress, TypeID, TypeRef};
use crate::root::shared::common::{FunctionID, LocalAddress, TypeID};

#[derive(UniqueTypeId)]
#[UniqueTypeIdType = "u16"]
Expand Down
4 changes: 1 addition & 3 deletions src/root/builtin/types/int/div.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
use unique_type_id::UniqueTypeId;
use crate::root::builtin::{BuiltinInlineFunction, InlineFunctionGenerator, f_id};
use crate::root::builtin::types::int::IntType;
use crate::root::errors::WErr;
use crate::root::name_resolver::name_resolvers::NameResult::Function;
use crate::root::name_resolver::resolve_function_signatures::FunctionSignature;

use crate::root::shared::common::{FunctionID, Indirection, LocalAddress, TypeID, TypeRef};
use crate::root::shared::common::{FunctionID, LocalAddress, TypeID};

#[derive(UniqueTypeId)]
#[UniqueTypeIdType = "u16"]
Expand Down
5 changes: 1 addition & 4 deletions src/root/builtin/types/int/eq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@ use unique_type_id::UniqueTypeId;
use crate::root::builtin::{BuiltinInlineFunction, InlineFunctionGenerator, f_id};
use crate::root::builtin::types::bool::BoolType;
use crate::root::builtin::types::int::IntType;
use crate::root::builtin::types::int::printi::PrintI;
use crate::root::errors::WErr;
use crate::root::name_resolver::name_resolvers::NameResult::Function;
use crate::root::name_resolver::resolve_function_signatures::FunctionSignature;

use crate::root::shared::common::{FunctionID, Indirection, LocalAddress, TypeID, TypeRef};
use crate::root::shared::common::{FunctionID, LocalAddress, TypeID};

#[derive(UniqueTypeId)]
#[UniqueTypeIdType = "u16"]
Expand Down
4 changes: 1 addition & 3 deletions src/root/builtin/types/int/modulo.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
use unique_type_id::UniqueTypeId;
use crate::root::builtin::{BuiltinInlineFunction, InlineFunctionGenerator, f_id};
use crate::root::builtin::types::int::IntType;
use crate::root::errors::WErr;
use crate::root::name_resolver::name_resolvers::NameResult::Function;
use crate::root::name_resolver::resolve_function_signatures::FunctionSignature;

use crate::root::shared::common::{FunctionID, Indirection, LocalAddress, TypeID, TypeRef};
use crate::root::shared::common::{FunctionID, LocalAddress, TypeID};

#[derive(UniqueTypeId)]
#[UniqueTypeIdType = "u16"]
Expand Down
4 changes: 1 addition & 3 deletions src/root/builtin/types/int/mul.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
use unique_type_id::UniqueTypeId;
use crate::root::builtin::{BuiltinInlineFunction, InlineFunctionGenerator, f_id};
use crate::root::builtin::types::int::IntType;
use crate::root::errors::WErr;
use crate::root::name_resolver::name_resolvers::NameResult::Function;
use crate::root::name_resolver::resolve_function_signatures::FunctionSignature;

use crate::root::shared::common::{FunctionID, Indirection, LocalAddress, TypeID, TypeRef};
use crate::root::shared::common::{FunctionID, LocalAddress, TypeID};

#[derive(UniqueTypeId)]
#[UniqueTypeIdType = "u16"]
Expand Down
4 changes: 1 addition & 3 deletions src/root/builtin/types/int/p_add.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
use unique_type_id::UniqueTypeId;
use crate::root::builtin::{BuiltinInlineFunction, f_id, InlineFunctionGenerator};
use crate::root::builtin::types::int::IntType;
use crate::root::errors::WErr;
use crate::root::name_resolver::name_resolvers::NameResult::Function;
use crate::root::name_resolver::resolve_function_signatures::FunctionSignature;

use crate::root::shared::common::{FunctionID, Indirection, LocalAddress, TypeID, TypeRef};
use crate::root::shared::common::{FunctionID, LocalAddress, TypeID};

#[derive(UniqueTypeId)]
#[UniqueTypeIdType = "u16"]
Expand Down
4 changes: 1 addition & 3 deletions src/root/builtin/types/int/p_sub.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
use unique_type_id::UniqueTypeId;
use crate::root::builtin::{BuiltinInlineFunction, f_id, InlineFunctionGenerator};
use crate::root::builtin::types::int::IntType;
use crate::root::errors::WErr;
use crate::root::name_resolver::name_resolvers::NameResult::Function;
use crate::root::name_resolver::resolve_function_signatures::FunctionSignature;

use crate::root::shared::common::{FunctionID, Indirection, LocalAddress, TypeID, TypeRef};
use crate::root::shared::common::{FunctionID, LocalAddress, TypeID};

#[derive(UniqueTypeId)]
#[UniqueTypeIdType = "u16"]
Expand Down
4 changes: 1 addition & 3 deletions src/root/builtin/types/int/printi.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
use unique_type_id::UniqueTypeId;
use crate::root::builtin::{BuiltinInlineFunction, f_id, InlineFunctionGenerator};
use crate::root::builtin::types::int::IntType;
use crate::root::errors::WErr;
use crate::root::name_resolver::name_resolvers::NameResult::Function;
use crate::root::name_resolver::resolve_function_signatures::FunctionSignature;

use crate::root::shared::common::{FunctionID, Indirection, LocalAddress, TypeID, TypeRef};
use crate::root::shared::common::{FunctionID, LocalAddress, TypeID};

#[derive(UniqueTypeId)]
#[UniqueTypeIdType = "u16"]
Expand Down
4 changes: 1 addition & 3 deletions src/root/builtin/types/int/sub.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
use unique_type_id::UniqueTypeId;
use crate::root::builtin::{BuiltinInlineFunction, InlineFunctionGenerator, f_id};
use crate::root::builtin::types::int::IntType;
use crate::root::errors::WErr;
use crate::root::name_resolver::name_resolvers::NameResult::Function;
use crate::root::name_resolver::resolve_function_signatures::FunctionSignature;

use crate::root::shared::common::{FunctionID, Indirection, LocalAddress, TypeID, TypeRef};
use crate::root::shared::common::{FunctionID, LocalAddress, TypeID};

#[derive(UniqueTypeId)]
#[UniqueTypeIdType = "u16"]
Expand Down
1 change: 0 additions & 1 deletion src/root/compiler/assembly/utils.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std::fmt::format;
use crate::root::assembler::assembly_builder::AssemblyBuilder;
use crate::root::shared::common::{ByteSize, FunctionID, LocalAddress};

Expand Down
4 changes: 1 addition & 3 deletions src/root/compiler/compile_evaluable.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use std::any::Any;
use std::collections::HashSet;
use either::{Left, Right};
use itertools::Itertools;
use crate::root::assembler::assembly_builder::AssemblyBuilder;
use crate::root::compiler::assembly::utils::copy;
use crate::root::compiler::compile_function_call::call_function;
use crate::root::compiler::global_tracker::GlobalTracker;
Expand All @@ -14,7 +12,7 @@ use crate::root::errors::WErr;
use crate::root::name_resolver::name_resolvers::{GlobalDefinitionTable, NameResult};
use crate::root::parser::parse_function::parse_evaluable::{EvaluableToken, EvaluableTokens};
use crate::root::parser::parse_function::parse_operator::{OperatorTokens, PrefixOrInfixEx};
use crate::root::shared::common::{FunctionID, Indirection, LocalAddress, TypeRef};
use crate::root::shared::common::{FunctionID, Indirection, TypeRef};
use crate::root::shared::common::AddressedTypeRef;

fn expect_addr(r: (String, Option<AddressedTypeRef>)) -> Result<(String, AddressedTypeRef), WErr> {
Expand Down
7 changes: 2 additions & 5 deletions src/root/compiler/compile_function.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
use std::collections::HashSet;
use std::fmt::format;
use crate::root::assembler::assembly_builder::AssemblyBuilder;
use crate::root::builtin::types::bool::BoolType;
use crate::root::builtin::types::int::IntType;
use crate::root::compiler::assembly::utils::{align_16_bytes, align_16_bytes_plus_8};
use crate::root::compiler::compile_evaluable::{compile_evaluable, compile_evaluable_into, compile_evaluable_reference};
use crate::root::compiler::compile_evaluable::{compile_evaluable_into, compile_evaluable_reference};
use crate::root::compiler::global_tracker::GlobalTracker;
use crate::root::compiler::local_variable_table::LocalVariableTable;
use crate::root::errors::WErr;
Expand Down Expand Up @@ -50,7 +47,7 @@ pub fn compile_function(fid: FunctionID, function: FunctionToken, global_table:
// let stack_size = local_variables.stack_size();


let mut final_contents = format!(
let final_contents = format!(
"{}:
push rbp
mov rbp, rsp
Expand Down
5 changes: 2 additions & 3 deletions src/root/compiler/compile_function_call.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
use std::collections::HashSet;
use either::Either;
use itertools::Itertools;
use crate::root::assembler::assembly_builder::AssemblyBuilder;
use crate::root::compiler::assembly::utils::{align_16_bytes, align_16_bytes_plus_8, copy};
use crate::root::compiler::compile_evaluable::{compile_evaluable, compile_evaluable_into};
use crate::root::compiler::compile_evaluable::compile_evaluable_into;
use crate::root::compiler::global_tracker::GlobalTracker;
use crate::root::compiler::local_variable_table::LocalVariableTable;
use crate::root::errors::WErr;
use crate::root::name_resolver::name_resolvers::GlobalDefinitionTable;
use crate::root::parser::parse_function::parse_evaluable::EvaluableToken;
use crate::root::shared::common::{AddressedTypeRef, ByteSize, FunctionID, LocalAddress, TypeRef};
use crate::root::shared::common::{AddressedTypeRef, ByteSize, FunctionID};
use crate::root::utils::warn;


Expand Down
3 changes: 1 addition & 2 deletions src/root/compiler/local_variable_table.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::collections::HashMap;
use crate::root::shared::common::{AddressedTypeRef, ByteSize, LocalAddress, TypeID, TypeRef};
use crate::root::shared::types::Type;
use crate::root::shared::common::{AddressedTypeRef, ByteSize, LocalAddress};

/// Function-local table of defined variables. Only used within function processing
pub struct LocalVariableTable {
Expand Down
12 changes: 2 additions & 10 deletions src/root/name_resolver/name_resolvers.rs
Original file line number Diff line number Diff line change
@@ -1,29 +1,21 @@
use std::borrow::Cow;
use std::collections::hash_map::{Iter, IterMut};
use std::collections::HashMap;
use std::path::PathBuf;
use std::rc::Rc;
use derive_getters::Getters;
use either::{Either, Left, Right};
use crate::root::builtin::{BuiltinInlineFunction, InlineFunctionGenerator};
use crate::root::compiler::compile_function_call::call_function;
use crate::root::compiler::global_tracker::GlobalTracker;
use crate::root::compiler::local_variable_table::LocalVariableTable;
use crate::root::errors::name_resolver_errors::NRErrors;
use crate::root::errors::name_resolver_errors::NRErrors::IdentifierNotFound;
use crate::root::errors::WErr;
use crate::root::name_resolver::name_resolvers::NameResult::Function;
use crate::root::name_resolver::resolve_function_signatures::FunctionSignature;
use crate::root::ob::OB;
use crate::root::parser::parse::Location;
use crate::root::shared::types::Type;
use crate::root::parser::parse_function::FunctionToken;
use crate::root::parser::parse_function::parse_evaluable::{FullNameToken, FullNameTokens, FullNameWithIndirectionToken};
use crate::root::parser::parse_function::parse_operator::{OperatorToken, OperatorTokens, PrefixOrInfixEx};
use crate::root::parser::parse_function::parse_operator::{OperatorToken, PrefixOrInfixEx};
use crate::root::parser::parse_name::SimpleNameToken;
use crate::root::parser::parse_struct::StructToken;
use crate::root::POINTER_SIZE;
use crate::root::shared::common::{AddressedTypeRef, ByteSize, FunctionID, Indirection, LocalAddress, TypeID, TypeRef};
use crate::root::shared::common::{AddressedTypeRef, ByteSize, FunctionID, TypeID, TypeRef};

#[derive(Debug)]
enum NameTreeEntry {
Expand Down
1 change: 0 additions & 1 deletion src/root/name_resolver/resolve_names.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use std::any::Any;
use std::collections::HashMap;

use derive_getters::Getters;
use itertools::Itertools;
use crate::root::errors::name_resolver_errors::NRErrors;
use crate::root::errors::WErr;

Expand Down
2 changes: 0 additions & 2 deletions src/root/parser/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ use std::fs;
use std::path::PathBuf;
use std::rc::Rc;
use color_print::cformat;
use derive_getters::Getters;
use lazy_static::lazy_static;
use nom_supreme::final_parser::ExtractContext;
use crate::root::errors::parser_errors::ParseError;
use crate::root::errors::WErr;
use crate::root::parser::parse_toplevel::TopLevelTokens;
Expand Down
2 changes: 1 addition & 1 deletion src/root/parser/parse_arguments.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use nom::bytes::complete::{take_until, take_until1};
use nom::bytes::complete::take_until;
use nom::InputTake;
use crate::root::parser::parse::{ErrorTree, ParseResult, Span};
use crate::root::parser::parse_function::parse_evaluable::{EvaluableToken, parse_evaluable};
Expand Down
8 changes: 2 additions & 6 deletions src/root/parser/parse_blocks.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
use std::collections::HashMap;
use itertools::Itertools;
use crate::root::parser::parse::{ErrorTree, ParseResult, Span};
use nom::bytes::complete::take_until;
use nom::character::complete::{anychar, char as nchar};
use nom::Err::Error;
use nom::error::{ErrorKind, ParseError};
use nom::{InputIter, InputTake, Offset};
use nom::sequence::Tuple;
use nom_supreme::tag::complete::tag;
use nom::error::ParseError;
use nom::{InputTake, Offset};
use crate::root::parser::parse_util::discard_ignored;

// ! BROKEN
Expand Down
3 changes: 1 addition & 2 deletions src/root/parser/parse_function.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use derive_getters::{Dissolve, Getters};
use nom::sequence::Tuple;
use nom::{Offset, Parser};
use nom::Parser;
use nom_supreme::tag::complete::tag;
use substring::Substring;
use crate::root::parser::parse::{ErrorTree, Location, ParseResult, Span};
use crate::root::parser::parse_blocks::default_section;
use crate::root::parser::parse_function::parse_evaluable::{FullNameWithIndirectionToken, parse_full_name};
Expand Down
1 change: 0 additions & 1 deletion src/root/parser/parse_function/parse_assigner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use crate::root::parser::parse::{Location, ParseResult, Span};
use crate::root::parser::parse_function::parse_operator::OperatorTokens;
use crate::root::parser::parse_util::alt_many;
use clap::builder::TypedValueParser;
use nom::branch::alt;
use nom::bytes::complete::tag;
use nom::Parser;

Expand Down
12 changes: 3 additions & 9 deletions src/root/parser/parse_function/parse_assignment.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
use derive_getters::Getters;
use nom::sequence::Tuple;
use nom_supreme::tag::complete::tag;
use crate::root::parser::parse::{Location, ParseResult, Span};
use crate::root::parser::parse_function::parse_assigner::{AssignmentOperatorToken, parse_assigner};
use crate::root::parser::parse_function::parse_evaluable::{EvaluableToken, FullNameWithIndirectionToken, parse_evaluable, parse_full_name};
use crate::root::parser::parse_function::parse_initialisation::parse_initialisation;
use crate::root::parser::parse_function::parse_line::{LineTestFn, LineTokens};
use crate::root::parser::parse_name::SimpleNameToken;
use crate::root::parser::parse_util::discard_ignored;
use crate::root::parser::parse::Location;
use crate::root::parser::parse_function::parse_assigner::AssignmentOperatorToken;
use crate::root::parser::parse_function::parse_evaluable::{EvaluableToken, FullNameWithIndirectionToken};

#[derive(Debug, Getters)]
pub struct AssignmentToken {
Expand Down
Loading

0 comments on commit 5c1b9ec

Please sign in to comment.