* Checks if the parser stack indicates we're currently inside a ParenExpr.
(input: InputStream, stack: Stack)
| 422 | * Checks if the parser stack indicates we're currently inside a ParenExpr. |
| 423 | */ |
| 424 | function isInsideParenExpr(input: InputStream, stack: Stack): boolean { |
| 425 | // First try the standard parser state check |
| 426 | if (stack.canShift(closeParen)) { |
| 427 | return true; |
| 428 | } |
| 429 | |
| 430 | // If that fails, use a heuristic: look backwards for unmatched '(' |
| 431 | // This handles cases where the parser needs to reduce before shifting closeParen |
| 432 | return hasUnmatchedOpenParen(input); |
| 433 | } |
| 434 | |
| 435 | /** |
| 436 | * External tokenizer for '(' - emits openParen only if there's a balanced ')'. |
no test coverage detected