From f7b0c6b9c52f65624dc765fb9eaa7d0d94eeae76 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Tue, 6 Aug 2019 23:03:01 +0200 Subject: Generalize empty list annotations --- dhall_generated_parser/build.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'dhall_generated_parser') diff --git a/dhall_generated_parser/build.rs b/dhall_generated_parser/build.rs index 1edce9e..7eba52c 100644 --- a/dhall_generated_parser/build.rs +++ b/dhall_generated_parser/build.rs @@ -31,6 +31,7 @@ fn main() -> std::io::Result<()> { rules.remove("simple_label"); rules.remove("nonreserved_label"); rules.remove("first_application_expression"); + rules.remove("expression"); let mut file = File::create(pest_path)?; writeln!(&mut file, "// AUTO-GENERATED FILE. See build.rs.")?; @@ -65,6 +66,27 @@ fn main() -> std::io::Result<()> { | import_expression }}" )?; + // TODO: hack; we'll need to upstream a change to the grammar + writeln!( + &mut file, + r#"expression = {{ + lambda ~ whsp ~ ^"(" ~ whsp ~ nonreserved_label ~ whsp ~ ^":" ~ whsp1 ~ expression ~ whsp ~ ^")" ~ whsp ~ arrow ~ whsp ~ expression + | if_ ~ whsp1 ~ expression ~ whsp ~ then ~ whsp1 ~ expression ~ whsp ~ else_ ~ whsp1 ~ expression + | let_binding+ ~ in_ ~ whsp1 ~ expression + | forall ~ whsp ~ ^"(" ~ whsp ~ nonreserved_label ~ whsp ~ ^":" ~ whsp1 ~ expression ~ whsp ~ ^")" ~ whsp ~ arrow ~ whsp ~ expression + | operator_expression ~ whsp ~ arrow ~ whsp ~ expression + | merge ~ whsp1 ~ import_expression ~ whsp1 ~ import_expression ~ whsp ~ ^":" ~ whsp1 ~ application_expression + | empty_list_literal + | toMap ~ whsp1 ~ import_expression ~ whsp ~ ^":" ~ whsp1 ~ application_expression + | annotated_expression + }}"# + )?; + writeln!( + &mut file, + r#"empty_list_literal = {{ + ^"[" ~ whsp ~ ^"]" ~ whsp ~ ^":" ~ whsp1 ~ application_expression + }}"# + )?; // TODO: this is a cheat; properly support RFC3986 URLs instead writeln!(&mut file, "url_path = _{{ path }}")?; writeln!( -- cgit v1.2.3