diff --git a/error.c b/error.c index 04dc2ae..1a46e82 100644 --- a/error.c +++ b/error.c @@ -303,5 +303,11 @@ error (int errnum, char *fun, int arg) fclose (GET_PORT (input_stream)); } ESCFORG; - longjmp (buf, 1); + if (init_flag) + { + init_flag = 0; + longjmp (buf, 2); + } + else + longjmp (buf, 1); } diff --git a/main.c b/main.c index 3df87f9..14e9d6b 100644 --- a/main.c +++ b/main.c @@ -93,7 +93,6 @@ int syntax_flag = YES; //syntaxerrors/2 YES=normal. NO=ignore syntax-errors int string_term_flag = 0; //for string_term/2 0=normal, 1=readparse from string_term_buffer int ctrl_c_flag = 0; //for ctrl_c to stop prove int init_flag = 1; //for halt -int greeting_flag = 1; //for greeting message //operator token char operator[OPERATOR_NUMBER][5] = { @@ -225,7 +224,6 @@ main (int argc, char *argv[]) if (!init_flag) goto repl; - init_flag = 0; home = getenv ("HOME"); strcpy (str, home); strcat (str, "/nprolog/library/dcg.pl"); @@ -325,10 +323,10 @@ main (int argc, char *argv[]) } } - if (greeting_flag) + if (init_flag) { printf ("N-Prolog Ver %1.2f\n", VERSION); - greeting_flag = 0; + init_flag = 0; } repl: diff --git a/makefile b/makefile index 6d0dc9f..5981018 100644 --- a/makefile +++ b/makefile @@ -21,8 +21,7 @@ NPL_OBJS = main.o \ error.o \ bignum.o \ compute.o \ - edit.o \ - sam.o + edit.o diff --git a/npl.h b/npl.h index 86513c5..ae1d350 100644 --- a/npl.h +++ b/npl.h @@ -372,6 +372,7 @@ extern int listing_flag; extern int prefix_flag; extern int syntax_flag; extern int string_term_flag; +extern int init_flag; //------pointer---- extern int hp; //heap pointer diff --git a/parser.c b/parser.c index 251ded4..6a6efd0 100644 --- a/parser.c +++ b/parser.c @@ -997,6 +997,9 @@ gettoken (void) { if (c == EOL) error (SYNTAX_ERR, "unexpected EOL in quoted atom ", NIL); + + if (c == EOF) + error (SYNTAX_ERR, "unexpected EOF in quoted atom ", NIL); if (c == '\\') { @@ -1078,6 +1081,8 @@ gettoken (void) else error (SYNTAX_ERR, "double $ in string token ", NIL); } + else if(c == EOF) + error (SYNTAX_ERR, "not exist right $ in file ", NIL); else { stok.buf[pos++] = c; diff --git a/tests/test4.pl b/tests/test4.pl new file mode 100644 index 0000000..6c1e595 --- /dev/null +++ b/tests/test4.pl @@ -0,0 +1,2 @@ + +ffAon(Nf)'