diff --git a/.gitignore b/.gitignore index 9bea433..feff165 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,16 @@ +# LuaRocks # +###################### +lib/ +share/ +bin/ +# OS generated files # +###################### .DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +Icon? +ehthumbs.db +Thumbs.db \ No newline at end of file diff --git a/ElementNode.lua b/ElementNode.lua index 0acd32b..4d8fc3c 100644 --- a/ElementNode.lua +++ b/ElementNode.lua @@ -1,4 +1,5 @@ -local Set = require "Set" +require("luarocks.loader") +local Set = require("Set") local ElementNode = {} ElementNode.mt = {__index = ElementNode} diff --git a/Set.lua b/Set.lua deleted file mode 100644 index 104e31f..0000000 --- a/Set.lua +++ /dev/null @@ -1,87 +0,0 @@ -local Set = {} -Set.mt = {__index = Set} -function Set:new(t) - local instance = {} - if type(t) == "table" then - if #t > 0 then - for _,v in ipairs(t) do - instance[v] = true - end - else - for k in pairs(t) do - instance[k] = true - end - end - else - instance = {t} - end - return setmetatable(instance, Set.mt) -end - -function Set:add(e) - self[e] = true -end - -function Set:remove(e) - self[e] = nil -end - --- Union -Set.mt.__add = function (a, b) - local res = Set:new() - if getmetatable(a) ~= Set.mt then a = Set:new(a) end - if getmetatable(b) ~= Set.mt then b = Set:new(b) end - for k in pairs(a) do res[k] = true end - for k in pairs(b) do res[k] = true end - return res -end - --- Subtraction -Set.mt.__sub = function (a, b) - local res = Set:new() - if getmetatable(a) ~= Set.mt then a = Set:new(a) end - if getmetatable(b) ~= Set.mt then b = Set:new(b) end - for k in pairs(a) do res[k] = true end - for k in pairs(b) do res[k] = nil end - return res -end - --- Intersection -Set.mt.__mul = function (a, b) - local res = Set:new() - if getmetatable(a) ~= Set.mt then a = Set:new(a) end - if getmetatable(b) ~= Set.mt then b = Set:new(b) end - for k in pairs(a) do - res[k] = b[k] - end - return res -end - --- String representation -Set.mt.__tostring = function (set) - local s = "{" - local sep = "" - for k in pairs(set) do - s = s .. sep .. k - sep = ", " - end - return s .. "}" -end - -function Set:len() - local num = 0 - for _ in pairs(self) do - num = num + 1 - end - return num -end - -function Set:tolist() - local res = {} - for k in pairs(self) do - table.insert(res, k) - end - return res -end - -return Set \ No newline at end of file diff --git a/LICENSE b/doc/LICENSE similarity index 100% rename from LICENSE rename to doc/LICENSE diff --git a/doc/README.html b/doc/README.html new file mode 100644 index 0000000..59f7df1 --- /dev/null +++ b/doc/README.html @@ -0,0 +1,14 @@ + + +
+You are being redirected to the homepage of the + Htmlparser LuaRock. +
+If you are not redirected after a few seconds, please click on the link above!
+ + \ No newline at end of file