From 8371b28de5b64e54952762a5979839a802e94440 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Tue, 5 Mar 2019 02:23:56 +0100 Subject: Include modified abnf in repo --- dhall_parser/build.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'dhall_parser/build.rs') 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(()) -- cgit v1.2.3