comparison python/ppci/errors.py @ 191:6b2bec5653f1

Added assembler testset
author Windel Bouwman
date Sun, 26 May 2013 15:28:07 +0200
parents e9b27f7193e3
children b01429a5d695
comparison
equal deleted inserted replaced
190:65dda7e7e8bd 191:6b2bec5653f1
2 Error handling routines 2 Error handling routines
3 Diagnostic utils 3 Diagnostic utils
4 """ 4 """
5 5
6 class CompilerError(Exception): 6 class CompilerError(Exception):
7 def __init__(self, msg, loc): 7 def __init__(self, msg, loc):
8 self.msg = msg 8 self.msg = msg
9 self.loc = loc 9 self.loc = loc
10 def __repr__(self): 10 def __repr__(self):
11 return 'Compilererror {0} at row {1}'.format(self.msg, self.loc.row) 11 return 'Compilererror {0} at row {1}'.format(self.msg, self.loc.row)
12 12
13 def printError(source, e): 13 def printError(source, e):
14 def printLine(row, txt): 14 def printLine(row, txt):
15 print(str(row)+':'+txt) 15 print(str(row)+':'+txt)
16 if e.loc.row == 0: 16 if e.loc.row == 0: