summaryrefslogtreecommitdiff
path: root/dhall/build.rs
diff options
context:
space:
mode:
authorNadrieril2020-02-20 18:52:34 +0000
committerNadrieril2020-02-20 18:54:11 +0000
commit86508a3ad59a0bfc1e24448d0a0126b1a1c645e1 (patch)
tree05db6aab6499ba2a3d91e0253571ee3cf5fefc8f /dhall/build.rs
parent26ed5a1d4d43573ac8ad2f8de9e4dd411650aa9a (diff)
Add support for duplicate record fields
Diffstat (limited to 'dhall/build.rs')
-rw-r--r--dhall/build.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/dhall/build.rs b/dhall/build.rs
index 7c62083..88a2145 100644
--- a/dhall/build.rs
+++ b/dhall/build.rs
@@ -375,6 +375,26 @@ fn convert_abnf_to_pest() -> std::io::Result<()> {
rules.remove("url_path");
writeln!(&mut file, "url_path = _{{ path }}")?;
+ // TODO: workaround to simplify record parsing
+ rules.remove("non_empty_record_type_or_literal");
+ rules.remove("non_empty_record_literal");
+ rules.remove("non_empty_record_type");
+ writeln!(
+ &mut file,
+ "non_empty_record_type_or_literal = {{ non_empty_record_literal | \
+ non_empty_record_type }}"
+ )?;
+ writeln!(
+ &mut file,
+ "non_empty_record_literal = {{ record_literal_entry ~ (whsp ~ ^\",\" \
+ ~ whsp ~ record_literal_entry)*}}"
+ )?;
+ writeln!(
+ &mut file,
+ "non_empty_record_type = {{ record_type_entry ~ (whsp ~ ^\",\" ~ whsp \
+ ~ record_type_entry)* }}"
+ )?;
+
// Work around some greediness issue in the grammar.
rules.remove("missing");
writeln!(