Mercurial > lcfOS
comparison python/c3/lexer.py @ 152:b73bc14a3aa3
Light coupling ide and c3 frontend
author | Windel Bouwman |
---|---|
date | Sat, 02 Mar 2013 09:56:12 +0100 |
parents | 74241ca312cc |
children | 8104fc8b5e90 |
comparison
equal
deleted
inserted
replaced
151:afc8c0207984 | 152:b73bc14a3aa3 |
---|---|
1 import collections, re | 1 import collections, re |
2 from ppci.errors import CompilerException, SourceLocation | 2 |
3 from ppci import CompilerError, SourceLocation | |
3 | 4 |
4 """ | 5 """ |
5 Lexical analyzer part. Splits the input character stream into tokens. | 6 Lexical analyzer part. Splits the input character stream into tokens. |
6 """ | 7 """ |
7 | 8 |
66 pos = mo.end() | 67 pos = mo.end() |
67 mo = gettok(s, pos) | 68 mo = gettok(s, pos) |
68 if pos != len(s): | 69 if pos != len(s): |
69 col = pos - line_start | 70 col = pos - line_start |
70 pos = line | 71 pos = line |
71 raise CompilerException('Unexpected character {0}'.format(s[pos]), pos) | 72 raise CompilerError('Unexpected character {0}'.format(s[pos]), pos) |
72 yield Token('END', '', line) | 73 yield Token('END', '', line) |
73 | 74 |