diff --git a/tools/cmake2meson.py b/tools/cmake2meson.py index 960cad935..24d8e4a02 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