with open('D:\\app\\ai\\app-grosir\\test_syntax2.dart', 'r') as f: lines = f.readlines() for i, line in enumerate(lines): stripped = line.strip() if stripped.startswith('//') or stripped.startswith('/*') or stripped.startswith('*'): continue in_string = False escape = False for j, c in enumerate(line): if escape: escape = False continue if c == '\\': escape = True continue if c in "'\"": if not in_string: in_string = True else: in_string = False if in_string: print(f'Unclosed string at line {i+1}: {line.rstrip()}')