Can now lex all of libcolumbus.

pull/15/head
Jussi Pakkanen 11 years ago
parent 7d25129c03
commit 3a4cdb843b
  1. 5
      tools/cmake2meson.py

@ -22,12 +22,13 @@ class Lexer:
self.token_specification = [
# Need to be sorted longest to shortest.
('ignore', re.compile(r'[ \t]')),
('id', re.compile('[_0-9a-z/A-Z.]+')),
('id', re.compile('[-+_0-9a-z/A-Z.]+')),
('eol', re.compile(r'\n')),
('comment', re.compile(r'\#.*')),
('lparen', re.compile(r'\(')),
('rparen', re.compile(r'\)')),
('string', re.compile('"[^"]*?"')),
('varexp', re.compile(r'\${[-_0-9a-z/A-Z.]+}')),
]
def lex(self, code):
@ -58,6 +59,8 @@ class Lexer:
yield('Id: ' + match_text)
elif tid == 'eol':
yield('eol')
elif tid == 'varexp':
yield('Variable:' + match_text[2:-1])
else:
raise RuntimeError('Wharrgarbl')
break

Loading…
Cancel
Save