parsav  Diff

Differences From Artifact [b153c48352]:

To Artifact [f930d7a874]:


34
35
36
37
38
39
40

41
42


43

44
45

46
47
48
49
50
51
52
53
54
55
...
114
115
116
117
118
119
120
121



122
123
124
125
126
127
128
	str = str:gsub('%s+[\n$]','')
	str = str:gsub('\n','')
	str = str:gsub('</a><a ','</a> <a ') -- keep nav links from getting smooshed
	str = str:gsub(tplchar .. '%?([-%w]+)', function(file)
		if not docs[file] then docs[file] = data.doc[file] end
		return string.format('<a href="#help-%s" class="help">?</a>', file)
	end)

	for start, mode, key, stop in string.gmatch(str,'()'..tplchar..'([+:!$#%^]?)([-a-zA-Z0-9_]+):?()') do
		if string.sub(str,start-1,start-1) ~= '\\' then


			segs[#segs+1] = string.sub(str,last,start-1)

			fields[#segs] = { key = key:gsub('-','_'), mode = (mode ~= '' and mode or nil) }
			last = stop

		end
	end
	segs[#segs+1] = string.sub(str,last)

	for i, s in ipairs(segs) do
		segs[i] = string.gsub(s, '\\'..tplchar, tplchar_o)
		constlen = constlen + string.len(segs[i])
	end

	for n,d in pairs(docs) do
................................................................................
		senders[#senders+1] = quote lib.net.mg_send([destcon], [seg], [#seg]) end
		appenders[#appenders+1] = quote [accumulator]:push([seg], [#seg]) end
		if fields[idx] and fields[idx].mode then
			local f = fields[idx]
			local fp = `symself.[f.key]
			local sanexp
			local nulexp
			if f.mode == '$' then sanexp = `lib.str.qesc(pool, fp, true)



			elseif f.mode == '+' then sanexp = `lib.str.qesc(pool, fp, false)
			elseif f.mode == '#' then
				sanexp = quote
					var ibuf: int8[21]
					var ptr = lib.math.decstr(fp, &ibuf[20])
				in pstr {ptr=ptr, ct=&ibuf[20] - ptr} end
			elseif f.mode == '^' then







>


>
>
|
>


>


|







 







|
>
>
>







34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
...
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
	str = str:gsub('%s+[\n$]','')
	str = str:gsub('\n','')
	str = str:gsub('</a><a ','</a> <a ') -- keep nav links from getting smooshed
	str = str:gsub(tplchar .. '%?([-%w]+)', function(file)
		if not docs[file] then docs[file] = data.doc[file] end
		return string.format('<a href="#help-%s" class="help">?</a>', file)
	end)
	local detritus = ""
	for start, mode, key, stop in string.gmatch(str,'()'..tplchar..'([+:!$#%^]?)([-a-zA-Z0-9_]+):?()') do
		if string.sub(str,start-1,start-1) ~= '\\' then
			local suffix = ""
			if mode == '$' then suffix = '"' end
			segs[#segs+1] = detritus .. string.sub(str,last,start-1) .. suffix
			detritus = ''
			fields[#segs] = { key = key:gsub('-','_'), mode = (mode ~= '' and mode or nil) }
			last = stop
			if mode == '$' then detritus = '"' end
		end
	end
	segs[#segs+1] = detritus .. string.sub(str,last)

	for i, s in ipairs(segs) do
		segs[i] = string.gsub(s, '\\'..tplchar, tplchar_o)
		constlen = constlen + string.len(segs[i])
	end

	for n,d in pairs(docs) do
................................................................................
		senders[#senders+1] = quote lib.net.mg_send([destcon], [seg], [#seg]) end
		appenders[#appenders+1] = quote [accumulator]:push([seg], [#seg]) end
		if fields[idx] and fields[idx].mode then
			local f = fields[idx]
			local fp = `symself.[f.key]
			local sanexp
			local nulexp
			if f.mode == '$' then sanexp = `lib.str.qesc(pool, fp, false)
				-- we use the detritus mechanism rather than the quote-wrap mechanism bc, apart
				-- from being faster, 0-length strings cannot be sanitized into -- >0-length
				-- strings due to how nullity is indicated (to wit, if fp == 0, ptr can be wild)
			elseif f.mode == '+' then sanexp = `lib.str.qesc(pool, fp, false)
			elseif f.mode == '#' then
				sanexp = quote
					var ibuf: int8[21]
					var ptr = lib.math.decstr(fp, &ibuf[20])
				in pstr {ptr=ptr, ct=&ibuf[20] - ptr} end
			elseif f.mode == '^' then