summaryrefslogtreecommitdiff
path: root/dhall_parser/build.rs
diff options
context:
space:
mode:
authorNadrieril2019-03-05 02:23:56 +0100
committerNadrieril2019-03-05 02:23:56 +0100
commit8371b28de5b64e54952762a5979839a802e94440 (patch)
treeff9d404883d77de519be126011efe74b40fc16fa /dhall_parser/build.rs
parent5bc6cc5f19aca81f1bb2d51ed9fc42d05f97e05c (diff)
Include modified abnf in repo
Diffstat (limited to 'dhall_parser/build.rs')
-rw-r--r--dhall_parser/build.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/dhall_parser/build.rs b/dhall_parser/build.rs
index 8dd5875..3ca36b5 100644
--- a/dhall_parser/build.rs
+++ b/dhall_parser/build.rs
@@ -5,7 +5,9 @@ use std::collections::HashMap;
use abnf_to_pest::{PestRuleSettings, abnf_to_pest};
fn main() -> std::io::Result<()> {
- let abnf_path = "../dhall-lang/standard/dhall.abnf";
+ // TODO: upstream changes to grammar
+ // let abnf_path = "../dhall-lang/standard/dhall.abnf";
+ let abnf_path = "src/dhall.abnf";
let visibility_path = "src/dhall.pest.visibility";
let pest_path = "src/dhall.pest";
println!("cargo:rerun-if-changed={}", abnf_path);
@@ -25,9 +27,18 @@ fn main() -> std::io::Result<()> {
rule_settings.insert(line, PestRuleSettings { visible: true, ..Default::default() });
}
}
+ rule_settings.insert("simple_label".to_owned(), PestRuleSettings {
+ visible: true,
+ replace: Some("
+ keyword_raw ~ simple_label_next_char+
+ | !keyword_raw ~ simple_label_first_char ~ simple_label_next_char*
+ ".to_owned()),
+ });
let mut file = File::create(pest_path)?;
+ writeln!(&mut file, "// AUTO-GENERATED FILE. See build.rs.")?;
writeln!(&mut file, "{}", abnf_to_pest(&data, &rule_settings)?)?;
+ writeln!(&mut file, "keyword_raw = _{{ let_raw | in_raw | if_raw | then_raw | else_raw }}")?;
writeln!(&mut file, "final_expression = {{ SOI ~ complete_expression ~ EOI }}")?;
Ok(())