aboutsummaryrefslogtreecommitdiff
path: root/perl/reader.pm
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2014-04-20 23:45:58 -0500
committerJoel Martin <github@martintribe.org>2014-04-20 23:45:58 -0500
commita5a6605877c98a37696a30d310a29f4d1fc230e9 (patch)
tree3342f8aea7150c60bf222d428ab00a8e0bfdf8e5 /perl/reader.pm
parentb69553214509c606f22a984172a190d8122e70c0 (diff)
downloadmal-a5a6605877c98a37696a30d310a29f4d1fc230e9.tar.gz
mal-a5a6605877c98a37696a30d310a29f4d1fc230e9.zip
Perl: add step4_if_fn_do
- Move string/printing tests to the bottom of tests/step4_if_fn_do
Diffstat (limited to 'perl/reader.pm')
-rw-r--r--perl/reader.pm7
1 files changed, 6 insertions, 1 deletions
diff --git a/perl/reader.pm b/perl/reader.pm
index ecbf522..35af099 100644
--- a/perl/reader.pm
+++ b/perl/reader.pm
@@ -30,7 +30,12 @@ sub read_atom {
my $token = $rdr->next();
given ($token) {
when(/^-?[0-9]+$/) { return Integer->new($token) }
- when(/^"/) { return String->new(substr $token, 1, -1) }
+ when(/^"/) {
+ my $str = substr $token, 1, -1;
+ $str =~ s/\\"/"/g;
+ $str =~ s/\\n/\n/g;
+ return String->new($str)
+ }
when(/^nil$/) { return $nil }
when(/^true$/) { return $true }
when(/^false$/) { return $false }