Changeset 2710 for code/trunk/src/tolua/lua/typedef.lua
- Timestamp:
- Feb 28, 2009, 7:46:37 PM (15 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:ignore deleted
- Property svn:mergeinfo changed
-
code/trunk/src/tolua/lua/typedef.lua
r2087 r2710 21 21 -- mod = modifiers to the 'de facto' type 22 22 classTypedef = { 23 utype = '',24 mod = '',25 type = ''23 utype = '', 24 mod = '', 25 type = '' 26 26 } 27 27 classTypedef.__index = classTypedef … … 29 29 -- Print method 30 30 function classTypedef:print (ident,close) 31 print(ident.."Typedef{")32 print(ident.." utype = '"..self.utype.."',")33 print(ident.." mod = '"..self.mod.."',")34 print(ident.." type = '"..self.type.."',")35 print(ident.."}"..close)31 print(ident.."Typedef{") 32 print(ident.." utype = '"..self.utype.."',") 33 print(ident.." mod = '"..self.mod.."',") 34 print(ident.." type = '"..self.type.."',") 35 print(ident.."}"..close) 36 36 end 37 37 38 38 -- Return it's not a variable 39 39 function classTypedef:isvariable () 40 return false40 return false 41 41 end 42 42 43 43 -- Internal constructor 44 44 function _Typedef (t) 45 setmetatable(t,classTypedef)46 t.type = resolve_template_types(t.type)47 appendtypedef(t)48 return t45 setmetatable(t,classTypedef) 46 t.type = resolve_template_types(t.type) 47 appendtypedef(t) 48 return t 49 49 end 50 50 … … 52 52 -- Expects one string representing the type definition. 53 53 function Typedef (s) 54 if strfind(string.gsub(s, '%b<>', ''),'[%*&]') then55 tolua_error("#invalid typedef: pointers (and references) are not supported")56 end57 local o = {mod = ''}58 if string.find(s, "[<>]") then59 60 else61 62 63 64 65 66 67 end68 return _Typedef(o)54 if strfind(string.gsub(s, '%b<>', ''),'[%*&]') then 55 tolua_error("#invalid typedef: pointers (and references) are not supported") 56 end 57 local o = {mod = ''} 58 if string.find(s, "[<>]") then 59 _,_,o.type,o.utype = string.find(s, "^%s*([^<>]+%b<>[^%s]*)%s+(.-)$") 60 else 61 local t = split(gsub(s,"%s%s*"," ")," ") 62 o = { 63 utype = t[t.n], 64 type = t[t.n-1], 65 mod = concat(t,1,t.n-2), 66 } 67 end 68 return _Typedef(o) 69 69 end 70 70
Note: See TracChangeset
for help on using the changeset viewer.