summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--CHANGELOG.md1
m---------dhall-lang0
-rw-r--r--dhall/src/syntax/text/dhall.abnf9
-rw-r--r--dhall/src/syntax/text/dhall.pest.visibility2
-rw-r--r--dhall/src/syntax/text/parser.rs11
-rw-r--r--dhall/tests/parser/failure/unit/UrlWithQuotedPath.txt6
-rw-r--r--dhall/tests/parser/success/unit/import/quotedPathsB.txt2
7 files changed, 16 insertions, 15 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 959f0a6..dd042c3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,7 @@
#### [Unreleased]
+- BREAKING CHANGE: Remove the ability to quote paths in URLs
- Allow quoted labels to be empty
- Support Dhall v16.0.0
- Fix running tests on Windows. Developing on this lib should now be possible on Windows.
diff --git a/dhall-lang b/dhall-lang
-Subproject 871e8f749f4c8a9d80311e0646dfbf0b5eeec31
+Subproject 86378293333912335c7b4bfaa32a56294780951
diff --git a/dhall/src/syntax/text/dhall.abnf b/dhall/src/syntax/text/dhall.abnf
index 26f6eab..4061de2 100644
--- a/dhall/src/syntax/text/dhall.abnf
+++ b/dhall/src/syntax/text/dhall.abnf
@@ -582,7 +582,6 @@ scheme = %x68.74.74.70 [ %x73 ] ; "http" [ "s" ]
; NOTE: This does not match the official grammar for a URI. Specifically:
;
-; * path segments may be quoted instead of using percent-encoding
; * this does not support fragment identifiers, which have no meaning within
; Dhall expressions and do not affect import resolution
; * the characters "(" ")" and "," are not included in the `sub-delims` rule:
@@ -595,13 +594,9 @@ scheme = %x68.74.74.70 [ %x73 ] ; "http" [ "s" ]
;
; Reserved characters in quoted path components should be percent-encoded
; according to https://tools.ietf.org/html/rfc3986#section-2
-http-raw = scheme "://" authority url-path [ "?" query ]
+http-raw = scheme "://" authority path-abempty [ "?" query ]
-; Temporary rule to allow old-style `path-component`s and RFC3986 `segment`s in
-; the same grammar. Eventually we can just use `path-abempty` from the same
-; RFC. See issue #581
-
-url-path = *(path-component / "/" segment)
+path-abempty = *( "/" segment )
; NOTE: Backtrack if parsing the optional user info prefix fails
authority = [ userinfo "@" ] host [ ":" port ]
diff --git a/dhall/src/syntax/text/dhall.pest.visibility b/dhall/src/syntax/text/dhall.pest.visibility
index 2fee160..6de7dd2 100644
--- a/dhall/src/syntax/text/dhall.pest.visibility
+++ b/dhall/src/syntax/text/dhall.pest.visibility
@@ -120,7 +120,7 @@ home_path
absolute_path
scheme
http_raw
-url_path
+path_abempty
authority
# userinfo
# host
diff --git a/dhall/src/syntax/text/parser.rs b/dhall/src/syntax/text/parser.rs
index 1c51ca2..06c1ac3 100644
--- a/dhall/src/syntax/text/parser.rs
+++ b/dhall/src/syntax/text/parser.rs
@@ -514,14 +514,14 @@ impl DhallParser {
fn http_raw(input: ParseInput) -> ParseResult<URL<Expr>> {
Ok(match_nodes!(input.into_children();
- [scheme(sch), authority(auth), url_path(p)] => URL {
+ [scheme(sch), authority(auth), path_abempty(p)] => URL {
scheme: sch,
authority: auth,
path: p,
query: None,
headers: None,
},
- [scheme(sch), authority(auth), url_path(p), query(q)] => URL {
+ [scheme(sch), authority(auth), path_abempty(p), query(q)] => URL {
scheme: sch,
authority: auth,
path: p,
@@ -531,10 +531,10 @@ impl DhallParser {
))
}
- fn url_path(input: ParseInput) -> ParseResult<FilePath> {
+ fn path_abempty(input: ParseInput) -> ParseResult<FilePath> {
Ok(match_nodes!(input.into_children();
- [path_component(components)..] => {
- let mut file_path: Vec<_> = components.collect();
+ [segment(segments)..] => {
+ let mut file_path: Vec<_> = segments.collect();
// An empty path normalizes to "/"
if file_path.is_empty() {
file_path = vec!["".to_owned()];
@@ -548,7 +548,6 @@ impl DhallParser {
Ok(input.as_str().to_owned())
}
- #[alias(path_component)]
fn segment(input: ParseInput) -> ParseResult<String> {
Ok(input.as_str().to_string())
}
diff --git a/dhall/tests/parser/failure/unit/UrlWithQuotedPath.txt b/dhall/tests/parser/failure/unit/UrlWithQuotedPath.txt
new file mode 100644
index 0000000..0b51f38
--- /dev/null
+++ b/dhall/tests/parser/failure/unit/UrlWithQuotedPath.txt
@@ -0,0 +1,6 @@
+ --> 1:21
+ |
+1 | https://example.com/"a%20b"/c␊
+ | ^---
+ |
+ = expected EOI, import_alt, bool_or, natural_plus, text_append, list_append, bool_and, natural_times, bool_eq, bool_ne, combine, combine_types, equivalent, prefer, or arrow
diff --git a/dhall/tests/parser/success/unit/import/quotedPathsB.txt b/dhall/tests/parser/success/unit/import/quotedPathsB.txt
index 4705ca3..373b872 100644
--- a/dhall/tests/parser/success/unit/import/quotedPathsB.txt
+++ b/dhall/tests/parser/success/unit/import/quotedPathsB.txt
@@ -1 +1 @@
-{ example0 = /foo/bar/"baz qux", example1 = https://example.com/foo/bar%3Fbaz?qux }
+/foo/bar/"baz qux"