Property definitions

sexp $ SExpProcessor :: defaultinit
# S-Expression processor
class SExpProcessor
	super StringProcessor

	# Parses an S-Expression entity
	fun parse_entity: SExpEntity do
		var srclen = src.length
		var delims = once ['(', ')', '"']
		ignore_whitespaces
		if pos >= srclen then return new SExpError(new Location(line, line_offset), "Empty S-Expression")
		var c = src[pos]
		if c == '(' then
			var cnt = new SExp
			var loc = new Location(line, line_offset)
			pos += 1
			while pos < srclen and src[pos] != ')' do
				var p = parse_entity
				if p isa SExpError then break
				cnt.content.add p
				ignore_whitespaces
			end
			if pos < srclen and src[pos] == ')' then
				pos += 1
				return cnt
			else
				return new SExpError(loc, "Incomplete S-Expression")
			end
		else if c == '"' then
			var stdq = pos
			var loc = new Location(line, line_offset)
			pos += 1
			ignore_until("\"")
			pos += 1
			var endq = pos
			return new SExpDQString(loc, src.substring(stdq, endq - stdq))
		else
			var stid = pos
			var loc = new Location(line, line_offset)
			while pos < srclen and not c.is_whitespace and not delims.has(c) do
				c = src[pos]
				pos += 1
			end
			if delims.has(c) or c.is_whitespace then pos -= 1
			if pos >= srclen then return new SExpError(loc, "Invalid S-Expression")
			var endid = pos
			var cntstr = src.substring(stid, endid - stid)
			var cnt: SExpEntity
			if cntstr.is_numeric then
				cnt = new SExpFloat(loc, cntstr.to_f)
			else
				cnt = new SExpId(loc, cntstr)
			end
			return cnt
		end
	end
end
lib/sexp/sexp.nit:93,1--148,3