cortav  Check-in [709518a06e]

Overview
Comment:error improvements, sirsem bug fix
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 709518a06e109715aed36ad7bdbff4a6ae7b8878ae62278a27e9e69bc04213ff
User & Date: lexi on 2021-12-20 00:14:03
Other Links: manifest | tags
Context
2021-12-20
00:40
tweak headers check-in: bdd8d569a9 user: lexi tags: trunk
00:14
error improvements, sirsem bug fix check-in: 709518a06e user: lexi tags: trunk
00:09
split cortav into modules, enable use as library, create extension mechanism stub, fix up docs check-in: 9c67b0312c user: lexi tags: trunk
Changes

Modified cortav.lua from [2576638f1f] to [e2f30c819c].

806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
		{seq = '##', parse = insert_var_ref(true)};
		{seq = '#', parse = insert_var_ref(false)};
	}
end

function ct.parse_span(str,ctx)
	local function delimited(start, stop, s)
		-- local r = { pcall(ss.str.delimit, 'utf8', start, stop, s) }
		-- if r[1] then return table.unpack(r, 2) end
		-- ctx:fail(tostring(e))
		return ss.str.delimit(ss.str.enc.utf8, start, stop, s)
	end
	local buf = ""
	local spans = {}
	local function flush()
		if buf ~= "" then
			table.insert(spans, buf)
			buf = ""







|
|
|
<







806
807
808
809
810
811
812
813
814
815

816
817
818
819
820
821
822
		{seq = '##', parse = insert_var_ref(true)};
		{seq = '#', parse = insert_var_ref(false)};
	}
end

function ct.parse_span(str,ctx)
	local function delimited(start, stop, s)
		local r = { pcall(ss.str.delimit, nil, start, stop, s) }
		if r[1] then return table.unpack(r, 2) end
		ctx:fail(tostring(r[2]))

	end
	local buf = ""
	local spans = {}
	local function flush()
		if buf ~= "" then
			table.insert(spans, buf)
			buf = ""

Modified sirsem.lua from [2492fec6e5] to [a1f6282434].

261
262
263
264
265
266
267
268
269
270
271
272
273
274
		elseif c == start then
			depth = depth + 1
		elseif c == stop then
			depth = depth - 1
			if depth == 0 then
				return s:sub(1+#start, p.byte - #stop), p.byte -- FIXME
			elseif depth < 0 then
				ss.str.exn('out of place %s', stop):throw()
			end
		end
	end

	ss.str.exn('[%s] expected before end of line', stop):throw()
end







|




|

261
262
263
264
265
266
267
268
269
270
271
272
273
274
		elseif c == start then
			depth = depth + 1
		elseif c == stop then
			depth = depth - 1
			if depth == 0 then
				return s:sub(1+#start, p.byte - #stop), p.byte -- FIXME
			elseif depth < 0 then
				ss.str.exn('out of place token ā€œ%sā€', stop):throw()
			end
		end
	end

	ss.str.exn('token ā€œ%sā€ expected before end of line', stop):throw()
end