Recurse to subdirectories.

This commit is contained in:
Jussi Pakkanen 2014-05-31 19:24:09 +03:00
parent 5be785ab96
commit 4fe17f484f
1 changed files with 7 additions and 3 deletions

View File

@ -34,7 +34,7 @@ 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'\(')),
@ -124,11 +124,15 @@ def convert(cmake_root):
cmakecode = open(cfile).read()
p = Parser(cmakecode)
for t in p.parse():
if t.name == 'add_subdirectory':
print('\nRecursing to subdir', t.args[0], '\n')
convert(os.path.join(cmake_root, t.args[0]))
else:
print(t.name, t.args)
if __name__ == '__main__':
if len(sys.argv) != 2:
print(sys.argv[0], '<CMake project root>')
sys.exit(1)
convert(sys.argv[1])