Robin Edwards wrote:
Hi,
I am trying to throw an error on a type mismatch through an assignment operator.
ex = new 'Exception'
ex['severity'] = .EXCEPT_ERROR
ex['message'] = "Type mismatch in assignment!"
I can't find a away of leaving the user with a code line number is
this possible?
I have tried trying to grab '$/' to with no success any ideas?
Hi Robin,
Hmmm... Your code sample above is PIR, but $/ is Perl 6 syntax (for
output record separator, last I checked). It might be helpful to know
what you're working on.
In PIR/PASM, Parrot captures the line number and displays it in the
output of an uncaught exception. Run the following PIR subroutine as an
example:
.sub main :main
.include 'except_types.pasm'
.local pmc ex
ex = new 'Exception'
ex['severity'] = .EXCEPTION_SYNTAX_ERROR
ex['message'] = "Type mismatch in assignment!"
throw ex
.end
If you're working on a language implementation, you may want to use the
.annotate directive to set the line number for the original language source.
Allison
_______________________________________________
http://lists.parrot.org/mailman/listinfo/parrot-dev