Skip to content

Commit 0518f45

Browse files
author
Yuval Bendor
committed
invariant recognition hopefully works, trims types and blocks, should fix #5 #7
1 parent 89c5217 commit 0518f45

File tree

7 files changed

+247
-169
lines changed

7 files changed

+247
-169
lines changed

Cargo.toml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@ edition = "2021"
55

66
[dependencies]
77
chumsky = { git = "https://github.com/zesterer/chumsky" }
8-
clap = { version = "3.2.15", features = ["cargo", "derive"] }
8+
clap = { version = "3.2.17", features = ["cargo", "derive"] }
99
color-eyre = "0.6.2"
10-
indoc = "1.0.6"
10+
indoc = "1.0.7"
1111
itertools = "0.10.3"
1212
lsp-types = "0.93.0"
13+
once_cell = "1.13.1"
14+
regex = "1.6.0"
1315
ropey = "1.5.0"
14-
serde = { version = "1.0.140", features = ["derive"] }
15-
serde_json = "1.0.82"
16+
serde = { version = "1.0.143", features = ["derive"] }
17+
serde_json = "1.0.83"
1618
tap = "1.0.1"

src/bin/main.rs

Lines changed: 0 additions & 62 deletions
This file was deleted.

src/lib.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,4 +286,33 @@ impl AssociatedElement {
286286
_ => None,
287287
}
288288
}
289+
290+
pub fn filters(&self) -> Option<&str> {
291+
match self {
292+
AssociatedElement::Rule { filters, .. }
293+
| AssociatedElement::Invariant { filters, .. } => filters.as_ref().map(String::as_str),
294+
_ => None,
295+
}
296+
}
297+
298+
pub fn invariant(&self) -> Option<&str> {
299+
match self {
300+
AssociatedElement::Invariant { invariant, .. } => Some(invariant.as_str()),
301+
_ => None,
302+
}
303+
}
304+
305+
pub fn mapping(&self) -> Option<&str> {
306+
match self {
307+
AssociatedElement::GhostMapping { mapping, .. } => Some(mapping.as_str()),
308+
_ => None,
309+
}
310+
}
311+
312+
pub fn definition(&self) -> Option<&str> {
313+
match self {
314+
AssociatedElement::Definition { definition, .. } => Some(definition.as_str()),
315+
_ => None,
316+
}
317+
}
289318
}

0 commit comments

Comments
 (0)