diff python/ppci/common.py @ 287:1c7c1e619be8

File movage
author Windel Bouwman
date Thu, 21 Nov 2013 11:57:27 +0100
parents e41e4109addd
children 534b94b40aa8
line wrap: on
line diff
--- a/python/ppci/common.py	Fri Nov 15 13:52:32 2013 +0100
+++ b/python/ppci/common.py	Thu Nov 21 11:57:27 2013 +0100
@@ -1,26 +1,29 @@
 from collections import namedtuple
 
+
 # Token is used in the lexical analyzer:
 class Token:
     def __init__(self, typ, val, loc=None):
         self.typ = typ
         self.val = val
         if loc is None:
-            loc = SourceLocation(0, 0, 0)
+            loc = SourceLocation('', 0, 0, 0)
         assert type(loc) is SourceLocation
         self.loc = loc
     def __repr__(self):
         return 'Token({0}, {1})'.format(self.typ, self.val)
 
+
 class SourceLocation:
-    def __init__(self, row, col, ln):
+    def __init__(self, filename, row, col, ln):
+        self.filename = filename
         self.row = row
         self.col = col
         self.length = ln
-        self.filename = ''
 
     def __repr__(self):
         return '{}, {}'.format(self.row, self.col)
 
+
 SourceRange = namedtuple('SourceRange', ['p1', 'p2'])