Skip to content

Commit

Permalink
Update parol to v2
Browse files Browse the repository at this point in the history
  • Loading branch information
dalance committed Jan 22, 2025
1 parent 5df71a7 commit 93c003f
Show file tree
Hide file tree
Showing 11 changed files with 664 additions and 534 deletions.
149 changes: 127 additions & 22 deletions Cargo.lock

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

11 changes: 8 additions & 3 deletions crates/languageserver/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,18 @@ fn main() {

let text = fs::read_to_string(par_file).unwrap();
let mut keywords = "pub const KEYWORDS: &[&str] = &[\n".to_string();
let mut in_keyword = false;
for line in text.lines() {
if line.contains("(?-u:\\b)") {
if line == "// -- keyword end --" {
in_keyword = false;
}
if in_keyword {
let keyword = line.split('/').nth(1).unwrap();
let keyword = keyword.replace("(?-u:\\b)", "");
let keyword = keyword.replace("(?-u:\\b)", "");
keywords.push_str(&format!(" \"{keyword}\",\n"));
}
if line == "// -- keyword begin --" {
in_keyword = true;
}
}
keywords.push_str("];\n");
fs::write(exp_file, keywords).unwrap();
Expand Down
6 changes: 3 additions & 3 deletions crates/parser/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ exclude = ["build.rs"]
anyhow = {workspace = true}
bimap = "0.6.3"
once_cell = {workspace = true}
parol_runtime = {version = "1.0", features = ["auto_generation"]}
parol_runtime = "2.1.1"
paste = "1.0"
regex = {workspace = true}
thiserror = {workspace = true}
Expand All @@ -29,5 +29,5 @@ miette = {workspace = true, features = ["fancy-no-syscall"]}
miette = {workspace = true, features = ["fancy"]}

[build-dependencies]
parol = "1.0"
parol_runtime = {version = "1.0", features = ["auto_generation"]}
parol = "2.1.2"
parol_runtime = "2.1.1"
1 change: 0 additions & 1 deletion crates/parser/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ fn main() {
.expanded_grammar_output_file("veryl-exp.par")
.parser_output_file("veryl_parser.rs")
.actions_output_file("veryl_grammar_trait.rs")
.enable_auto_generation()
.user_type_name("VerylGrammar")
.user_trait_module_name("veryl_grammar")
.trim_parse_tree()
Expand Down
Loading

0 comments on commit 93c003f

Please sign in to comment.