diff options
author | Nadrieril Feneanar | 2019-08-03 22:21:40 +0200 |
---|---|---|
committer | GitHub | 2019-08-03 22:21:40 +0200 |
commit | ded09933a6783d1124b6c22ff0818fb525c3141d (patch) | |
tree | 5a4839e450b7fd09429742033c5b9732e453e2d1 /dhall_syntax/src/parser.rs | |
parent | 30bc224b524031fbf64057516961831890bb749c (diff) | |
parent | 016893b00fcd916099e0349affc124fdd6275c67 (diff) |
Merge pull request #93 from Nadrieril/catchup-spec
Do some catch up on the spec
Diffstat (limited to '')
-rw-r--r-- | dhall_syntax/src/parser.rs | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/dhall_syntax/src/parser.rs b/dhall_syntax/src/parser.rs index 316ef2f..9d9a374 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<Hash>; captured_str!(s) => - Hash { - protocol: s.trim()[..6].to_owned(), - hash: s.trim()[7..].to_owned(), + rule!(hash<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<ImportHashed>; children!( [import_type(location)] => @@ -870,6 +878,7 @@ make_parser! { rule!(selector<Either<Label, Vec<Label>>>; children!( [label(l)] => Either::Left(l), [labels(ls)] => Either::Right(ls), + [expression(e)] => unimplemented!("selection by expression"), // TODO )); rule!(labels<Vec<Label>>; children!( |