From 2ad5973a32099ad8f79f247adc9d03340e2df4ab Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Sat, 3 Aug 2019 21:36:53 +0200 Subject: Update dhall-lang submodule --- dhall_syntax/src/parser.rs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'dhall_syntax/src/parser.rs') diff --git a/dhall_syntax/src/parser.rs b/dhall_syntax/src/parser.rs index 316ef2f..d8bd957 100644 --- a/dhall_syntax/src/parser.rs +++ b/dhall_syntax/src/parser.rs @@ -461,6 +461,11 @@ make_parser! { lines.push(vec![]); lines }, + [single_quote_char("\r\n"), single_quote_continue(lines)] => { + let mut lines = lines; + lines.push(vec![]); + lines + }, [single_quote_char(c), single_quote_continue(lines)] => { // TODO: don't allocate for every char let c = InterpolatedTextContents::Text(c.to_owned()); @@ -654,12 +659,15 @@ make_parser! { }, )); - rule!(hash; captured_str!(s) => - Hash { - protocol: s.trim()[..6].to_owned(), - hash: s.trim()[7..].to_owned(), + rule!(hash; captured_str!(s) => { + let s = s.trim(); + let protocol = &s[..6]; + let hash = &s[7..]; + if protocol != "sha256" { + Err(format!("Unknown hashing protocol '{}'", protocol))? } - ); + Hash::SHA256(hex::decode(hash).unwrap()) + }); rule!(import_hashed; children!( [import_type(location)] => -- cgit v1.2.3