summaryrefslogtreecommitdiff
path: root/dhall_generated_parser
diff options
context:
space:
mode:
authorNadrieril Feneanar2019-08-14 00:09:14 +0200
committerGitHub2019-08-14 00:09:14 +0200
commit160b05778808976ab9bd79fa7a142ca2e94ac67a (patch)
treeb3094a3d4e6b463724302b9be7e803a80ce4eed3 /dhall_generated_parser
parent5895c3aa6552f75d7e5202be561f9734fe8945e7 (diff)
parent66260f8e386f7a447352bd8ccbda064b00b698bc (diff)
Merge pull request #102 from Nadrieril/inline-headers
Implement inline headers parsing
Diffstat (limited to '')
-rw-r--r--dhall_generated_parser/build.rs30
1 files changed, 11 insertions, 19 deletions
diff --git a/dhall_generated_parser/build.rs b/dhall_generated_parser/build.rs
index 5275097..070aa9c 100644
--- a/dhall_generated_parser/build.rs
+++ b/dhall_generated_parser/build.rs
@@ -26,16 +26,15 @@ 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");
let mut file = File::create(pest_path)?;
writeln!(&mut file, "// AUTO-GENERATED FILE. See build.rs.")?;
- writeln!(&mut file, "{}", render_rules_to_pest(rules).pretty(80))?;
- writeln!(&mut file)?;
+ // TODO: this is a cheat; properly support RFC3986 URLs instead
+ rules.remove("url_path");
+ writeln!(&mut file, "url_path = _{{ path }}")?;
+
+ rules.remove("simple_label");
writeln!(
&mut file,
"simple_label = {{
@@ -43,30 +42,23 @@ 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: this is a cheat; properly support RFC3986 URLs instead
- writeln!(&mut file, "url_path = _{{ path }}")?;
+
+ rules.remove("nonreserved_label");
writeln!(
&mut file,
"nonreserved_label = _{{
!(builtin ~ !simple_label_next_char) ~ label
}}"
)?;
+
writeln!(
&mut file,
"final_expression = ${{ SOI ~ complete_expression ~ EOI }}"
)?;
+ writeln!(&mut file)?;
+ writeln!(&mut file, "{}", render_rules_to_pest(rules).pretty(80))?;
+
// Generate pest parser manually to avoid spurious recompilations
let derived = {
let pest_path = "dhall.pest";