@@ 19,7 19,7 @@ evaluate_program(Forms, File, Layout, Vars, Value0, Value) :-
evaluate_forms(Forms, File, Layout, Vars, Value0, Value, _).
-evaluate_forms(_, _, _, _, exception(What, Where), exception(What, Where), []) :-
+evaluate_forms(_, _, _, _, exception(What, Who, Where), exception(What, Who, Where), []) :-
!.
evaluate_forms([H|T], File, Layouts, Vars, Value0, Value, [Value1|RT]) :-
!,
@@ 32,7 32,7 @@ evaluate_forms([], _, _, _, Value, Value, []).
evaluate_form(Form, Value) :-
evaluate_form(Form, dyn, dyn, [], '#f', Value).
-evaluate_form(_, File, Layout, _, exception(What, Where), exception(What, [File:Layout|Where])) :- !.
+evaluate_form(_, File, Layout, _, exception(What, Who, Where), exception(What, Who, [File:Layout|Where])) :- !.
evaluate_form([import, SpecList], File, Layout, Vars, Value0, Value) :-
!,
Spec =.. SpecList,
@@ 42,7 42,7 @@ evaluate_form([import, SpecList], File, Layout, Vars, Value0, Value) :-
-> read_program(file(Path), Program, [positions(Positions)]),
evaluate_program(Program, Path, Positions, Vars, Value0, Value)
; sub_layout(2, Layout, SpecLayout),
- Value = exception(import_error(Spec), [File:SpecLayout])
+ Value = exception(import_error, Spec, [File:SpecLayout])
).
evaluate_form([define, Name, Args | Body], File, Layout, _, _, quote(Name)) :-
!,
@@ 65,8 65,8 @@ evaluate_form([Name | Args], File, Layout, Vars, Value0, Value) :-
sub_layout(1, Layout, PName),
sub_layouts(1, Layout, PArgs),
evaluate_forms(Args, File, PArgs, Vars, Value0, Value1, Vals),
- ( Value1 = exception(What, Where)
- -> Value = exception(What, [File:Layout|Where])
+ ( Value1 = exception(What, Who, Where)
+ -> Value = exception(What, Who, [File:Layout|Where])
; defined(Name, A, Body, F, P)
-> ( maplist([Arg,Val,Arg=Val]>>true, A, Vals, Vars1)
-> append(Vars1, Vars, Vars2),
@@ 74,11 74,11 @@ evaluate_form([Name | Args], File, Layout, Vars, Value0, Value) :-
; Value = Value1
)
; primitive(Name, Vals, Value2)
- -> ( Value2 = exception(What)
- -> Value = exception(What, [File:PName])
+ -> ( Value2 = exception(What, Who)
+ -> Value = exception(What, Who, [File:PName])
; Value = Value2
)
- ; Value = exception(no_such_function(Name), [File:PName])
+ ; Value = exception(no_such_function, Name, [File:PName])
).
evaluate_form(quote(E), _, _, _, _, E) :- !.
evaluate_form('#t', _, _, _, _, '#t') :- !.
@@ 95,7 95,7 @@ evaluate_form(Symbol, File, Layout, Vars, _, Value) :-
!,
( memberchk(Symbol=Value, Vars)
-> true
- ; Value = exception(no_such_symbol(Symbol), [File:Layout])
+ ; Value = exception(no_such_symbol, Symbol, [File:Layout])
).
@@ 109,14 109,14 @@ primitive('equal?', [_, _], '#f') :- !.
primitive('read', [] , O) :- !, read_form(O).
primitive('eval', [O] , R) :- !, evaluate_form(O, R).
primitive('write', [O] , '#t') :- !, write_form(O).
-primitive('raise', [O] , exception(O)) :- !.
+primitive('raise', [O] , exception(raise, O)) :- !.
primitive('pair?', [[_|_]], '#t') :- !.
primitive('pair?', [_] , '#f') :- !.
primitive('cons', [H,T] , [H|T]) :- !.
primitive('car', [[H|_]] , H) :- !.
-primitive('car', [O] , exception(no_cons(O))) :- !.
+primitive('car', [O] , exception(no_cons, O)) :- !.
primitive('cdr', [[_|T]] , T) :- !.
-primitive('cdr', [O] , exception(no_cons(O))) :- !.
+primitive('cdr', [O] , exception(no_cons, O)) :- !.
@@ 14,9 14,9 @@ prolog:message(eshellisp(Value)) -->
form(Value).
-form(exception(What, [H|T])) -->
+form(exception(What, Who, [H|T])) -->
!,
- exception(What, H),
+ exception(What, Who, H),
stack(T).
form(quote(Value)) -->
!,
@@ 53,13 53,17 @@ cdr(Form) -->
[ ')'-[] ].
-exception(What, dyn:dyn) -->
+exception(What, Who, dyn:dyn) -->
!,
- [ 'Exception ~w'-[What] ].
-exception(What, Path:layout(position(Line, Column, _), _, _)) -->
+ [ 'Exception ~w('-[What] ],
+ form(Who),
+ [ ')'-[] ].
+exception(What, Who, Path:layout(position(Line, Column, _), _, _)) -->
!,
{ absolute_file_name(Path, Abs) },
- [ 'Exception ~w at '-[What], url(Abs:Line:Column) ].
+ [ 'Exception ~w('-[What] ],
+ form(Who),
+ [ ') at '-[], url(Abs:Line:Column) ].
stack([dyn:dyn|T]) -->
!,