summaryrefslogtreecommitdiff
path: root/lib/python/qmk/c_parse.py
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2023-06-09 06:08:02 +1000
committerGitHub <noreply@github.com>2023-06-08 21:08:02 +0100
commita9f677b5186f1b998dd987a4a1a2ae79eb3cf72e (patch)
tree0bc17a6c504df7ffec58acc6db1cda2429dd5498 /lib/python/qmk/c_parse.py
parent4c6c387724c5fb17e0cd01784565bedb059fd3ad (diff)
Slightly refine `g_led_config` parsing (#21170)
Diffstat (limited to 'lib/python/qmk/c_parse.py')
-rw-r--r--lib/python/qmk/c_parse.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/python/qmk/c_parse.py b/lib/python/qmk/c_parse.py
index 7dd464bd34..08d23cf5ba 100644
--- a/lib/python/qmk/c_parse.py
+++ b/lib/python/qmk/c_parse.py
@@ -241,19 +241,24 @@ def _parse_led_config(file, matrix_cols, matrix_rows):
241 position_raw = [] 241 position_raw = []
242 flags = [] 242 flags = []
243 243
244 found_led_config = False 244 found_led_config_t = False
245 found_g_led_config = False
245 bracket_count = 0 246 bracket_count = 0
246 section = 0 247 section = 0
247 current_row_index = 0 248 current_row_index = 0
248 current_row = [] 249 current_row = []
249 250
250 for _type, value in lex(_preprocess_c_file(file), CLexer()): 251 for _type, value in lex(_preprocess_c_file(file), CLexer()):
251 # Assume g_led_config..stuff..; 252 if not found_g_led_config:
252 if value == 'g_led_config': 253 # Check for type
253 found_led_config = True 254 if value == 'led_config_t':
255 found_led_config_t = True
256 # Type found, now check for name
257 elif found_led_config_t and value == 'g_led_config':
258 found_g_led_config = True
254 elif value == ';': 259 elif value == ';':
255 found_led_config = False 260 found_g_led_config = False
256 elif found_led_config: 261 else:
257 # Assume bracket count hints to section of config we are within 262 # Assume bracket count hints to section of config we are within
258 if value == '{': 263 if value == '{':
259 bracket_count += 1 264 bracket_count += 1