summaryrefslogtreecommitdiff
path: root/dhall_generated_parser/build.rs
diff options
context:
space:
mode:
Diffstat (limited to 'dhall_generated_parser/build.rs')
-rw-r--r--dhall_generated_parser/build.rs37
1 files changed, 37 insertions, 0 deletions
diff --git a/dhall_generated_parser/build.rs b/dhall_generated_parser/build.rs
index eab48bf..74210bf 100644
--- a/dhall_generated_parser/build.rs
+++ b/dhall_generated_parser/build.rs
@@ -26,8 +26,11 @@ fn main() -> std::io::Result<()> {
rules.get_mut(&line[2..]).map(|x| x.silent = true);
}
}
+ rules.remove("http");
+ rules.remove("url_path");
rules.remove("simple_label");
rules.remove("nonreserved_label");
+ rules.remove("expression");
let mut file = File::create(pest_path)?;
writeln!(&mut file, "// AUTO-GENERATED FILE. See build.rs.")?;
@@ -41,6 +44,40 @@ fn main() -> std::io::Result<()> {
| !keyword ~ simple_label_first_char ~ simple_label_next_char*
}}"
)?;
+ // TODO: this is a cheat; actually implement inline headers instead
+ writeln!(
+ &mut file,
+ "http = {{
+ http_raw
+ ~ (whsp
+ ~ using
+ ~ whsp1
+ ~ (import_hashed | ^\"(\" ~ whsp ~ import_hashed ~ whsp ~ ^\")\"))?
+ }}"
+ )?;
+ // 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!(
&mut file,
"nonreserved_label = _{{