about summary refs log tree commit diff
path: root/src/libexpr/parser.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libexpr/parser.cc')
-rw-r--r--src/libexpr/parser.cc22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/libexpr/parser.cc b/src/libexpr/parser.cc
index 16b94fa62c8e..2ca1cab4afcb 100644
--- a/src/libexpr/parser.cc
+++ b/src/libexpr/parser.cc
@@ -71,9 +71,29 @@ const char * getPath(ParseData * data)
     return data->path.c_str();
 }
 
-int yyparse(yyscan_t scanner, ParseData * data);
+Expr unescapeStr(const char * s)
+{
+    string t;
+    char c;
+    while (c = *s++) {
+        if (c == '\\') {
+            assert(*s);
+            c = *s++;
+            if (c == 'n') t += "\n";
+            else if (c == 'r') t += "\r";
+            else if (c == 't') t += "\t";
+            else t += c;
+        }
+        else t += c;
+    }
+    return makeStr(toATerm(t));
 }
 
+int yyparse(yyscan_t scanner, ParseData * data);
+
+
+} /* end of C functions */
+
 
 static void checkAttrs(ATermMap & names, ATermList bnds)
 {