Mercurial > lcfOS
comparison python/ppci/errors.py @ 194:b01429a5d695
Fixed test
author | Windel Bouwman |
---|---|
date | Wed, 29 May 2013 22:36:37 +0200 |
parents | 6b2bec5653f1 |
children | 5e391d9a3381 |
comparison
equal
deleted
inserted
replaced
193:f091e7d70996 | 194:b01429a5d695 |
---|---|
1 """ | 1 """ |
2 Error handling routines | 2 Error handling routines |
3 Diagnostic utils | 3 Diagnostic utils |
4 """ | 4 """ |
5 | 5 |
6 from . import SourceLocation | |
7 | |
6 class CompilerError(Exception): | 8 class CompilerError(Exception): |
7 def __init__(self, msg, loc): | 9 def __init__(self, msg, loc): |
8 self.msg = msg | 10 self.msg = msg |
9 self.loc = loc | 11 self.loc = loc |
12 assert type(loc) is SourceLocation, '{0} must be SourceLocation'.format(type(loc)) | |
10 def __repr__(self): | 13 def __repr__(self): |
11 return 'Compilererror {0} at row {1}'.format(self.msg, self.loc.row) | 14 return 'Compilererror {0} at row {1}'.format(self.msg, self.loc.row) |
12 | 15 |
13 def printError(source, e): | 16 def printError(source, e): |
14 def printLine(row, txt): | 17 def printLine(row, txt): |