Mercurial > lcfOS
diff python/asm.py @ 287:1c7c1e619be8
File movage
author | Windel Bouwman |
---|---|
date | Thu, 21 Nov 2013 11:57:27 +0100 |
parents | 8786811a5a59 |
children | be7f60545368 |
line wrap: on
line diff
--- a/python/asm.py Fri Nov 15 13:52:32 2013 +0100 +++ b/python/asm.py Thu Nov 21 11:57:27 2013 +0100 @@ -45,15 +45,16 @@ elif typ == 'STRING': val = val[1:-1] col = mo.start() - line_start - loc = SourceLocation(line, col, 0) # TODO retrieve length? + loc = SourceLocation('', line, col, 0) # TODO retrieve length? yield Token(typ, val, loc) pos = mo.end() mo = gettok(s, pos) if pos != len(s): col = pos - line_start - loc = SourceLocation(line, col, 0) + loc = SourceLocation('', line, col, 0) raise CompilerError('Unexpected character {0}'.format(s[pos]), loc) + class Lexer: def __init__(self, src): self.tokens = tokenize(src) @@ -66,6 +67,7 @@ def Peak(self): return self.curTok + class Parser: def __init__(self): # Construct a parser given a grammar: