Mercurial > lcfOS
diff python/c3/lexer.py @ 205:d77cb5962cc5
Added some handcoded arm code generation
author | Windel Bouwman |
---|---|
date | Sun, 23 Jun 2013 18:23:18 +0200 |
parents | de3a68f677a5 |
children | 003c8a976fff |
line wrap: on
line diff
--- a/python/c3/lexer.py Fri Jun 21 15:01:08 2013 +0200 +++ b/python/c3/lexer.py Sun Jun 23 18:23:18 2013 +0200 @@ -28,7 +28,7 @@ ('COMMENTS', r'//.*'), ('LONGCOMMENTBEGIN', r'\/\*'), ('LONGCOMMENTEND', r'\*\/'), - ('LEESTEKEN', r'==|[\.,=:;\-+*\[\]/\(\)]|>=|<=|<>|>|<|{|}'), + ('LEESTEKEN', r'==|[\.,=:;\-+*\[\]/\(\)]|>=|<=|<>|>|<|{|}|&|\^|\|'), ('STRING', r"'.*?'") ] tok_re = '|'.join('(?P<%s>%s)' % pair for pair in tok_spec) @@ -43,7 +43,7 @@ if typ == 'NEWLINE': line_start = pos line += 1 - elif typ == 'COMMENT': + elif typ == 'COMMENTS': pass elif typ == 'LONGCOMMENTBEGIN': incomment = True @@ -73,9 +73,9 @@ pos = mo.end() mo = gettok(s, pos) if pos != len(s): - col = pos - line_start - pos = line - raise CompilerError('Unexpected character {0}'.format(s[pos]), pos) + col = pos - line_start + loc = SourceLocation(line, col, 1) + raise CompilerError('Unexpected character "{0}"'.format(s[pos]), loc) loc = SourceLocation(line, 0, 0) yield Token('END', '', loc)