chore: initial commit Dutra Store POS app
This commit is contained in:
38
check_unclosed.py
Normal file
38
check_unclosed.py
Normal file
@@ -0,0 +1,38 @@
|
||||
with open('D:\\app\\ai\\app-grosir\\lib\\screens\\produk_screen.dart', 'r') as f:
|
||||
lines = f.readlines()
|
||||
|
||||
stack = []
|
||||
for i in range(493, 644):
|
||||
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!')
|
||||
Reference in New Issue
Block a user