summaryrefslogtreecommitdiffstats
path: root/lib/tolua++/src/bin/lua
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tolua++/src/bin/lua')
-rw-r--r--lib/tolua++/src/bin/lua/container.lua21
-rw-r--r--lib/tolua++/src/bin/lua/function.lua4
2 files changed, 14 insertions, 11 deletions
diff --git a/lib/tolua++/src/bin/lua/container.lua b/lib/tolua++/src/bin/lua/container.lua
index 97e7b58fd..99488479e 100644
--- a/lib/tolua++/src/bin/lua/container.lua
+++ b/lib/tolua++/src/bin/lua/container.lua
@@ -58,7 +58,7 @@ function classContainer:hasvar ()
while self[i] do
if self[i]:isvariable() then
return 1
- end
+ end
i = i+1
end
return 0
@@ -568,7 +568,7 @@ function classContainer:doparse (s)
-- Enumerate(name,body)
-- return strsub(s,e+1)
-- end
--- end
+-- end
do
local b,e,body,name = strfind(s,"^%s*typedef%s+enum[^{]*(%b{})%s*([%w_][^%s]*)%s*;%s*")
@@ -606,15 +606,14 @@ function classContainer:doparse (s)
-- try function
do
--local b,e,decl,arg,const = strfind(s,"^%s*([~_%w][_@%w%s%*&:<>]*[_%w])%s*(%b())%s*(c?o?n?s?t?)%s*=?%s*0?%s*;%s*")
- local b,e,decl,arg,const,virt = strfind(s,"^%s*([^%(\n]+)%s*(%b())%s*(c?o?n?s?t?)%s*o?v?e?r?i?d?e?%s*(=?%s*0?)%s*;%s*")
- warning("trace" .. b .. "," .. e "," .. decl)
+ local b,e,decl,arg,const,virt = strfind(s,"^%s*([^%(\n]+)%s*(%b())%s*(c?o?n?s?t?)v?e?r?r?i?d?e?%s*o?v?e?r?r?i?d?e?%s*(=?%s*0?)%s*;%s*")
if not b then
-- try function with template
- b,e,decl,arg,const = strfind(s,"^%s*([~_%w][_@%w%s%*&:<>]*[_%w]%b<>)%s*(%b())%s*(c?o?n?s?t?)%s*o?v?e?r?i?d?e?%s*=?%s*0?%s*;%s*")
+ b,e,decl,arg,const = strfind(s,"^%s*([~_%w][_@%w%s%*&:<>]*[_%w]%b<>)%s*(%b())%s*(c?o?n?s?t?)v?e?r?r?i?d?e?%s*o?v?e?r?r?i?d?e?%s*=?%s*0?%s*;%s*")
end
if not b then
-- try a single letter function name
- b,e,decl,arg,const = strfind(s,"^%s*([_%w])%s*(%b())%s*(c?o?n?s?t?)%s*o?v?e?r?i?d?e?%s*;%s*")
+ b,e,decl,arg,const = strfind(s,"^%s*([_%w])%s*(%b())%s*(c?o?n?s?t?)v?e?r?r?i?d?e?%s*o?v?e?r?r?i?d?e?%s*;%s*")
end
if not b then
-- try function pointer
@@ -630,6 +629,9 @@ function classContainer:doparse (s)
end
end
_curr_code = strsub(s,b,e)
+ if const == 'o' then
+ const = ''
+ end
Function(decl,arg,const)
return strsub(s,e+1)
end
@@ -637,14 +639,17 @@ function classContainer:doparse (s)
-- try inline function
do
- local b,e,decl,arg,const = strfind(s,"^%s*([^%(\n]+)%s*(%b())%s*(c?o?n?s?t?)%s*o?v?e?r?i?d?e?[^;{]*%b{}%s*;?%s*")
+ local b,e,decl,arg,const = strfind(s,"^%s*([^%(\n]+)%s*(%b())%s*(c?o?n?s?t?)v?e?r?r?i?d?e?%s*o?v?e?r?r?i?d?e?[^;{]*%b{}%s*;?%s*")
--local b,e,decl,arg,const = strfind(s,"^%s*([~_%w][_@%w%s%*&:<>]*[_%w>])%s*(%b())%s*(c?o?n?s?t?)[^;]*%b{}%s*;?%s*")
if not b then
-- try a single letter function name
- b,e,decl,arg,const = strfind(s,"^%s*([_%w])%s*(%b())%s*(c?o?n?s?t?)%s*o?v?e?r?i?d?e?.-%b{}%s*;?%s*")
+ b,e,decl,arg,const = strfind(s,"^%s*([_%w])%s*(%b())%s*(c?o?n?s?t?)v?e?r?r?i?d?e?%s*o?v?e?r?r?i?d?e?.-%b{}%s*;?%s*")
end
if b then
_curr_code = strsub(s,b,e)
+ if const == 'o' then
+ const = ''
+ end
Function(decl,arg,const)
return strsub(s,e+1)
end
diff --git a/lib/tolua++/src/bin/lua/function.lua b/lib/tolua++/src/bin/lua/function.lua
index 3b6b53c5e..9338e0fbc 100644
--- a/lib/tolua++/src/bin/lua/function.lua
+++ b/lib/tolua++/src/bin/lua/function.lua
@@ -458,9 +458,8 @@ end
-- Internal constructor
function _Function (t)
setmetatable(t,classFunction)
-
if t.const ~= 'const' and t.const ~= '' then
- error("#invalid 'const' specification")
+ error("#invalid 'const' specification: " .. t.const)
end
append(t)
@@ -489,7 +488,6 @@ end
function Function (d,a,c)
--local t = split(strsub(a,2,-2),',') -- eliminate braces
--local t = split_params(strsub(a,2,-2))
-
if not flags['W'] and string.find(a, "%.%.%.%s*%)") then
warning("Functions with variable arguments (`...') are not supported. Ignoring "..d..a..c)