summaryrefslogtreecommitdiff
path: root/dhall_core/src/parser.rs
diff options
context:
space:
mode:
authorNadrieril2019-03-19 02:14:43 +0100
committerNadrieril2019-03-19 02:14:43 +0100
commitfb79d63d6a57431ff49b94a3fc90cfcf9c2ee788 (patch)
treeac6929295cfdfa438fad3eb40ec32a61174e7b8d /dhall_core/src/parser.rs
parent9f8622ae6163bdea83604bafdfc3ee4e70b0bcde (diff)
Test printer in parser tests
Closes #30
Diffstat (limited to 'dhall_core/src/parser.rs')
-rw-r--r--dhall_core/src/parser.rs22
1 files changed, 21 insertions, 1 deletions
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<ParsedText>;
}
);
-// TODO: parse escapes
rule!(double_quote_chunk<ParsedTextContents<'a>>;
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<ParsedText>;
children!(eol: raw_str, contents: single_quote_continue) => {