diff options
author | Alexander Harkness <bearbin@gmail.com> | 2013-11-24 15:29:35 +0100 |
---|---|---|
committer | Alexander Harkness <bearbin@gmail.com> | 2013-11-24 15:29:35 +0100 |
commit | 998fb17fdc150bc9c6b3d8da0dd37dfd1ae7b39a (patch) | |
tree | 51c901fdd30ce632107cd69b3df3b107f4cbb6a5 /tolua++-1.0.93/src/bin/lua/template_class.lua | |
parent | Moved zlib (diff) | |
download | cuberite-998fb17fdc150bc9c6b3d8da0dd37dfd1ae7b39a.tar cuberite-998fb17fdc150bc9c6b3d8da0dd37dfd1ae7b39a.tar.gz cuberite-998fb17fdc150bc9c6b3d8da0dd37dfd1ae7b39a.tar.bz2 cuberite-998fb17fdc150bc9c6b3d8da0dd37dfd1ae7b39a.tar.lz cuberite-998fb17fdc150bc9c6b3d8da0dd37dfd1ae7b39a.tar.xz cuberite-998fb17fdc150bc9c6b3d8da0dd37dfd1ae7b39a.tar.zst cuberite-998fb17fdc150bc9c6b3d8da0dd37dfd1ae7b39a.zip |
Diffstat (limited to 'tolua++-1.0.93/src/bin/lua/template_class.lua')
-rw-r--r-- | tolua++-1.0.93/src/bin/lua/template_class.lua | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/tolua++-1.0.93/src/bin/lua/template_class.lua b/tolua++-1.0.93/src/bin/lua/template_class.lua deleted file mode 100644 index b1ed05abe..000000000 --- a/tolua++-1.0.93/src/bin/lua/template_class.lua +++ /dev/null @@ -1,82 +0,0 @@ - -_global_templates = {} - -classTemplateClass = { - - name = '', - body = '', - parents = {}, - args = {}, -- the template arguments -} - -classTemplateClass.__index = classTemplateClass - - -function classTemplateClass:throw(types, local_scope) - - --if table.getn(types) ~= table.getn(self.args) then - -- error("#invalid parameter count") - --end - - -- replace - for i =1 , types.n do - - local Il = split_c_tokens(types[i], " ") - if table.getn(Il) ~= table.getn(self.args) then - error("#invalid parameter count for "..types[i]) - end - local bI = self.body - local pI = {} - for j = 1,self.args.n do - --Tl[j] = findtype(Tl[j]) or Tl[j] - bI = string.gsub(bI, "([^_%w])"..self.args[j].."([^_%w])", "%1"..Il[j].."%2") - if self.parents then - for i=1,table.getn(self.parents) do - pI[i] = string.gsub(self.parents[i], "([^_%w]?)"..self.args[j].."([^_%w]?)", "%1"..Il[j].."%2") - end - end - end - --local append = "<"..string.gsub(types[i], "%s+", ",")..">" - local append = "<"..concat(Il, 1, table.getn(Il), ",")..">" - append = string.gsub(append, "%s*,%s*", ",") - append = string.gsub(append, ">>", "> >") - for i=1,table.getn(pI) do - --pI[i] = string.gsub(pI[i], ">>", "> >") - pI[i] = resolve_template_types(pI[i]) - end - bI = string.gsub(bI, ">>", "> >") - local n = self.name - if local_scope then - n = self.local_name - end - - Class(n..append, pI, bI) - end -end - - -function TemplateClass(name, parents, body, parameters) - - local o = { - - parents = parents, - body = body, - args = parameters, - } - - local oname = string.gsub(name, "@.*$", "") - oname = getnamespace(classContainer.curr)..oname - o.name = oname - - o.local_name = name - - setmetatable(o, classTemplateClass) - - if _global_templates[oname] then - warning("Duplicate declaration of template "..oname) - else - _global_templates[oname] = o - end - - return o -end |