summaryrefslogtreecommitdiff
path: root/symbol_analyzer/parser.py
diff options
context:
space:
mode:
authorAargh Rai <aargh.rai+git@gmail.com>2026-07-13 21:58:18 +0530
committerAargh Rai <aargh.rai+git@gmail.com>2026-07-13 21:58:18 +0530
commitf8c0dc54e36cc201c657aa12e5a22029b092e1bc (patch)
treea0dd1a42c9681be98a7508c128db0dacacefc2e7 /symbol_analyzer/parser.py
parent2e8b78ab0ef01eaacd8094ff839ac93b4451e9c3 (diff)
restructed all the files + uci done now
also broke the symbol analyser in the process, i didn't help much, i had to pull out the pen & paper, but it made a cool graph never the less multithreading was a pain! but it got it in the end fixed the structs naming convention, if it's used outside by other files, it's typedeffed, otherwise it's not fixed the recursive imports issued i had in go_args*, where i was casting it to void* in uci to make it work now response.c doesn't deal with ipc, really happy with that change now every single thing has its own responsibility
Diffstat (limited to 'symbol_analyzer/parser.py')
-rw-r--r--symbol_analyzer/parser.py29
1 files changed, 20 insertions, 9 deletions
diff --git a/symbol_analyzer/parser.py b/symbol_analyzer/parser.py
index 551857e..977a634 100644
--- a/symbol_analyzer/parser.py
+++ b/symbol_analyzer/parser.py
@@ -4,24 +4,29 @@ def parse_definition_tokens(tokens, symbols):
structs = []
enums = []
functions = []
+ imports = []
+ usage = []
i = 0
while i < len(tokens):
# skip comments
if tokens[i] == "//":
- while tokens[i] != "\n":
+ while tokens[i] != "\n" and i < len(tokens):
i += 1
i += 1
continue
- if tokens[i] == "typedef":
+ elif tokens[i] == "#include":
+ imports.append(tokens[i + 1])
+ i += 2
+ elif tokens[i] == "typedef":
if tokens[i + 1] in symbols:
simple_typedefs.append(tokens[i + 2])
i += 2
- if tokens[i] == "struct":
+ elif tokens[i] == "struct":
i += 1
defs = []
depth = 0
- while True:
+ while i < len(tokens):
if tokens[i] == "//":
while tokens[i] != "\n":
i += 1
@@ -37,7 +42,7 @@ def parse_definition_tokens(tokens, symbols):
defs.append(tokens[i])
i += 1
structs.append(defs)
- if tokens[i] == "enum":
+ elif tokens[i] == "enum":
i += 1
defs = []
depth = 0
@@ -57,9 +62,15 @@ def parse_definition_tokens(tokens, symbols):
defs.append(tokens[i])
i += 1
enums.append(defs)
- i += 1
-
- if tokens[i] == "(":
+ elif tokens[i] == "(":
functions.append(tokens[i - 1])
+ while tokens[i] != ")":
+ i += 1
+ i += 1
+ else:
+ usage.append(tokens[i])
+
+ i += 1
- return structs, enums, functions, simple_typedefs
+ print(structs, enums, functions, simple_typedefs, imports)
+ return structs, enums, functions, simple_typedefs, imports, usage