Changeset 2509 for code/branches/buildsystem2/src/tolua/lua/verbatim.lua
- Timestamp:
- Dec 17, 2008, 8:59:48 PM (16 years ago)
- Location:
- code/branches/buildsystem2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/buildsystem2
- Property svn:ignore deleted
- Property svn:mergeinfo changed
/code/branches/buildsystem (added) merged: 1875,1882-1886,1975-1982,1991,1999,2054,2061,2135,2137-2139,2197-2199,2204,2214-2220,2223-2224,2229,2233-2244,2248-2249,2252-2253,2260,2275
-
code/branches/buildsystem2/src/tolua/lua/verbatim.lua
r2087 r2509 17 17 -- line = line text 18 18 classVerbatim = { 19 line = '',20 19 line = '', 20 cond = nil, -- condition: where to generate the code (s=suport, r=register) 21 21 } 22 22 classVerbatim.__index = classVerbatim … … 25 25 -- preamble verbatim 26 26 function classVerbatim:preamble () 27 if self.cond == '' then28 write(self.line)29 end27 if self.cond == '' then 28 write(self.line) 29 end 30 30 end 31 31 32 32 -- support code 33 33 function classVerbatim:supcode () 34 if strfind(self.cond,'s') then35 write(self.line)36 write('\n')37 end34 if strfind(self.cond,'s') then 35 write(self.line) 36 write('\n') 37 end 38 38 end 39 39 40 40 -- register code 41 41 function classVerbatim:register (pre) 42 if strfind(self.cond,'r') then43 write(self.line)44 end42 if strfind(self.cond,'r') then 43 write(self.line) 44 end 45 45 end 46 46 … … 48 48 -- Print method 49 49 function classVerbatim:print (ident,close) 50 print(ident.."Verbatim{")51 print(ident.." line = '"..self.line.."',")52 print(ident.."}"..close)53 end50 print(ident.."Verbatim{") 51 print(ident.." line = '"..self.line.."',") 52 print(ident.."}"..close) 53 end 54 54 55 55 56 56 -- Internal constructor 57 57 function _Verbatim (t) 58 setmetatable(t,classVerbatim)59 append(t)60 return t58 setmetatable(t,classVerbatim) 59 append(t) 60 return t 61 61 end 62 62 … … 64 64 -- Expects a string representing the text line 65 65 function Verbatim (l,cond) 66 if strsub(l,1,1) == "'" then67 l = strsub(l,2)68 elseif strsub(l,1,1) == '$' then69 cond = 'sr' -- generates in both suport and register fragments70 l = strsub(l,2)71 end72 return _Verbatim {73 line = l,74 cond = cond or '',75 }66 if strsub(l,1,1) == "'" then 67 l = strsub(l,2) 68 elseif strsub(l,1,1) == '$' then 69 cond = 'sr' -- generates in both suport and register fragments 70 l = strsub(l,2) 71 end 72 return _Verbatim { 73 line = l, 74 cond = cond or '', 75 } 76 76 end 77 77
Note: See TracChangeset
for help on using the changeset viewer.