Files @ 0ee71f3564f4
Branch filter:

Location: Diana/src/sgfParser/__init__.py

Laman
the parser is more predictive and reports errors
def skipWhitespace(s,start):
	i=start
	while i<len(s) and s[i].isspace(): i+=1
	return i


def lineNumber(s,i):
	k=0
	r=0
	for (r,line) in enumerate(s.splitlines(True)):
		k+=len(line)
		if k>=i: break
	return r+1


class ParserError(Exception):
	def __init__(self,message,s,i):
		# self.line=line
		# self.col=col
		# !! check for i<len(s)
		print(message)
		print(s[i:])
		self.message=message


class ParserWarning(ParserError):
	pass