diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-08-04 08:41:58 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-08-04 08:41:58 -0700 |
commit | 0abbda4a698bc0f3eb531c6578469c3dff65ad57 (patch) | |
tree | 10f2e64bc96c6d06452c710aa311e5c99fad05d3 /parser.l | |
parent | 4ecca7c0b2ac3d61658d749f51dc1e7fbc408ed8 (diff) | |
download | txr-0abbda4a698bc0f3eb531c6578469c3dff65ad57.tar.gz txr-0abbda4a698bc0f3eb531c6578469c3dff65ad57.tar.bz2 txr-0abbda4a698bc0f3eb531c6578469c3dff65ad57.zip |
* eval.c (force): Default the new second argument of source_loc_str.
(eval_error): Derive location of error from
the last_form_evaled, if form doesn't have it.
(eval_init): Re-register source-loc-str as binary with an optional arg.
* match.c (debuglf, sem_error, file_err, typed_error): Default new
argument of source_loc_str.
* parser.h (source_loc_str): Declaration updated.
* parser.l (source_loc_str): Take second argument which specifies
alternative value if the source loc info is not found.
* unwind.c (uw_throw): Simplify code thanks to source_loc_str
default argument.
* txr.1: Document new argument of source-loc-str.
Diffstat (limited to 'parser.l')
-rw-r--r-- | parser.l | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -991,12 +991,12 @@ val source_loc(val form) return gethash(form_to_ln_hash, form); } -val source_loc_str(val form) +val source_loc_str(val form, val alt) { cons_bind (line, file, gethash(form_to_ln_hash, form)); - return if3(line, - format(nil, lit("~a:~a"), file, line, nao), - lit("source location n/a")); + if (missingp(alt)) + alt = lit("source location n/a"); + return if3(line, format(nil, lit("~a:~a"), file, line, nao), alt); } void parser_l_init(void) |