Menu

#40 Enhancement for syntax trapping

open
nobody
None
5
2017-03-25
2017-03-25
No

When SYNTAX errors are trapped the normal Regina error messages are suppressed and the syntax condition-handler is invoked with special variables SIGL and .MN set. I code my SYNTAX: routines to reproduce the suppressed message(s) and enter interactive trace mode to assist with debugging.

syntax:
 TRACE 'Off'
 SAY 'Syntax error at line' sigl
 SAY SOURCELINE(sigl)
 SAY ERRORTEXT(TRUNC(.mn))
 IF .mn \= TRUNC(.mn) THEN SAY ERRORTEXT(.mn)
 TRACE '?i'
syntaxerror: 

But as the description of the ERRORTEXT() bif says, "The resulting string will be the text of the sub-error number with place-markers indicating where substitution values would normally be placed." when there is a sub-error indicated in .MN.

It would be very useful to have another special variable that replaces the place-holders in ERRORTEXT(40.24)

<bif> argument 1 must be a binary string; found "<value>"

with the values for bif and value that Regina would have inserted in its messages.

Maybe .SYNTAXERRMSG ?

Discussion