From 66260f8e386f7a447352bd8ccbda064b00b698bc Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Tue, 13 Aug 2019 23:44:52 +0200 Subject: Implement inline headers parsing --- dhall_syntax/src/parser.rs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'dhall_syntax/src/parser.rs') diff --git a/dhall_syntax/src/parser.rs b/dhall_syntax/src/parser.rs index a8dd359..8ecd0ab 100644 --- a/dhall_syntax/src/parser.rs +++ b/dhall_syntax/src/parser.rs @@ -598,7 +598,7 @@ make_parser! { _ => unreachable!(), }); - rule!(http_raw; children!( + rule!(http_raw>; children!( [scheme(sch), authority(auth), path(p)] => URL { scheme: sch, authority: auth, @@ -619,10 +619,10 @@ make_parser! { rule!(query; captured_str!(s) => s.to_owned()); - rule!(http; children!( + rule!(http>; children!( [http_raw(url)] => url, - [http_raw(url), import_hashed(ih)] => - URL { headers: Some(Box::new(ih)), ..url }, + [http_raw(url), expression(e)] => + URL { headers: Some(e), ..url }, )); rule!(env; children!( @@ -654,7 +654,7 @@ make_parser! { token_rule!(missing<()>); - rule!(import_type; children!( + rule!(import_type>; children!( [missing(_)] => { ImportLocation::Missing }, @@ -679,33 +679,33 @@ make_parser! { Hash::SHA256(hex::decode(hash).unwrap()) }); - rule!(import_hashed; children!( + rule!(import_hashed>; children!( [import_type(location)] => - ImportHashed { location, hash: None }, + crate::Import {mode: ImportMode::Code, location, hash: None }, [import_type(location), hash(h)] => - ImportHashed { location, hash: Some(h) }, + crate::Import {mode: ImportMode::Code, location, hash: Some(h) }, )); token_rule!(Text<()>); token_rule!(Location<()>); rule!(import as expression; span; children!( - [import_hashed(location_hashed)] => { + [import_hashed(imp)] => { spanned(span, Import(crate::Import { mode: ImportMode::Code, - location_hashed + ..imp })) }, - [import_hashed(location_hashed), Text(_)] => { + [import_hashed(imp), Text(_)] => { spanned(span, Import(crate::Import { mode: ImportMode::RawText, - location_hashed + ..imp })) }, - [import_hashed(location_hashed), Location(_)] => { + [import_hashed(imp), Location(_)] => { spanned(span, Import(crate::Import { mode: ImportMode::Location, - location_hashed + ..imp })) }, )); -- cgit v1.2.3