Skip to content

Commit 4d81357

Browse files
committed
Handle nested braces when parsing QCs
1 parent 4d449ae commit 4d81357

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/hammeraddons/propcombine.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,9 +671,14 @@ def parse_qc(qc_loc: Path, qc_path: Path) -> Optional[Tuple[
671671
return None
672672
elif token_type is Token.BRACE_OPEN:
673673
# Skip other "compound" sections we don't care about.
674+
depth = 1
674675
for body_type, body_value in tok:
675676
if body_type is Token.BRACE_CLOSE:
676-
break
677+
depth -= 1
678+
if not depth:
679+
break
680+
elif body_type is Token.BRACE_OPEN:
681+
depth += 1
677682
else:
678683
raise tok.error("EOF reached without closing brace (})!")
679684

0 commit comments

Comments
 (0)