39 lines
965 B
Python
39 lines
965 B
Python
with open('D:\\app\\ai\\app-grosir\\lib\\screens\\produk_screen.dart', 'r') as f:
|
|
lines = f.readlines()
|
|
|
|
stack = []
|
|
for i in range(493, 649):
|
|
line = lines[i]
|
|
in_string = False
|
|
escape = False
|
|
for j, c in enumerate(line):
|
|
if escape:
|
|
escape = False
|
|
continue
|
|
if c == '\\':
|
|
escape = True
|
|
continue
|
|
if c in "'\"":
|
|
in_string = not in_string
|
|
continue
|
|
if in_string:
|
|
continue
|
|
if c == '(':
|
|
stack.append((i+1, j+1, line.rstrip()))
|
|
elif c == ')':
|
|
if stack:
|
|
stack.pop()
|
|
else:
|
|
print(f'Unexpected ) at line {i+1}:{j+1}')
|
|
break
|
|
else:
|
|
continue
|
|
break
|
|
else:
|
|
if stack:
|
|
print(f'Unclosed ( at:')
|
|
for item in stack:
|
|
print(f' Line {item[0]}:{item[1]} | {item[2]}')
|
|
else:
|
|
print('All balanced!')
|