aboutsummaryrefslogtreecommitdiff
path: root/ps/reader.ps
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2014-04-06 15:53:19 -0500
committerJoel Martin <github@martintribe.org>2014-04-06 15:53:19 -0500
commite7c1a2f62bbb1616f481e66c5b1aea1824053615 (patch)
treeac2d6daf14e11a458a7acd4baddcbe9190a04132 /ps/reader.ps
parent5ce65382cf4bdece30e9dee3f7765b698bd375e9 (diff)
downloadmal-e7c1a2f62bbb1616f481e66c5b1aea1824053615.tar.gz
mal-e7c1a2f62bbb1616f481e66c5b1aea1824053615.zip
PS: fix string escaping. Passes all tests.
Diffstat (limited to 'ps/reader.ps')
-rw-r--r--ps/reader.ps7
1 files changed, 7 insertions, 0 deletions
diff --git a/ps/reader.ps b/ps/reader.ps
index bdc4580..430f0c9 100644
--- a/ps/reader.ps
+++ b/ps/reader.ps
@@ -68,10 +68,17 @@
} if
/ch str idx get def % current character
/idx idx 1 add def
+ ch 92 eq { % if \
+ str idx get 34 eq { %if \"
+ /idx idx 1 add def
+ /cnt cnt 1 add def % 1 more below
+ } if
+ } if
ch 34 eq { exit } if % '"' is end of string
/cnt cnt 1 add def
} loop
str start cnt getinterval % the matched string
+ (\\") (") replace
str idx % return: new_string string new_idx
} def