From 42aecee642b36aeb0b0aec15cfbc6b0007ca7b24 Mon Sep 17 00:00:00 2001 From: Joel Martin Date: Tue, 26 Sep 2017 12:12:15 -0500 Subject: [PATCH] Fix unescaping in cs, hy, nim, objpascal, ps, rpython, vb --- cs/reader.cs | 7 ++++--- hy/reader.hy | 7 ++++--- nim/Dockerfile | 6 +++--- nim/reader.nim | 2 +- objpascal/reader.pas | 7 ++++--- ps/reader.ps | Bin 8867 -> 8895 bytes rpython/reader.py | 6 +++--- vb/reader.vb | 7 ++++--- 8 files changed, 23 insertions(+), 19 deletions(-) diff --git a/cs/reader.cs b/cs/reader.cs index a644309a8a..60798e37bf 100644 --- a/cs/reader.cs +++ b/cs/reader.cs @@ -71,9 +71,10 @@ public static MalVal read_atom(Reader rdr) { } else if (match.Groups[6].Value != String.Empty) { string str = match.Groups[6].Value; str = str.Substring(1, str.Length-2) - .Replace("\\\"", "\"") - .Replace("\\n", "\n") - .Replace("\\\\", "\\"); + .Replace("\\\\", "\u029e") + .Replace("\\\"", "\"") + .Replace("\\n", "\n") + .Replace("\u029e", "\\"); return new Mal.types.MalString(str); } else if (match.Groups[7].Value != String.Empty) { return new Mal.types.MalString("\u029e" + match.Groups[7].Value); diff --git a/hy/reader.hy b/hy/reader.hy index 41abec29d3..4c9bd1d525 100644 --- a/hy/reader.hy +++ b/hy/reader.hy @@ -25,9 +25,10 @@ (!= (get t 0) ";"))) (defn unescape [s] - (-> s (.replace "\\\"" "\"") - (.replace "\\n" "\n") - (.replace "\\\\" "\\"))) + (-> s (.replace "\\\\" "\u029e") + (.replace "\\\"" "\"") + (.replace "\\n" "\n") + (.replace "\u029e" "\\"))) (defn read-atom [rdr] (setv token (.next rdr)) diff --git a/nim/Dockerfile b/nim/Dockerfile index 9744753e93..1ffef105b5 100644 --- a/nim/Dockerfile +++ b/nim/Dockerfile @@ -26,10 +26,10 @@ RUN apt-get -y install g++ # Nim RUN apt-get -y install xz-utils -RUN cd /tmp && curl -O http://nim-lang.org/download/nim-0.17.0.tar.xz \ - && tar xvJf /tmp/nim-0.17.0.tar.xz && cd nim-0.17.0 \ +RUN cd /tmp && curl -O https://nim-lang.org/download/nim-0.17.2.tar.xz \ + && tar xvJf /tmp/nim-0.17.2.tar.xz && cd nim-0.17.2 \ && make && sh install.sh /usr/local/bin \ && cp bin/nim /usr/local/bin/ \ - && rm -r /tmp/nim-0.17.0 + && rm -r /tmp/nim-0.17.2 ENV HOME /mal diff --git a/nim/reader.nim b/nim/reader.nim index 4df8c9c5b6..6bc2997fee 100644 --- a/nim/reader.nim +++ b/nim/reader.nim @@ -61,7 +61,7 @@ proc read_hash_map(r: var Reader): MalType = proc read_atom(r: var Reader): MalType = let t = r.next if t.match(intRE): number t.parseInt - elif t[0] == '"': str t[1 .. '' then begin Str := copy(Token, 2, Length(Token)-2); - Str := StringReplace(Str, '\"', '"', [rfReplaceAll]); - Str := StringReplace(Str, '\n', #10, [rfReplaceAll]); - Str := StringReplace(Str, '\\', '\', [rfReplaceAll]); + Str := StringReplace(Str, '\\', #127, [rfReplaceAll]); + Str := StringReplace(Str, '\"', '"', [rfReplaceAll]); + Str := StringReplace(Str, '\n', #10, [rfReplaceAll]); + Str := StringReplace(Str, #127, '\', [rfReplaceAll]); read_atom := TMalString.Create(Str) end else if RE.Match[7] <> '' then diff --git a/ps/reader.ps b/ps/reader.ps index 3574242f0ecce270e028a6e3c1a03f298f05d28f..c5e19bf15848f0b6fcf9e542c0f241f52ccb5377 100644 GIT binary patch delta 88 zcmZ4Ny5DufL~iex7)=F@7(;V&O@*S=f}F(UR4xS|(1?jq(gadK0!=s%Bpd@IQN@8K KY(BvKSPTGL<`}I2 delta 42 vcmdn*y4ZEYL~bS}&B^Py#l String.Empty Then return New Mal.types.MalString(ChrW(&H029e) & match.Groups(7).Value) Else If match.Groups(8).Value <> String.Empty Then