fix syntax_errors properly.
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@518 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
3a660ed7af
commit
136f2b4ed9
1
C/init.c
1
C/init.c
@ -1030,6 +1030,7 @@ InitCodes(void)
|
||||
heap_regs->foreign_code_loaded = NULL;
|
||||
heap_regs->yap_lib_dir = NULL;
|
||||
heap_regs->agc_hook = NULL;
|
||||
heap_regs->parser_error_style = EXCEPTION_ON_PARSER_ERROR;
|
||||
heap_regs->size_of_overflow = 0;
|
||||
/* make sure no one else can use these two atoms */
|
||||
CurrentModule = 0;
|
||||
|
18
C/iopreds.c
18
C/iopreds.c
@ -170,8 +170,6 @@ STATIC_PROTO (Int GetArgSizeFromChar, (Term *));
|
||||
|
||||
|
||||
|
||||
static int parser_error_style = EXCEPTION_ON_PARSER_ERROR;
|
||||
|
||||
#if EMACS
|
||||
static int first_char;
|
||||
#endif
|
||||
@ -2794,13 +2792,13 @@ p_set_read_error_handler(void)
|
||||
}
|
||||
s = RepAtom(AtomOfTerm(t))->StrOfAE;
|
||||
if (!strcmp(s, "fail")) {
|
||||
parser_error_style = FAIL_ON_PARSER_ERROR;
|
||||
ParserErrorStyle = FAIL_ON_PARSER_ERROR;
|
||||
} else if (!strcmp(s, "error")) {
|
||||
parser_error_style = EXCEPTION_ON_PARSER_ERROR;
|
||||
ParserErrorStyle = EXCEPTION_ON_PARSER_ERROR;
|
||||
} else if (!strcmp(s, "quiet")) {
|
||||
parser_error_style = QUIET_ON_PARSER_ERROR;
|
||||
ParserErrorStyle = QUIET_ON_PARSER_ERROR;
|
||||
} else if (!strcmp(s, "dec10")) {
|
||||
parser_error_style = CONTINUE_ON_PARSER_ERROR;
|
||||
ParserErrorStyle = CONTINUE_ON_PARSER_ERROR;
|
||||
} else {
|
||||
Error(DOMAIN_ERROR_SYNTAX_ERROR_HANDLER,t,"bad syntax_error handler");
|
||||
return(FALSE);
|
||||
@ -2814,7 +2812,7 @@ p_get_read_error_handler(void)
|
||||
{
|
||||
Term t;
|
||||
|
||||
switch (parser_error_style) {
|
||||
switch (ParserErrorStyle) {
|
||||
case FAIL_ON_PARSER_ERROR:
|
||||
t = MkAtomTerm(LookupAtom("fail"));
|
||||
break;
|
||||
@ -2893,10 +2891,10 @@ p_read (void)
|
||||
}
|
||||
}
|
||||
TR = old_TR;
|
||||
if (parser_error_style == QUIET_ON_PARSER_ERROR) {
|
||||
if (ParserErrorStyle == QUIET_ON_PARSER_ERROR) {
|
||||
/* just fail */
|
||||
return(FALSE);
|
||||
} else if (parser_error_style == CONTINUE_ON_PARSER_ERROR) {
|
||||
} else if (ParserErrorStyle == CONTINUE_ON_PARSER_ERROR) {
|
||||
ErrorMessage = NULL;
|
||||
/* try again */
|
||||
goto repeat_cycle;
|
||||
@ -2905,7 +2903,7 @@ p_read (void)
|
||||
if (ErrorMessage == NULL)
|
||||
ErrorMessage = "SYNTAX ERROR";
|
||||
|
||||
if (parser_error_style == EXCEPTION_ON_PARSER_ERROR) {
|
||||
if (ParserErrorStyle == EXCEPTION_ON_PARSER_ERROR) {
|
||||
Error(SYNTAX_ERROR,terr,ErrorMessage);
|
||||
return(FALSE);
|
||||
} else /* FAIL ON PARSER ERROR */ {
|
||||
|
4
H/Heap.h
4
H/Heap.h
@ -10,7 +10,7 @@
|
||||
* File: Heap.h *
|
||||
* mods: *
|
||||
* comments: Heap Init Structure *
|
||||
* version: $Id: Heap.h,v 1.28 2002-06-04 18:21:54 vsc Exp $ *
|
||||
* version: $Id: Heap.h,v 1.29 2002-06-05 01:34:06 vsc Exp $ *
|
||||
*************************************************************************/
|
||||
|
||||
/* information that can be stored in Code Space */
|
||||
@ -291,6 +291,7 @@ typedef struct various_codes {
|
||||
void *foreign_code_loaded;
|
||||
char *yap_lib_dir;
|
||||
Agc_hook agc_hook;
|
||||
int parser_error_style;
|
||||
#if defined(YAPOR) || defined(TABLING)
|
||||
struct global_data global;
|
||||
struct local_data remote[MAX_WORKERS];
|
||||
@ -485,6 +486,7 @@ typedef struct various_codes {
|
||||
#define ForeignCodeLoaded heap_regs->foreign_code_loaded
|
||||
#define Yap_LibDir heap_regs->yap_lib_dir
|
||||
#define AGCHook heap_regs->agc_hook
|
||||
#define ParserErrorStyle heap_regs->parser_error_style
|
||||
#define DeadClauses heap_regs->dead_clauses
|
||||
#define SizeOfOverflow heap_regs->size_of_overflow
|
||||
#define LastWtimePtr heap_regs->last_wtime
|
||||
|
@ -102,11 +102,6 @@ StreamDesc Stream[MaxStreams];
|
||||
#define Pipe_Stream_f 0x040000
|
||||
#define Popen_Stream_f 0x080000
|
||||
|
||||
#define FAIL_ON_PARSER_ERROR 0
|
||||
#define QUIET_ON_PARSER_ERROR 1
|
||||
#define CONTINUE_ON_PARSER_ERROR 2
|
||||
#define EXCEPTION_ON_PARSER_ERROR 3
|
||||
|
||||
#define StdInStream 0
|
||||
#define StdOutStream 1
|
||||
#define StdErrStream 2
|
||||
|
@ -314,6 +314,11 @@ extern int Portray_delays;
|
||||
|
||||
#define HashFunction(CHP,OUT) { (OUT)=0; while(*(CHP) != '\0') (OUT) += *(CHP)++; (OUT) %= MaxHash; }
|
||||
|
||||
#define FAIL_ON_PARSER_ERROR 0
|
||||
#define QUIET_ON_PARSER_ERROR 1
|
||||
#define CONTINUE_ON_PARSER_ERROR 2
|
||||
#define EXCEPTION_ON_PARSER_ERROR 3
|
||||
|
||||
extern jmp_buf IOBotch;
|
||||
|
||||
extern int in_getc;
|
||||
|
@ -79,7 +79,7 @@ read_sig.
|
||||
(
|
||||
'$get_value'('$break',0)
|
||||
->
|
||||
'$set_read_error_handler'(error),
|
||||
% '$set_read_error_handler'(error), let the user do that
|
||||
% after an abort, make sure all spy points are gone.
|
||||
'$clean_debugging_info',
|
||||
% simple trick to find out if this is we are booting from Prolog.
|
||||
|
Reference in New Issue
Block a user