diff --git a/bin/reader.js b/bin/reader.js index b98c64e..b055a3e 100644 --- a/bin/reader.js +++ b/bin/reader.js @@ -124,6 +124,9 @@ read_table[""] = function (s) { while (true) { var __c3 = peek_char(s); if (__c3 && (! whitespace[__c3] && ! delimiters[__c3])) { + if (__c3 === "\\") { + __str = __str + read_char(s); + } __str = __str + read_char(s); } else { break; diff --git a/bin/reader.lua b/bin/reader.lua index 6ccf399..ca2a6bf 100644 --- a/bin/reader.lua +++ b/bin/reader.lua @@ -124,6 +124,9 @@ read_table[""] = function (s) while true do local __c3 = peek_char(s) if __c3 and (not whitespace[__c3] and not delimiters[__c3]) then + if __c3 == "\\" then + __str = __str .. read_char(s) + end __str = __str .. read_char(s) else break diff --git a/reader.l b/reader.l index 9deb5d1..68240e8 100644 --- a/reader.l +++ b/reader.l @@ -87,7 +87,9 @@ (let c (peek-char s) (if (and c (and (not (get whitespace c)) (not (get delimiters c)))) - (cat! str (read-char s)) + (do (when (= c "\\") + (cat! str (read-char s))) + (cat! str (read-char s))) (break)))) (if (= str "true") true (= str "false") false diff --git a/test.l b/test.l index 30a6d0b..c1c5aed 100755 --- a/test.l +++ b/test.l @@ -61,7 +61,9 @@ (test= 1 (- -1)) (test= "0?" (read "0?")) (test= "0!" (read "0!")) - (test= "0." (read "0.")))) + (test= "0." (read "0.")) + (test= "#\\;" (read "#\\;")) + (test= "?\\(" (read "?\\(")))) (define-test read-more (let read (get reader 'read-string)