comparison python/ppci/common.py @ 249:e41e4109addd

Added current position arrow
author Windel Bouwman
date Fri, 26 Jul 2013 20:26:05 +0200
parents b01429a5d695
children 1c7c1e619be8
comparison
equal deleted inserted replaced
248:b10d46e5c8dd 249:e41e4109addd
11 self.loc = loc 11 self.loc = loc
12 def __repr__(self): 12 def __repr__(self):
13 return 'Token({0}, {1})'.format(self.typ, self.val) 13 return 'Token({0}, {1})'.format(self.typ, self.val)
14 14
15 class SourceLocation: 15 class SourceLocation:
16 def __init__(self, row, col, ln): 16 def __init__(self, row, col, ln):
17 self.row = row 17 self.row = row
18 self.col = col 18 self.col = col
19 self.length = ln 19 self.length = ln
20 self.filename = ''
21
22 def __repr__(self):
23 return '{}, {}'.format(self.row, self.col)
20 24
21 SourceRange = namedtuple('SourceRange', ['p1', 'p2']) 25 SourceRange = namedtuple('SourceRange', ['p1', 'p2'])
22 26