make syntax_error handling ISO compatible.
This commit is contained in:
parent
5df3c389b5
commit
4355a94793
@ -1427,8 +1427,10 @@ Yap_Error(yap_error_number type, Term where, char *format,...)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
Term ti[1];
|
||||||
i = strlen(tmpbuf);
|
i = strlen(tmpbuf);
|
||||||
nt[0] = where;
|
ti[0] = where;
|
||||||
|
nt[0] = Yap_MkApplTerm(FunctorShortSyntaxError, 1, ti);
|
||||||
tp = tmpbuf+i;
|
tp = tmpbuf+i;
|
||||||
psize -= i;
|
psize -= i;
|
||||||
fun = FunctorError;
|
fun = FunctorError;
|
||||||
|
@ -849,6 +849,7 @@ p_char_code(void)
|
|||||||
Yap_Error(INSTANTIATION_ERROR,t0,"char_code/2");
|
Yap_Error(INSTANTIATION_ERROR,t0,"char_code/2");
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
} else if (!IsIntegerTerm(t1)) {
|
} else if (!IsIntegerTerm(t1)) {
|
||||||
|
fprintf(stderr,"hello\n"),
|
||||||
Yap_Error(TYPE_ERROR_INTEGER,t1,"char_code/2");
|
Yap_Error(TYPE_ERROR_INTEGER,t1,"char_code/2");
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
} else {
|
} else {
|
||||||
|
@ -262,7 +262,7 @@ print_message(Severity, Term) :-
|
|||||||
)
|
)
|
||||||
).
|
).
|
||||||
print_message(silent, _) :- !.
|
print_message(silent, _) :- !.
|
||||||
print_message(_, error(syntax_error(_,between(_,L,_),_,_,_,_,StreamName),_)) :- !,
|
print_message(_, error(syntax_error(syntax_error(_,between(_,L,_),_,_,_,_,StreamName)),_)) :- !,
|
||||||
format(user_error,'SYNTAX ERROR at ~a, close to ~d~n',[StreamName,L]).
|
format(user_error,'SYNTAX ERROR at ~a, close to ~d~n',[StreamName,L]).
|
||||||
print_message(_, loading(A, F)) :- !,
|
print_message(_, loading(A, F)) :- !,
|
||||||
format(user_error,' % ~a ~a~n',[A,F]).
|
format(user_error,' % ~a ~a~n',[A,F]).
|
||||||
@ -284,7 +284,7 @@ print_message(_, Term) :-
|
|||||||
'$print_system_message'(_, banner, _) :-
|
'$print_system_message'(_, banner, _) :-
|
||||||
current_prolog_flag(verbose, silent), !.
|
current_prolog_flag(verbose, silent), !.
|
||||||
'$print_system_message'(Term, Level, Lines) :-
|
'$print_system_message'(Term, Level, Lines) :-
|
||||||
Term = error(syntax_error(_,_,_,_,_,_,_),_), !,
|
Term = error(syntax_error(syntax_error(_,_,_,_,_,_,_)),_), !,
|
||||||
flush_output(user_output),
|
flush_output(user_output),
|
||||||
flush_output(user_error),
|
flush_output(user_error),
|
||||||
'$messages':prefix(Level, LinePrefix, Stream, _, Lines), !,
|
'$messages':prefix(Level, LinePrefix, Stream, _, Lines), !,
|
||||||
|
@ -264,9 +264,9 @@ system_message(error(resource_error(trail), Where)) -->
|
|||||||
[ 'RESOURCE ERROR- not enough trail space' - [Where] ].
|
[ 'RESOURCE ERROR- not enough trail space' - [Where] ].
|
||||||
system_message(error(signal(SIG,_), _)) -->
|
system_message(error(signal(SIG,_), _)) -->
|
||||||
[ 'UNEXPECTED SIGNAL: ~a' - [SIG] ].
|
[ 'UNEXPECTED SIGNAL: ~a' - [SIG] ].
|
||||||
system_message(error(syntax_error(G,0,Msg,[],0,0,File), _)) -->
|
system_message(error(syntax_error(syntax_error(G,0,Msg,[],0,0,File)), _)) -->
|
||||||
[ 'SYNTAX ERROR at "~a", goal ~q: ~a' - [File,G,Msg] ].
|
[ 'SYNTAX ERROR at "~a", goal ~q: ~a' - [File,G,Msg] ].
|
||||||
system_message(error(syntax_error(read(Term),_,_,Term,Pos,Start,File), Where)) -->
|
system_message(error(syntax_error(syntax_error(read(Term),_,_,Term,Pos,Start,File)), Where)) -->
|
||||||
['~w' - [Where]],
|
['~w' - [Where]],
|
||||||
syntax_error_line(File, Start, Pos),
|
syntax_error_line(File, Start, Pos),
|
||||||
syntax_error_term(10, Pos, Term),
|
syntax_error_term(10, Pos, Term),
|
||||||
|
Reference in New Issue
Block a user