Skip to content

Commit

Permalink
Merge branch 'main' into add/file-watch
Browse files Browse the repository at this point in the history
  • Loading branch information
rozukke authored Sep 16, 2024
2 parents d0fefcf + cdbb9dd commit 193f343
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 42 deletions.
32 changes: 1 addition & 31 deletions Cargo.lock

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

5 changes: 1 addition & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
[package]
name = "lace"
description = "A complete compiler and interpreter toolchain for the LC3 assembly language."
description = "A complete assembler toolchain for the LC3 assembly language."
version = "0.1.0"
authors = [
"Artemis Rosman"
]
edition = "2021"

[dependencies]
glob = "0.3.1"
clap = { version = "4.5.4", features = ["derive"] }
colored = "2.1.0"
regex = "1.10.6"
lazy_static = "1.5.0"
miette = { version = "7.2.0", features = ["fancy"] }
indexmap = { version = "2.4.0", features = ["std"] }
fxhash = "0.2.1"
hotwatch = "0.5.0"

Expand Down
10 changes: 3 additions & 7 deletions src/symbol.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
use std::{cell::RefCell, ops::Range, str::FromStr};

use fxhash::FxBuildHasher;
use indexmap::IndexMap;
use fxhash::FxHashMap;
use miette::{miette, Result, SourceSpan};

// Symbol table of symbol -> memory address (line number)
type FxMap<K, V> = IndexMap<K, V, FxBuildHasher>;

thread_local! {
pub static SYMBOL_TABLE: RefCell<FxMap<String, u16>> = RefCell::new(IndexMap::with_hasher(FxBuildHasher::default()));
pub static SYMBOL_TABLE: RefCell<FxHashMap<String, u16>> = RefCell::new(FxHashMap::default());
}

pub fn reset_state() {
Expand All @@ -18,7 +14,7 @@ pub fn reset_state() {
/// Access to symbol table via closure
pub fn with_symbol_table<R, F>(f: F) -> R
where
F: FnOnce(&mut FxMap<String, u16>) -> R,
F: FnOnce(&mut FxHashMap<String, u16>) -> R,
{
SYMBOL_TABLE.with_borrow_mut(f)
}
Expand Down

0 comments on commit 193f343

Please sign in to comment.