Skip to content

Commit

Permalink
Add fork of ariadne, to add byte spans
Browse files Browse the repository at this point in the history
  • Loading branch information
VonTum committed Feb 24, 2024
1 parent fd0f99f commit d4fa45f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "tree-sitter-sus"]
path = tree-sitter-sus
url = https://github.com/pc2/tree-sitter-sus.git
[submodule "ariadne"]
path = ariadne
url = [email protected]:VonTum/ariadne.git
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repository = "https://github.com/pc2/sus-compiler"
[dependencies]
console = "0.15.7" # for terminal colors
# chumsky = "0.9.2"
ariadne = "0.3.0" # for nice errors
ariadne = {path = "ariadne"} # for nice errors
num = "*"

# Tree sitter
Expand Down
6 changes: 4 additions & 2 deletions src/dev_aid/syntax_highlighting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ pub fn compile_all(file_paths : Vec<PathBuf>) -> (Linker, ArenaVector<(PathBuf,

println!("{:?}", full_parse.ast);

paths_arena.insert(uuid, (file_path, Source::from(&full_parse.file_text.file_text)));
paths_arena.insert(uuid, (file_path, Source::from(full_parse.file_text.file_text.clone())));
linker.add_reserved_file(uuid, full_parse);
}

Expand Down Expand Up @@ -290,7 +290,9 @@ pub fn pretty_print_error<AriadneCache : Cache<FileUUID>>(error : &CompileError,
report.finish().eprint(file_cache).unwrap();
}

impl Cache<FileUUID> for ArenaVector<(PathBuf, Source), FileUUIDMarker> {
impl Cache<FileUUID> for ArenaVector<(PathBuf, Source<String>), FileUUIDMarker> {
type Storage = String;

fn fetch(&mut self, id: &FileUUID) -> Result<&Source, Box<dyn std::fmt::Debug + '_>> {
Ok(&self[*id].1)
}
Expand Down

0 comments on commit d4fa45f

Please sign in to comment.