comparison python/c3/lexer.py @ 191:6b2bec5653f1

Added assembler testset
author Windel Bouwman
date Sun, 26 May 2013 15:28:07 +0200
parents 8104fc8b5e90
children b01429a5d695
comparison
equal deleted inserted replaced
190:65dda7e7e8bd 191:6b2bec5653f1
1 import collections, re 1 import collections, re
2 2
3 from ppci import CompilerError, SourceLocation 3 from ppci import CompilerError, SourceLocation, Token
4 4
5 """ 5 """
6 Lexical analyzer part. Splits the input character stream into tokens. 6 Lexical analyzer part. Splits the input character stream into tokens.
7 """ 7 """
8
9 # Token is used in the lexical analyzer:
10 Token = collections.namedtuple('Token', 'typ val loc')
11 8
12 keywords = ['and', 'or', 'not','true', 'false', \ 9 keywords = ['and', 'or', 'not','true', 'false', \
13 'else', 'if', 'while', 'return', \ 10 'else', 'if', 'while', 'return', \
14 'function', 'var', 'type', 'const', \ 11 'function', 'var', 'type', 'const', \
15 'import', 'package' ] 12 'import', 'package' ]