parsav  Diff

Differences From Artifact [c5ea2451a4]:

To Artifact [5af1afba76]:


     1      1   -- vim: ft=terra
     2      2   -- string.t: string classes
     3         -local util = dofile('common.lua')
            3  +local util = lib.util
     4      4   local pstr = lib.mem.ptr(int8)
     5      5   local pref = lib.mem.ref(int8)
     6      6   
     7      7   local m = {
     8      8   	sz = terralib.externfunction('strlen', rawstring -> intptr);
     9      9   	cmp = terralib.externfunction('strcmp', {rawstring, rawstring} -> int);
    10     10   	ncmp = terralib.externfunction('strncmp', {rawstring, rawstring, intptr} -> int);
................................................................................
   174    174   		return `[lib.mem.ptr(int8)] {ptr = nil, ct = 0}
   175    175   	end
   176    176   end)
   177    177   
   178    178   m.acc.methods.lpush = macro(function(self,str)
   179    179   	return `self:push([str:asvalue()], [#(str:asvalue())]) end)
   180    180   m.acc.methods.ppush = terra(self: &m.acc, str: lib.mem.ptr(int8))
          181  +	self:push(str.ptr, str.ct)            return self end;
          182  +m.acc.methods.rpush = terra(self: &m.acc, str: lib.mem.ref(int8))
   181    183   	self:push(str.ptr, str.ct)            return self end;
   182    184   m.acc.methods.merge = terra(self: &m.acc, str: lib.mem.ptr(int8))
   183    185   	self:push(str.ptr, str.ct) str:free() return self end;
   184    186   m.acc.methods.compose = macro(function(self, ...)
   185    187   	local minlen = 0
   186    188   	local pstrs = {}
   187    189   	for i,v in ipairs{...} do