Software /
code /
prosody
Comparison
tools/ejabberdsql2prosody.lua @ 1599:308986a3e66a
ejabberdsql2prosody: Added support for all mysql escape sequences
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Sun, 26 Jul 2009 17:51:36 +0500 |
parent | 1598:d82e13d57821 |
child | 1600:cd9790f42269 |
comparison
equal
deleted
inserted
replaced
1598:d82e13d57821 | 1599:308986a3e66a |
---|---|
34 local function peek() | 34 local function peek() |
35 if not last then last = read(); end | 35 if not last then last = read(); end |
36 return last; | 36 return last; |
37 end | 37 end |
38 | 38 |
39 local escapes = { | |
40 ["\\0"] = "\0"; | |
41 ["\\'"] = "'"; | |
42 ["\\\""] = "\""; | |
43 ["\\b"] = "\b"; | |
44 ["\\n"] = "\n"; | |
45 ["\\r"] = "\r"; | |
46 ["\\t"] = "\t"; | |
47 ["\\Z"] = "\26"; | |
48 ["\\\\"] = "\\"; | |
49 ["\\%"] = "%"; | |
50 ["\\_"] = "_"; | |
51 } | |
39 local function unescape(s) | 52 local function unescape(s) |
40 if s == "\\'" then return "'"; end | 53 return escapes[s] or error("Unknown escape sequence: "..s); |
41 if s == "\\n" then return "\n"; end | |
42 if s == "\\\\" then return "\\"; end | |
43 error("Unknown escape sequence: "..s); | |
44 end | 54 end |
45 local function readString() | 55 local function readString() |
46 read("'"); | 56 read("'"); |
47 local s = ""; | 57 local s = ""; |
48 while true do | 58 while true do |