diff options
author | QMK Bot <hello@qmk.fm> | 2022-03-27 20:29:09 +0000 |
---|---|---|
committer | QMK Bot <hello@qmk.fm> | 2022-03-27 20:29:09 +0000 |
commit | 03f9b8db15f0ae51806734d48212b4088ffe6632 (patch) | |
tree | 207ef6188c9eb7193d4315e7ab73dc67c94cb19b /lib/python/qmk/c_parse.py | |
parent | 5f6c5cb54be9965a736b980c8c60443d971c350d (diff) | |
parent | 8c0198334c5a76b93530d6edd9b11ea99ea40018 (diff) |
Merge remote-tracking branch 'origin/master' into develop
Diffstat (limited to 'lib/python/qmk/c_parse.py')
-rw-r--r-- | lib/python/qmk/c_parse.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/python/qmk/c_parse.py b/lib/python/qmk/c_parse.py index e7d44a514f..72be690019 100644 --- a/lib/python/qmk/c_parse.py +++ b/lib/python/qmk/c_parse.py @@ -10,6 +10,7 @@ from qmk.comment_remover import comment_remover default_key_entry = {'x': -1, 'y': 0, 'w': 1} single_comment_regex = re.compile(r'\s+/[/*].*$') multi_comment_regex = re.compile(r'/\*(.|\n)*?\*/', re.MULTILINE) +layout_macro_define_regex = re.compile(r'^#\s*define') def strip_line_comment(string): @@ -51,7 +52,7 @@ def find_layouts(file): file_contents = file_contents.replace('\\\n', '') for line in file_contents.split('\n'): - if line.startswith('#define') and '(' in line and 'LAYOUT' in line: + if layout_macro_define_regex.match(line.lstrip()) and '(' in line and 'LAYOUT' in line: # We've found a LAYOUT macro macro_name, layout, matrix = _parse_layout_macro(line.strip()) |