Created
August 2, 2011 16:34
-
-
Save anonymous/1120594 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pmichaud@kiwi:~/nom$ cat y.pir | |
.sub 'main' :main | |
$P0 = new ['ExceptionHandler'] | |
set_label $P0, handler | |
push_eh $P0 | |
'a'() | |
'a'() | |
exit 0 | |
handler: | |
.local pmc exception | |
.get_results (exception) | |
say 'caught exception' | |
pop_eh | |
$P0 = getattribute exception, 'resume' | |
say 'resuming after exception' | |
$P0() | |
.end | |
.sub 'a' | |
say "In subroutine 'a'" | |
die "first exception" | |
say "resumed 'a' after first exception" | |
die "second exception" | |
say "resumed 'a' after second exception" | |
say "leaving 'a'" | |
.end | |
pmichaud@kiwi:~/nom$ install/bin/parrot y.pir | |
In subroutine 'a' | |
caught exception | |
resuming after exception | |
resumed 'a' after first exception | |
second exception | |
current instr.: 'a' pc 55 (y.pir:23) | |
called from Sub 'main' pc 44 (y.pir:16) | |
pmichaud@kiwi:~/nom$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment