From cc03ada4e713f145f2eb1bbf0f131a4c5746cf74 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Sat, 3 Aug 2019 22:55:51 +0200 Subject: Inline headers --- dhall_generated_parser/build.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'dhall_generated_parser') diff --git a/dhall_generated_parser/build.rs b/dhall_generated_parser/build.rs index eab48bf..744cb3d 100644 --- a/dhall_generated_parser/build.rs +++ b/dhall_generated_parser/build.rs @@ -26,6 +26,7 @@ fn main() -> std::io::Result<()> { rules.get_mut(&line[2..]).map(|x| x.silent = true); } } + rules.remove("http"); rules.remove("simple_label"); rules.remove("nonreserved_label"); @@ -41,6 +42,17 @@ 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 ~ ^\")\"))? + }}" + )?; writeln!( &mut file, "nonreserved_label = _{{ -- cgit v1.2.3 From 711164a7a24ab832006b72cac162e78cf434861a Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Sun, 4 Aug 2019 11:11:37 +0200 Subject: Remove old-style optional literals --- dhall_generated_parser/src/dhall.pest.visibility | 2 -- 1 file changed, 2 deletions(-) (limited to 'dhall_generated_parser') diff --git a/dhall_generated_parser/src/dhall.pest.visibility b/dhall_generated_parser/src/dhall.pest.visibility index 60de54d..0c48656 100644 --- a/dhall_generated_parser/src/dhall.pest.visibility +++ b/dhall_generated_parser/src/dhall.pest.visibility @@ -134,8 +134,6 @@ import expression annotated_expression let_binding -empty_collection -non_empty_optional # operator_expression import_alt_expression or_expression -- cgit v1.2.3 From e52f50080d8e0e6d6a05b1045e3e0e840acb50d0 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Sun, 4 Aug 2019 14:07:34 +0200 Subject: Braced escape sequences --- dhall_generated_parser/src/dhall.pest.visibility | 1 + 1 file changed, 1 insertion(+) (limited to 'dhall_generated_parser') diff --git a/dhall_generated_parser/src/dhall.pest.visibility b/dhall_generated_parser/src/dhall.pest.visibility index 0c48656..2b7c477 100644 --- a/dhall_generated_parser/src/dhall.pest.visibility +++ b/dhall_generated_parser/src/dhall.pest.visibility @@ -21,6 +21,7 @@ label # any_label double_quote_chunk double_quote_escaped +# unicode_escape double_quote_char double_quote_literal single_quote_continue -- cgit v1.2.3 From 482be29e0f03e10c2469ef80bdd6ac7593207dc5 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Tue, 6 Aug 2019 20:38:06 +0200 Subject: RFC3986 URLs --- dhall_generated_parser/build.rs | 6 ++++++ dhall_generated_parser/src/dhall.pest.visibility | 1 + 2 files changed, 7 insertions(+) (limited to 'dhall_generated_parser') diff --git a/dhall_generated_parser/build.rs b/dhall_generated_parser/build.rs index 744cb3d..2c1a8f5 100644 --- a/dhall_generated_parser/build.rs +++ b/dhall_generated_parser/build.rs @@ -27,6 +27,7 @@ fn main() -> std::io::Result<()> { } } rules.remove("http"); + rules.remove("url_path"); rules.remove("simple_label"); rules.remove("nonreserved_label"); @@ -53,6 +54,11 @@ fn main() -> std::io::Result<()> { ~ (import_hashed | ^\"(\" ~ whsp ~ import_hashed ~ whsp ~ ^\")\"))? }}" )?; + // 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 2b7c477..97d3a69 100644 --- a/dhall_generated_parser/src/dhall.pest.visibility +++ b/dhall_generated_parser/src/dhall.pest.visibility @@ -48,6 +48,7 @@ builtin Optional Text List +Location # Bool # True # False -- cgit v1.2.3 From b3791e91b7cb73778cc21844a6999531bf537f77 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Tue, 6 Aug 2019 20:59:28 +0200 Subject: Change URL parsing --- dhall_generated_parser/src/dhall.pest.visibility | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'dhall_generated_parser') diff --git a/dhall_generated_parser/src/dhall.pest.visibility b/dhall_generated_parser/src/dhall.pest.visibility index 97d3a69..24d0a87 100644 --- a/dhall_generated_parser/src/dhall.pest.visibility +++ b/dhall_generated_parser/src/dhall.pest.visibility @@ -10,6 +10,7 @@ # whsp1 # ALPHA # DIGIT +# ALPHANUM # HEXDIG # simple_label_first_char # simple_label_next_char @@ -118,7 +119,8 @@ authority # ls32 # IPv4address # dec_octet -# reg_name +# domain +# domainlabel # pchar query # pct_encoded -- cgit v1.2.3 From 3e157f0a05b0b93753ed377332597a37fa379541 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Tue, 6 Aug 2019 21:28:12 +0200 Subject: Add toMap keyword --- dhall_generated_parser/src/dhall.pest.visibility | 1 + 1 file changed, 1 insertion(+) (limited to 'dhall_generated_parser') diff --git a/dhall_generated_parser/src/dhall.pest.visibility b/dhall_generated_parser/src/dhall.pest.visibility index 24d0a87..3142ad5 100644 --- a/dhall_generated_parser/src/dhall.pest.visibility +++ b/dhall_generated_parser/src/dhall.pest.visibility @@ -44,6 +44,7 @@ missing # Infinity NaN Some_ +toMap # keyword builtin Optional -- cgit v1.2.3 From 749834cb5e166665476f2fbc83fdfec794d90cec Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Tue, 6 Aug 2019 21:29:44 +0200 Subject: rustfmt --- dhall_generated_parser/build.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'dhall_generated_parser') diff --git a/dhall_generated_parser/build.rs b/dhall_generated_parser/build.rs index 2c1a8f5..5275097 100644 --- a/dhall_generated_parser/build.rs +++ b/dhall_generated_parser/build.rs @@ -55,10 +55,7 @@ fn main() -> std::io::Result<()> { }}" )?; // TODO: this is a cheat; properly support RFC3986 URLs instead - writeln!( - &mut file, - "url_path = _{{ path }}" - )?; + writeln!(&mut file, "url_path = _{{ path }}")?; writeln!( &mut file, "nonreserved_label = _{{ -- cgit v1.2.3 From a307a13738ccca538635ae796e6c998439025b9b Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Tue, 6 Aug 2019 22:43:40 +0200 Subject: Circumvent spec error --- dhall_generated_parser/build.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'dhall_generated_parser') diff --git a/dhall_generated_parser/build.rs b/dhall_generated_parser/build.rs index 5275097..1edce9e 100644 --- a/dhall_generated_parser/build.rs +++ b/dhall_generated_parser/build.rs @@ -30,6 +30,7 @@ fn main() -> std::io::Result<()> { rules.remove("url_path"); rules.remove("simple_label"); rules.remove("nonreserved_label"); + rules.remove("first_application_expression"); let mut file = File::create(pest_path)?; writeln!(&mut file, "// AUTO-GENERATED FILE. See build.rs.")?; @@ -54,6 +55,16 @@ fn main() -> std::io::Result<()> { ~ (import_hashed | ^\"(\" ~ whsp ~ import_hashed ~ whsp ~ ^\")\"))? }}" )?; + // TODO: hack while waiting to catch up on commit e7fdf9d of the spec + writeln!( + &mut file, + "first_application_expression = {{ + merge ~ whsp1 ~ import_expression ~ whsp1 ~ import_expression + | Some_ ~ whsp1 ~ import_expression + | toMap ~ whsp1 ~ import_expression + | import_expression + }}" + )?; // TODO: this is a cheat; properly support RFC3986 URLs instead writeln!(&mut file, "url_path = _{{ path }}")?; writeln!( -- cgit v1.2.3 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 From d5c3e8f2ef7438b7ac84be34cfe019ce365ae529 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Wed, 7 Aug 2019 16:22:00 +0200 Subject: Forbid surrogate pairs and non-characters --- dhall_generated_parser/src/dhall.pest.visibility | 1 + 1 file changed, 1 insertion(+) (limited to 'dhall_generated_parser') diff --git a/dhall_generated_parser/src/dhall.pest.visibility b/dhall_generated_parser/src/dhall.pest.visibility index 3142ad5..33018ae 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 -- cgit v1.2.3 From 98e7751fb8deb22685b6991367404515c35f502f Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Wed, 7 Aug 2019 16:28:48 +0200 Subject: Various parsing tweaks --- dhall_generated_parser/build.rs | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'dhall_generated_parser') diff --git a/dhall_generated_parser/build.rs b/dhall_generated_parser/build.rs index 7eba52c..74210bf 100644 --- a/dhall_generated_parser/build.rs +++ b/dhall_generated_parser/build.rs @@ -30,7 +30,6 @@ fn main() -> std::io::Result<()> { rules.remove("url_path"); rules.remove("simple_label"); rules.remove("nonreserved_label"); - rules.remove("first_application_expression"); rules.remove("expression"); let mut file = File::create(pest_path)?; @@ -56,16 +55,6 @@ fn main() -> std::io::Result<()> { ~ (import_hashed | ^\"(\" ~ whsp ~ import_hashed ~ whsp ~ ^\")\"))? }}" )?; - // TODO: hack while waiting to catch up on commit e7fdf9d of the spec - writeln!( - &mut file, - "first_application_expression = {{ - merge ~ whsp1 ~ import_expression ~ whsp1 ~ import_expression - | Some_ ~ whsp1 ~ import_expression - | toMap ~ whsp1 ~ import_expression - | import_expression - }}" - )?; // TODO: hack; we'll need to upstream a change to the grammar writeln!( &mut file, -- cgit v1.2.3 From d248762095908246951b6aa6c211587c6e333c0e Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Wed, 7 Aug 2019 21:05:01 +0200 Subject: Remove union literals from the language --- dhall_generated_parser/src/dhall.pest.visibility | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'dhall_generated_parser') diff --git a/dhall_generated_parser/src/dhall.pest.visibility b/dhall_generated_parser/src/dhall.pest.visibility index 33018ae..dd54578 100644 --- a/dhall_generated_parser/src/dhall.pest.visibility +++ b/dhall_generated_parser/src/dhall.pest.visibility @@ -169,11 +169,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 -- cgit v1.2.3 From 51c4f79fe092191d670ffa2f9098693079dbc1be Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Wed, 7 Aug 2019 21:18:11 +0200 Subject: Add truncated Natural subtraction --- dhall_generated_parser/src/dhall.pest.visibility | 1 + 1 file changed, 1 insertion(+) (limited to 'dhall_generated_parser') diff --git a/dhall_generated_parser/src/dhall.pest.visibility b/dhall_generated_parser/src/dhall.pest.visibility index dd54578..de6dc8d 100644 --- a/dhall_generated_parser/src/dhall.pest.visibility +++ b/dhall_generated_parser/src/dhall.pest.visibility @@ -71,6 +71,7 @@ Location # Natural_show # Integer_toDouble # Integer_show +# Natural_subtract # Double_show # List_build # List_fold -- cgit v1.2.3