aboutsummaryrefslogtreecommitdiff
path: root/cs/reader.cs
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2014-12-18 20:33:49 -0600
committerJoel Martin <github@martintribe.org>2015-01-09 16:16:50 -0600
commitb8ee29b22fbaa7a01f2754b4d6dd9af52e02017c (patch)
treef4d977ed220e9a3f665cfbf4f68770a81e4c2095 /cs/reader.cs
parentaaba249304b184e12e2445ab22d66df1f39a51a5 (diff)
downloadmal-b8ee29b22fbaa7a01f2754b4d6dd9af52e02017c.tar.gz
mal-b8ee29b22fbaa7a01f2754b4d6dd9af52e02017c.zip
All: add keywords.
Also, fix nth and count to match cloure.
Diffstat (limited to 'cs/reader.cs')
-rw-r--r--cs/reader.cs6
1 files changed, 4 insertions, 2 deletions
diff --git a/cs/reader.cs b/cs/reader.cs
index dbc74af..10973aa 100644
--- a/cs/reader.cs
+++ b/cs/reader.cs
@@ -53,7 +53,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 + "$");
@@ -75,7 +75,9 @@ namespace Mal {
.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);
+ return new Mal.types.MalString("\u029e" + match.Groups[7].Value);
+ } else if (match.Groups[8].Value != String.Empty) {
+ return new Mal.types.MalSymbol(match.Groups[8].Value);
} else {
throw new ParseError("unrecognized '" + match.Groups[0] + "'");
}