From fb79d63d6a57431ff49b94a3fc90cfcf9c2ee788 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Tue, 19 Mar 2019 02:14:43 +0100 Subject: Test printer in parser tests Closes #30 --- dhall_core/src/parser.rs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'dhall_core/src/parser.rs') diff --git a/dhall_core/src/parser.rs b/dhall_core/src/parser.rs index 6809aa2..6f84abe 100644 --- a/dhall_core/src/parser.rs +++ b/dhall_core/src/parser.rs @@ -435,15 +435,35 @@ rule!(double_quote_literal; } ); -// TODO: parse escapes rule!(double_quote_chunk>; children!(c: interpolation) => { InterpolatedTextContents::Expr(c) }, + children!(s: double_quote_escaped) => { + InterpolatedTextContents::Text(s) + }, captured_str!(s) => { InterpolatedTextContents::Text(s) }, ); +rule!(double_quote_escaped<&'a str>; + // TODO: parse all escapes + captured_str!(s) => { + match s { + "\"" => "\"", + "$" => "$", + "\\" => "\\", + "/" => "/", + // "b" => "\b", + // "f" => "\f", + "n" => "\n", + "r" => "\r", + "t" => "\t", + // "uXXXX" + _ => unimplemented!(), + } + } +); rule!(single_quote_literal; children!(eol: raw_str, contents: single_quote_continue) => { -- cgit v1.2.3