Files
@ 0ee71f3564f4
Branch filter:
Location: Diana/src/sgfParser/__init__.py - annotation
0ee71f3564f4
438 B
text/x-python
the parser is more predictive and reports errors
b66f5379b832 b66f5379b832 b66f5379b832 b66f5379b832 b66f5379b832 b66f5379b832 0ee71f3564f4 0ee71f3564f4 0ee71f3564f4 0ee71f3564f4 0ee71f3564f4 0ee71f3564f4 0ee71f3564f4 0ee71f3564f4 0ee71f3564f4 b66f5379b832 0ee71f3564f4 0ee71f3564f4 0ee71f3564f4 0ee71f3564f4 0ee71f3564f4 0ee71f3564f4 b66f5379b832 0ee71f3564f4 0ee71f3564f4 0ee71f3564f4 0ee71f3564f4 | 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
|