make syntax_error handling ISO compatible.

This commit is contained in:
Vitor Santos Costa 2010-02-26 13:08:38 +00:00
parent 5df3c389b5
commit 4355a94793
4 changed files with 8 additions and 5 deletions

View File

@ -1427,8 +1427,10 @@ Yap_Error(yap_error_number type, Term where, char *format,...)
{
int i;
Term ti[1];
i = strlen(tmpbuf);
nt[0] = where;
ti[0] = where;
nt[0] = Yap_MkApplTerm(FunctorShortSyntaxError, 1, ti);
tp = tmpbuf+i;
psize -= i;
fun = FunctorError;

View File

@ -849,6 +849,7 @@ p_char_code(void)
Yap_Error(INSTANTIATION_ERROR,t0,"char_code/2");
return(FALSE);
} else if (!IsIntegerTerm(t1)) {
fprintf(stderr,"hello\n"),
Yap_Error(TYPE_ERROR_INTEGER,t1,"char_code/2");
return(FALSE);
} else {

View File

@ -262,7 +262,7 @@ print_message(Severity, Term) :-
)
).
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]).
print_message(_, loading(A, F)) :- !,
format(user_error,' % ~a ~a~n',[A,F]).
@ -284,7 +284,7 @@ print_message(_, Term) :-
'$print_system_message'(_, banner, _) :-
current_prolog_flag(verbose, silent), !.
'$print_system_message'(Term, Level, Lines) :-
Term = error(syntax_error(_,_,_,_,_,_,_),_), !,
Term = error(syntax_error(syntax_error(_,_,_,_,_,_,_)),_), !,
flush_output(user_output),
flush_output(user_error),
'$messages':prefix(Level, LinePrefix, Stream, _, Lines), !,

View File

@ -264,9 +264,9 @@ system_message(error(resource_error(trail), Where)) -->
[ 'RESOURCE ERROR- not enough trail space' - [Where] ].
system_message(error(signal(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] ].
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]],
syntax_error_line(File, Start, Pos),
syntax_error_term(10, Pos, Term),