Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
Expose debug symbol start and end for the language server
Browse files Browse the repository at this point in the history
  • Loading branch information
alxkzmn committed Aug 22, 2024
1 parent ade4548 commit de1e458
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 6 deletions.
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ authors = ["Leo Lara <[email protected]>"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[patch.crates-io]
halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", default-features = false, rev = "da4983e" }
halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", default-features = false, rev = "bc857a7" }

[patch."https://github.com/scroll-tech/halo2.git"]
halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", default-features = false, rev = "da4983e" }
halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", default-features = false, rev = "bc857a7" }

[dependencies]
pyo3 = { version = "0.19.1", features = ["extension-module"] }

halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", default-features = false, features = [ "circuit-params", "derive_serde"], rev = "da4983e"}
halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", default-features = false, features = [ "circuit-params", "derive_serde"], rev = "bc857a7"}

halo2_middleware = { git = "https://github.com/privacy-scaling-explorations/halo2.git", rev = "da4983e" }
halo2_backend = { git = "https://github.com/privacy-scaling-explorations/halo2.git", features = ["derive_serde"], rev = "da4983e" }
halo2_middleware = { git = "https://github.com/privacy-scaling-explorations/halo2.git", rev = "bc857a7" }
halo2_backend = { git = "https://github.com/privacy-scaling-explorations/halo2.git", features = ["derive_serde"], rev = "bc857a7" }

num-bigint = { version = "0.4", features = ["rand"] }
uuid = { version = "1.4.0", features = ["v1", "rng"] }
Expand Down
31 changes: 30 additions & 1 deletion src/parser/ast/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,22 @@ impl PartialEq for DebugSymRef {
}
}

/// Interface of the debug symbol reference to use with the Chiquito language server
pub trait LanguageServerInterface {
fn get_start(&self) -> usize;
fn get_end(&self) -> usize;
}

impl LanguageServerInterface for DebugSymRef {
fn get_start(&self) -> usize {
self.start
}

fn get_end(&self) -> usize {
self.end
}
}

#[derive(Clone, PartialEq, Eq)]
pub struct Identifier(
/// Name
Expand Down Expand Up @@ -227,7 +243,20 @@ mod test {

use codespan_reporting::files::SimpleFile;

use crate::parser::ast::{DebugSymRef, Identifier};
use crate::parser::ast::{DebugSymRef, Identifier, LanguageServerInterface};

#[test]
fn test_language_server_interface() {
let debug_sym_ref = DebugSymRef {
start: 0,
end: 1,
file: Arc::new(SimpleFile::new("file_path".to_string(), "".to_string())),
virt: false,
};

assert_eq!(debug_sym_ref.get_start(), 0);
assert_eq!(debug_sym_ref.get_end(), 1);
}

#[test]
fn test_from_string() {
Expand Down

0 comments on commit de1e458

Please sign in to comment.