Sat, 06 Dec 2008 23:11:21 +0000
Some code cleaning for the main script
519
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
489
diff
changeset
|
1 | -- Prosody IM v0.1 |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
489
diff
changeset
|
2 | -- Copyright (C) 2008 Matthew Wild |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
489
diff
changeset
|
3 | -- Copyright (C) 2008 Waqas Hussain |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
489
diff
changeset
|
4 | -- |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
489
diff
changeset
|
5 | -- This program is free software; you can redistribute it and/or |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
489
diff
changeset
|
6 | -- modify it under the terms of the GNU General Public License |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
489
diff
changeset
|
7 | -- as published by the Free Software Foundation; either version 2 |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
489
diff
changeset
|
8 | -- of the License, or (at your option) any later version. |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
489
diff
changeset
|
9 | -- |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
489
diff
changeset
|
10 | -- This program is distributed in the hope that it will be useful, |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
489
diff
changeset
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
489
diff
changeset
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
489
diff
changeset
|
13 | -- GNU General Public License for more details. |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
489
diff
changeset
|
14 | -- |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
489
diff
changeset
|
15 | -- You should have received a copy of the GNU General Public License |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
489
diff
changeset
|
16 | -- along with this program; if not, write to the Free Software |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
489
diff
changeset
|
17 | -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
489
diff
changeset
|
18 | -- |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
489
diff
changeset
|
19 | |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
489
diff
changeset
|
20 | |
482
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
21 | |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
22 | local file = nil; |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
23 | local last = nil; |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
24 | local function read(expected) |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
25 | local ch; |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
26 | if last then |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
27 | ch = last; last = nil; |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
28 | else ch = file:read(1); end |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
29 | if expected and ch ~= expected then error("expected: "..expected.."; got: "..(ch or "nil")); end |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
30 | return ch; |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
31 | end |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
32 | local function pushback(ch) |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
33 | if last then error(); end |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
34 | last = ch; |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
35 | end |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
36 | local function peek() |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
37 | if not last then last = read(); end |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
38 | return last; |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
39 | end |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
40 | |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
41 | local _A, _a, _Z, _z, _0, _9, __, _space = string.byte("AaZz09_ ", 1, 8); |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
42 | local function isAlpha(ch) |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
43 | ch = string.byte(ch) or 0; |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
44 | return (ch >= _A and ch <= _Z) or (ch >= _a and ch <= _z); |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
45 | end |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
46 | local function isNumeric(ch) |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
47 | ch = string.byte(ch) or 0; |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
48 | return (ch >= _0 and ch <= _9); |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
49 | end |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
50 | local function isVar(ch) |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
51 | ch = string.byte(ch) or 0; |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
52 | return (ch >= _A and ch <= _Z) or (ch >= _a and ch <= _z) or (ch >= _0 and ch <= _9) or ch == __; |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
53 | end |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
54 | local function isSpace(ch) |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
55 | ch = string.byte(ch) or "x"; |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
56 | return ch <= _space; |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
57 | end |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
58 | |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
59 | local function readString() |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
60 | read("\""); -- skip quote |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
61 | local slash = nil; |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
62 | local str = ""; |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
63 | while true do |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
64 | local ch = read(); |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
65 | if ch == "\"" and not slash then break; end |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
66 | str = str..ch; |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
67 | end |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
68 | str = str:gsub("\\.", {["\\b"]="\b", ["\\d"]="\d", ["\\e"]="\e", ["\\f"]="\f", ["\\n"]="\n", ["\\r"]="\r", ["\\s"]="\s", ["\\t"]="\t", ["\\v"]="\v", ["\\\""]="\"", ["\\'"]="'", ["\\\\"]="\\"}); |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
69 | return str; |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
70 | end |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
71 | local function readSpecialString() |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
72 | read("<"); read("<"); -- read << |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
73 | local str = ""; |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
74 | if peek() == "\"" then |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
75 | local str = readString(); |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
76 | elseif peek() ~= ">" then |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
77 | error(); |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
78 | end |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
79 | read(">"); read(">"); -- read >> |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
80 | return str; |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
81 | end |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
82 | local function readVar() |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
83 | local var = read(); |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
84 | while isVar(peek()) do |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
85 | var = var..read(); |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
86 | end |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
87 | return var; |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
88 | end |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
89 | local function readNumber() |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
90 | local num = read(); |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
91 | while isNumeric(peek()) do |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
92 | num = num..read(); |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
93 | end |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
94 | return tonumber(num); |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
95 | end |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
96 | local readItem = nil; |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
97 | local function readTuple() |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
98 | local t = {}; |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
99 | read(); -- read { or [ |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
100 | while true do |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
101 | local item = readItem(); |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
102 | if not item then break; end |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
103 | table.insert(t, item); |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
104 | end |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
105 | read(); -- read } or ] |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
106 | return t; |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
107 | end |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
108 | readItem = function() |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
109 | local ch = peek(); |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
110 | if ch == nil then return nil end |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
111 | if ch == "{" or ch == "[" then |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
112 | return readTuple(); |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
113 | elseif isAlpha(ch) then |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
114 | return readVar(); |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
115 | elseif isNumeric(ch) then |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
116 | return readNumber(); |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
117 | elseif ch == "\"" then |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
118 | return readString(); |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
119 | elseif ch == "<" then |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
120 | return readSpecialString(); |
489
237cddb1a785
Fixed the ejabberd importer to work with the pipe sign "|" as a separator in erlang lists
Waqas Hussain <waqas20@gmail.com>
parents:
482
diff
changeset
|
121 | elseif isSpace(ch) or ch == "," or ch == "|" then |
482
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
122 | read(); |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
123 | return readItem(); |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
124 | else |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
125 | --print("Unknown char: "..ch); |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
126 | return nil; |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
127 | end |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
128 | end |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
129 | local function readChunk() |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
130 | local x = readItem(); |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
131 | if x then read("."); end |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
132 | return x; |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
133 | end |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
134 | local function readFile(filename) |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
135 | file = io.open(filename); |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
136 | if not file then error("File not found: "..filename); os.exit(0); end |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
137 | return function() |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
138 | local x = readChunk(); |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
139 | if not x and peek() then error("Invalid char: "..peek()); end |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
140 | return x; |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
141 | end; |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
142 | end |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
143 | |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
144 | module "erlparse" |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
145 | |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
146 | function parseFile(file) |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
147 | return readFile(file); |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
148 | end |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
149 | |
b86082df0bc0
ejabberd db dump importer for Prosody
Waqas Hussain <waqas20@gmail.com>
parents:
diff
changeset
|
150 | return _M; |