Skip to content

Commit

Permalink
Upgraded to tstlaplus 1.4.0
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Helwer <2n8rn1w1f@mozmail.com>
  • Loading branch information
ahelwer committed Sep 30, 2024
1 parent ee3f1a8 commit 3d64a46
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ anyhow = "1.0.81"
clap = { version = "4.5.4", features = ["derive"] }
csv = "1.3.0"
serde = { version = "1.0.197", features = ["derive"] }
tree-sitter = "0.22.5"
tree-sitter-tlaplus = "1.3.6"
tree-sitter = "0.23"
tree-sitter-language = "0.1.0"
tree-sitter-tlaplus = "1.4.0"

[dev-dependencies]
glob = "0.3.1"
Expand Down
12 changes: 6 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub enum TlaError {
pub fn rewrite(input: &str, mode: &Mode, force: bool) -> Result<String, TlaError> {
let mut parser = Parser::new();
parser
.set_language(&tree_sitter_tlaplus::language())
.set_language(&tree_sitter_tlaplus::LANGUAGE.into())
.expect("Error loading TLA⁺ grammar");
let mut cursor = QueryCursor::new();

Expand Down Expand Up @@ -313,15 +313,15 @@ struct InfixOp {
impl JList {
fn query() -> Query {
Query::new(
&tree_sitter_tlaplus::language(),
&tree_sitter_tlaplus::LANGUAGE.into(),
"[(conj_list) (disj_list)] @jlist",
)
.unwrap()
}

fn terminating_infix_op_query() -> Query {
Query::new(
&tree_sitter_tlaplus::language(),
&tree_sitter_tlaplus::LANGUAGE.into(),
"(bound_infix_op lhs: [(conj_list) (disj_list)]) @capture",
)
.unwrap()
Expand Down Expand Up @@ -404,7 +404,7 @@ fn mark_symbols(tree: &Tree, cursor: &mut QueryCursor, tla_lines: &mut [TlaLine]
.map(|s| s.source_query(mode))
.collect::<Vec<String>>()
.join("");
let query = Query::new(&tree_sitter_tlaplus::language(), queries).unwrap();
let query = Query::new(&tree_sitter_tlaplus::LANGUAGE.into(), queries).unwrap();

for capture in cursor.matches(&query, tree.root_node(), "".as_bytes()) {
let capture = capture.captures[0];
Expand Down Expand Up @@ -533,7 +533,7 @@ mod tests {
fn check_ascii_replaced(text: &str) {
let mut parser = Parser::new();
parser
.set_language(&tree_sitter_tlaplus::language())
.set_language(&tree_sitter_tlaplus::LANGUAGE.into())
.unwrap();
let tree = parser.parse(&text, None).unwrap();
assert!(!tree.root_node().has_error());
Expand All @@ -543,7 +543,7 @@ mod tests {
.map(|s| s.ascii_query())
.collect::<Vec<String>>()
.join("");
let query = Query::new(&tree_sitter_tlaplus::language(), &queries).unwrap();
let query = Query::new(&tree_sitter_tlaplus::LANGUAGE.into(), &queries).unwrap();
assert_eq!(
0,
cursor
Expand Down

0 comments on commit 3d64a46

Please sign in to comment.