| 3470 | self.popped_top = self.stack.pop() |
| 3471 | |
| 3472 | def _CountOpenParentheses(self, line: str): |
| 3473 | # Count parentheses. This is to avoid adding struct arguments to |
| 3474 | # the nesting stack. |
| 3475 | if self.stack: |
| 3476 | inner_block = self.stack[-1] |
| 3477 | depth_change = line.count("(") - line.count(")") |
| 3478 | inner_block.open_parentheses += depth_change |
| 3479 | |
| 3480 | # Also check if we are starting or ending an inline assembly block. |
| 3481 | if inner_block.inline_asm in (_NO_ASM, _END_ASM): |
| 3482 | if ( |
| 3483 | depth_change != 0 |
| 3484 | and inner_block.open_parentheses == 1 |
| 3485 | and _MATCH_ASM.match(line) |
| 3486 | ): |
| 3487 | # Enter assembly block |
| 3488 | inner_block.inline_asm = _INSIDE_ASM |
| 3489 | else: |
| 3490 | # Not entering assembly block. If previous line was _END_ASM, |
| 3491 | # we will now shift to _NO_ASM state. |
| 3492 | inner_block.inline_asm = _NO_ASM |
| 3493 | elif inner_block.inline_asm == _INSIDE_ASM and inner_block.open_parentheses == 0: |
| 3494 | # Exit assembly block |
| 3495 | inner_block.inline_asm = _END_ASM |
| 3496 | |
| 3497 | def _UpdateNamesapce(self, line: str, linenum: int) -> str | None: |
| 3498 | """ |