def skipWhitespace(s,start): i=start while ii: break else: k+=len(line) return (r+1, c+1) class ParserError(Exception): def __init__(self,msg,s,i): self.msg=msg self.row,self.col=strRowCol(s, i) def __str__(self): return "{0} at row {1}, col {2}".format(self.msg,self.row,self.col) class ParserWarning(ParserError): pass