Skip to content

Commit b82835e

Browse files
authored
Update parser.py
1 parent 7fc6617 commit b82835e

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

hackerc/parser.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
def parse_hacker_file(file_path, verbose=False, console=None):
77
if console is None:
88
console = Console()
9-
9+
1010
deps = set()
1111
libs = set()
1212
vars = {}
@@ -16,15 +16,15 @@ def parse_hacker_file(file_path, verbose=False, console=None):
1616
in_config = False
1717
config_lines = []
1818
line_num = 0
19-
19+
2020
try:
2121
with open(file_path, 'r') as f:
2222
for line in f:
2323
line_num += 1
2424
line = line.strip()
2525
if not line:
2626
continue
27-
27+
2828
if line == '[':
2929
if in_config:
3030
errors.append(f"Line {line_num}: Nested config section")
@@ -36,11 +36,11 @@ def parse_hacker_file(file_path, verbose=False, console=None):
3636
errors.append(f"Line {line_num}: Closing ] without [")
3737
in_config = False
3838
continue
39-
39+
4040
if in_config:
4141
config_lines.append(line)
4242
continue
43-
43+
4444
if line.startswith('//'):
4545
dep = line[2:].strip()
4646
if dep:
@@ -123,10 +123,10 @@ def parse_hacker_file(file_path, verbose=False, console=None):
123123
pass
124124
else:
125125
errors.append(f"Line {line_num}: Invalid syntax")
126-
126+
127127
if in_config:
128128
errors.append("Unclosed config section")
129-
129+
130130
if verbose:
131131
console.print(f"[blue]System Deps: {deps}[/blue]")
132132
console.print(f"[blue]Custom Libs: {libs}[/blue]")
@@ -135,9 +135,10 @@ def parse_hacker_file(file_path, verbose=False, console=None):
135135
console.print(f"[blue]Includes: {includes}[/blue]")
136136
if errors:
137137
console.print(f"[yellow]Errors: {errors}[/yellow]")
138-
138+
139139
return deps, libs, vars, cmds, includes, errors
140-
140+
141141
except FileNotFoundError:
142142
console.print(f"[bold red]File {file_path} not found[/bold red]")
143143
return set(), set(), {}, [], [], [f"File {file_path} not found"]
144+

0 commit comments

Comments
 (0)