comparison python/ppci/c3/lexer.py @ 353:b8ad45b3a573

Started with strings
author Windel Bouwman
date Sun, 09 Mar 2014 18:49:10 +0100
parents 44f336460c2a
children 173e20a47fda
comparison
equal deleted inserted replaced
352:899ae3aea803 353:b8ad45b3a573
43 ('SKIP', r'[ \t]'), 43 ('SKIP', r'[ \t]'),
44 ('COMMENTS', r'//.*'), 44 ('COMMENTS', r'//.*'),
45 ('LONGCOMMENTBEGIN', r'\/\*'), 45 ('LONGCOMMENTBEGIN', r'\/\*'),
46 ('LONGCOMMENTEND', r'\*\/'), 46 ('LONGCOMMENTEND', r'\*\/'),
47 ('LEESTEKEN', r'==|->|<<|>>|!=|\+\+|[\.,=:;\-+*\[\]/\(\)]|>=|<=|<>|>|<|{|}|&|\^|\|'), 47 ('LEESTEKEN', r'==|->|<<|>>|!=|\+\+|[\.,=:;\-+*\[\]/\(\)]|>=|<=|<>|>|<|{|}|&|\^|\|'),
48 ('STRING', r"'.*?'") 48 ('STRING', r'".*?"')
49 ] 49 ]
50 tok_re = '|'.join('(?P<%s>%s)' % pair for pair in tok_spec) 50 tok_re = '|'.join('(?P<%s>%s)' % pair for pair in tok_spec)
51 gettok = re.compile(tok_re).match 51 gettok = re.compile(tok_re).match
52 line = 1 52 line = 1
53 pos = line_start = 0 53 pos = line_start = 0