fixes #22541; peg matchLen can raise an unlisted exception: Exception (#22545)

The `mopProc` is a recursive function.

(cherry picked from commit c56a712e7d)
This commit is contained in:
ringabout
2023-08-24 18:59:45 +08:00
committed by narimiran
parent 4cf2658235
commit d46e71bea3

View File

@@ -562,7 +562,7 @@ template matchOrParse(mopProc: untyped) =
# procs. For the former, *enter* and *leave* event handler code generators
# are provided which just return *discard*.
proc mopProc(s: string, p: Peg, start: int, c: var Captures): int {.gcsafe.} =
proc mopProc(s: string, p: Peg, start: int, c: var Captures): int {.gcsafe, raises: [].} =
proc matchBackRef(s: string, p: Peg, start: int, c: var Captures): int =
# Parse handler code must run in an *of* clause of its own for each
# *PegKind*, so we encapsulate the identical clause body for