summaryrefslogtreecommitdiff
path: root/dhall_generated_parser
diff options
context:
space:
mode:
authorNadrieril Feneanar2019-08-07 23:12:47 +0200
committerGitHub2019-08-07 23:12:47 +0200
commit674fbdc33c788156f76d263b044dccc48c810870 (patch)
tree725eaa49a4f2236d44470279296969b66ba0bbc8 /dhall_generated_parser
parent8ec422f2319360f986950fcb9aae4bcf65a9c1e2 (diff)
parente81ab9a553bf82f20fa0b0344926258176a21dac (diff)
Merge pull request #95 from Nadrieril/catchup-spec
A lot more catching up on the spec
Diffstat (limited to '')
-rw-r--r--dhall_generated_parser/build.rs37
-rw-r--r--dhall_generated_parser/src/dhall.pest.visibility17
2 files changed, 47 insertions, 7 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 = _{{
diff --git a/dhall_generated_parser/src/dhall.pest.visibility b/dhall_generated_parser/src/dhall.pest.visibility
index 60de54d..de6dc8d 100644
--- a/dhall_generated_parser/src/dhall.pest.visibility
+++ b/dhall_generated_parser/src/dhall.pest.visibility
@@ -1,4 +1,5 @@
# end_of_line
+# valid_non_ascii
# tab
# block_comment
# block_comment_char
@@ -10,6 +11,7 @@
# whsp1
# ALPHA
# DIGIT
+# ALPHANUM
# HEXDIG
# simple_label_first_char
# simple_label_next_char
@@ -21,6 +23,7 @@ label
# any_label
double_quote_chunk
double_quote_escaped
+# unicode_escape
double_quote_char
double_quote_literal
single_quote_continue
@@ -42,11 +45,13 @@ missing
# Infinity
NaN
Some_
+toMap
# keyword
builtin
Optional
Text
List
+Location
# Bool
# True
# False
@@ -66,6 +71,7 @@ List
# Natural_show
# Integer_toDouble
# Integer_show
+# Natural_subtract
# Double_show
# List_build
# List_fold
@@ -116,7 +122,8 @@ authority
# ls32
# IPv4address
# dec_octet
-# reg_name
+# domain
+# domainlabel
# pchar
query
# pct_encoded
@@ -134,8 +141,6 @@ import
expression
annotated_expression
let_binding
-empty_collection
-non_empty_optional
# operator_expression
import_alt_expression
or_expression
@@ -165,11 +170,9 @@ non_empty_record_type
record_type_entry
non_empty_record_literal
record_literal_entry
-union_type_or_literal
+union_type
empty_union_type
-non_empty_union_type_or_literal
-union_literal_variant_value
+# non_empty_union_type
union_type_entry
-union_type_or_literal_variant_type
non_empty_list_literal
# complete_expression