bug fices
This commit is contained in:
@@ -351,12 +351,12 @@ Term Yap_syntax_error(TokEntry *errtok, int sno) {
|
||||
tn[0] = Yap_MkApplTerm(FunctorShortSyntaxError, 1, &terr);
|
||||
tn[1] = TermNil;
|
||||
terr = Yap_MkApplTerm(FunctorError, 2, tn);
|
||||
#if DEBUG
|
||||
if (Yap_ExecutionMode == YAP_BOOT_MODE) {
|
||||
fprintf(stderr, "SYNTAX ERROR while booting: ");
|
||||
Yap_DebugPlWriteln( terr );
|
||||
}
|
||||
#endif
|
||||
#if DEBUG
|
||||
if (Yap_ExecutionMode == YAP_BOOT_MODE) {
|
||||
fprintf(stderr, "SYNTAX ERROR while booting: ");
|
||||
Yap_DebugPlWriteln(terr);
|
||||
}
|
||||
#endif
|
||||
return terr;
|
||||
}
|
||||
|
||||
@@ -400,6 +400,7 @@ static xarg *setReadEnv(Term opts, FEnv *fe, struct renv *re, int inp_stream) {
|
||||
if (args == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
re->bq = getBackQuotesFlag();
|
||||
if (args[READ_MODULE].used) {
|
||||
CurrentModule = args[READ_MODULE].tvalue;
|
||||
@@ -456,7 +457,8 @@ static xarg *setReadEnv(Term opts, FEnv *fe, struct renv *re, int inp_stream) {
|
||||
re->prio = IntegerOfTerm(args[READ_PRIORITY].tvalue);
|
||||
if (re->prio > GLOBAL_MaxPriority) {
|
||||
Yap_Error(DOMAIN_ERROR_OPERATOR_PRIORITY, opts,
|
||||
"max priority in Prolog is %d, not %ld", GLOBAL_MaxPriority, re->prio);
|
||||
"max priority in Prolog is %d, not %ld", GLOBAL_MaxPriority,
|
||||
re->prio);
|
||||
}
|
||||
} else {
|
||||
re->prio = LOCAL_default_priority;
|
||||
@@ -660,7 +662,7 @@ static parser_state_t scan(REnv *re, FEnv *fe, int inp_stream) {
|
||||
and floats */
|
||||
LOCAL_tokptr = LOCAL_toktide =
|
||||
|
||||
Yap_tokenizer(GLOBAL_Stream + inp_stream, false, &fe->tpos);
|
||||
Yap_tokenizer(GLOBAL_Stream + inp_stream, false, &fe->tpos);
|
||||
if (LOCAL_ErrorMessage)
|
||||
return YAP_SCANNING_ERROR;
|
||||
if (LOCAL_tokptr->Tok != Ord(eot_tok)) {
|
||||
@@ -809,6 +811,16 @@ Term Yap_read_term(int inp_stream, Term opts, int nargs) {
|
||||
return fe.t;
|
||||
}
|
||||
}
|
||||
if (fe.t) {
|
||||
if (fe.reading_clause &&
|
||||
!complete_clause_processing(&fe, LOCAL_tokptr, fe.t))
|
||||
fe.t = 0;
|
||||
else if (!fe.reading_clause && !complete_processing(&fe, LOCAL_tokptr))
|
||||
fe.t = 0;
|
||||
}
|
||||
#if EMACS
|
||||
first_char = tokstart->TokPos;
|
||||
#endif /* EMACS */
|
||||
return fe.t;
|
||||
}
|
||||
|
||||
@@ -819,7 +831,7 @@ static Int
|
||||
if ((rc = Yap_read_term(LOCAL_c_input_stream, ARG2, 2)) == 0)
|
||||
return FALSE;
|
||||
Term tf = Yap_GetFromSlot(h);
|
||||
Yap_RecoverSlots(1, h PASS_REGS);
|
||||
Yap_RecoverSlots(1, h);
|
||||
return Yap_unify(tf, rc);
|
||||
}
|
||||
|
||||
@@ -837,7 +849,7 @@ static Int read_term(
|
||||
out = Yap_read_term(inp_stream, ARG3, 3);
|
||||
UNLOCK(GLOBAL_Stream[inp_stream].streamlock);
|
||||
Term tf = Yap_GetFromSlot(h);
|
||||
Yap_RecoverSlots(1, h PASS_REGS);
|
||||
Yap_RecoverSlots(1, h);
|
||||
return out != 0L && Yap_unify(tf, out);
|
||||
}
|
||||
|
||||
@@ -987,7 +999,7 @@ static Int read_clause2(USES_REGS1) {
|
||||
yhandle_t h = Yap_InitSlot(ARG1);
|
||||
rc = Yap_read_term(LOCAL_c_input_stream, Deref(ARG2), -2);
|
||||
Term tf = Yap_GetFromSlot(h);
|
||||
Yap_RecoverSlots(1, h PASS_REGS);
|
||||
Yap_RecoverSlots(1, h);
|
||||
return rc && Yap_unify(tf, rc);
|
||||
}
|
||||
|
||||
@@ -1025,7 +1037,7 @@ static Int read_clause(
|
||||
out = Yap_read_term(inp_stream, t3, -3);
|
||||
UNLOCK(GLOBAL_Stream[inp_stream].streamlock);
|
||||
Term tf = Yap_GetFromSlot(h);
|
||||
Yap_RecoverSlots(1, h PASS_REGS);
|
||||
Yap_RecoverSlots(1, h);
|
||||
return out && Yap_unify(tf, out);
|
||||
}
|
||||
|
||||
@@ -1181,7 +1193,7 @@ Term Yap_StringToTerm(const char *s, size_t len, encoding_t *encp, int prio,
|
||||
*bindings = Yap_GetFromSlot(sl);
|
||||
}
|
||||
if (bindings) {
|
||||
Yap_RecoverSlots(sl, 1 PASS_REGS);
|
||||
Yap_RecoverSlots(sl, 1);
|
||||
}
|
||||
return rval;
|
||||
}
|
||||
|
Reference in New Issue
Block a user