From 3a4cdb843bb4f866137b1113ab9af9bc1e7d5a76 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Sun, 25 May 2014 08:01:40 +0300 Subject: Can now lex all of libcolumbus. --- tools/cmake2meson.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/cmake2meson.py b/tools/cmake2meson.py index 960cad9..24d8e4a 100755 --- a/tools/cmake2meson.py +++ b/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 -- cgit v1.1