aboutsummaryrefslogtreecommitdiff
path: root/cs/reader.cs
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2014-04-07 00:17:13 -0500
committerJoel Martin <github@martintribe.org>2014-04-07 00:17:13 -0500
commitafdf531eba459a7a7b6505b037dbe48a363c2c79 (patch)
treeb899e21b373ac8338756140eaf7afcb399d46bb9 /cs/reader.cs
parentb18969c0b8d47d67d4b73b5b20742a0bc3179e72 (diff)
downloadmal-afdf531eba459a7a7b6505b037dbe48a363c2c79.tar.gz
mal-afdf531eba459a7a7b6505b037dbe48a363c2c79.zip
CS: add step4_if_fn_do
Diffstat (limited to 'cs/reader.cs')
-rw-r--r--cs/reader.cs9
1 files changed, 6 insertions, 3 deletions
diff --git a/cs/reader.cs b/cs/reader.cs
index 5e38136..a6d22c5 100644
--- a/cs/reader.cs
+++ b/cs/reader.cs
@@ -52,7 +52,7 @@ namespace Mal {
public static MalVal read_atom(Reader rdr) {
string token = rdr.next();
- string pattern = @"(^-?[0-9]+$)|(^-?[0-9][0-9.]*$)|(^nil$)|(^true$)|(^false$)|^""(.*)""$|(^[^""]*$)";
+ string pattern = @"(^-?[0-9]+$)|(^-?[0-9][0-9.]*$)|(^nil$)|(^true$)|(^false$)|^("".*"")$|(^[^""]*$)";
Regex regex = new Regex(pattern);
Match match = regex.Match(token);
//Console.WriteLine("token: ^" + token + "$");
@@ -68,8 +68,11 @@ namespace Mal {
} else if (match.Groups[5].Value != String.Empty) {
return Mal.types.False;
} else if (match.Groups[6].Value != String.Empty) {
- //return new MalString(StringEscapeUtils.unescapeJson(match.Groups[6]));
- return new Mal.types.MalString(match.Groups[6].Value);
+ string str = match.Groups[6].Value;
+ str = str.Substring(1, str.Length-2)
+ .Replace("\\\"", "\"")
+ .Replace("\\n", "\n");
+ return new Mal.types.MalString(str);
} else if (match.Groups[7].Value != String.Empty) {
return new Mal.types.MalSymbol(match.Groups[7].Value);
} else {