fix syntax error essages
WITH_PACKAGES
This commit is contained in:
parent
5f989e58b2
commit
eed36e99a6
20
C/cdmgr.c
20
C/cdmgr.c
@ -94,20 +94,32 @@ void Yap_ResetConsultStack(void) {
|
|||||||
LOCAL_ConsultCapacity = InitialConsultCapacity;
|
LOCAL_ConsultCapacity = InitialConsultCapacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Are we compiling a file?
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
bool Yap_Consulting(USES_REGS1) {
|
||||||
|
return LOCAL_ConsultBase != NULL
|
||||||
|
&& LOCAL_ConsultSp != LOCAL_ConsultLow+LOCAL_ConsultCapacity;
|
||||||
|
}
|
||||||
|
|
||||||
/******************************************************************
|
/******************************************************************
|
||||||
|
|
||||||
ADDING AND REMOVE INFO TO A PROCEDURE
|
ADDING AND REMOVE INFO TO A PROCEDURE
|
||||||
|
|
||||||
******************************************************************/
|
******************************************************************/
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* we have three kinds of predicates: dynamic DynamicPredFlag
|
* we have three kinds of predicates:
|
||||||
* static CompiledPredFlag fast FastPredFlag all the
|
* + dynamic DynamicPredFlag
|
||||||
|
* + static CompiledPredFlag fast
|
||||||
|
* + fast FastPredFlag.
|
||||||
|
*
|
||||||
|
* all the
|
||||||
* database predicates are supported for dynamic predicates only abolish and
|
* database predicates are supported for dynamic predicates only abolish and
|
||||||
* assertz are supported for static predicates no database predicates are
|
* assertz are supported for static predicates no database predicates are
|
||||||
* supportted for fast predicates
|
* supportted for fast predicates
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PredEntry *Yap_get_pred(Term t, Term tmod, const char *pname) {
|
PredEntry *Yap_get_pred(Term t, Term tmod, const char *pname) {
|
||||||
Term t0 = t;
|
Term t0 = t;
|
||||||
|
|
||||||
|
13
C/errors.c
13
C/errors.c
@ -679,6 +679,7 @@ bool Yap_MkErrorRecord(yap_error_descriptor_t *r, const char *file,
|
|||||||
r->errorLine = lineno;
|
r->errorLine = lineno;
|
||||||
r->errorFunction = function;
|
r->errorFunction = function;
|
||||||
r->errorFile = file;
|
r->errorFile = file;
|
||||||
|
r->prologConsulting = Yap_Consulting();
|
||||||
LOCAL_PrologMode |= InErrorMode;
|
LOCAL_PrologMode |= InErrorMode;
|
||||||
Yap_ClearExs();
|
Yap_ClearExs();
|
||||||
// first, obtain current location
|
// first, obtain current location
|
||||||
@ -1034,7 +1035,7 @@ static Int print_exception(USES_REGS1) {
|
|||||||
|
|
||||||
|
|
||||||
static Int query_exception(USES_REGS1) {
|
static Int query_exception(USES_REGS1) {
|
||||||
const char *query;
|
const char *query = NULL;
|
||||||
Term t;
|
Term t;
|
||||||
|
|
||||||
if (IsAtomTerm((t = Deref(ARG1))))
|
if (IsAtomTerm((t = Deref(ARG1))))
|
||||||
@ -1045,13 +1046,13 @@ static Int query_exception(USES_REGS1) {
|
|||||||
return false;
|
return false;
|
||||||
yap_error_descriptor_t *y = AddressOfTerm(Deref(ARG2));
|
yap_error_descriptor_t *y = AddressOfTerm(Deref(ARG2));
|
||||||
Term t3 = Deref(ARG3);
|
Term t3 = Deref(ARG3);
|
||||||
if (IsVarTerm(t3)) {
|
//if (IsVarTerm(t3)) {
|
||||||
Term rc = queryErr(query, y);
|
Term rc = queryErr(query, y);
|
||||||
// Yap_DebugPlWriteln(rc);
|
// Yap_DebugPlWriteln(rc);
|
||||||
return Yap_unify(ARG3, rc);
|
return Yap_unify(ARG3, rc);
|
||||||
} else {
|
// } else {
|
||||||
return setErr(query, y, t3);
|
// return setErr(query, y, t3);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1261,7 +1262,7 @@ static Int is_predicate_indicator(USES_REGS1) {
|
|||||||
|
|
||||||
void Yap_InitErrorPreds(void) {
|
void Yap_InitErrorPreds(void) {
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
Yap_InitCPred("$print_exception", 1, print_exception, 0);
|
Yap_InitCPred("$print_exception<", 1, print_exception, 0);
|
||||||
Yap_InitCPred("$reset_exception", 1, reset_exception, 0);
|
Yap_InitCPred("$reset_exception", 1, reset_exception, 0);
|
||||||
Yap_InitCPred("$new_exception", 1, new_exception, 0);
|
Yap_InitCPred("$new_exception", 1, new_exception, 0);
|
||||||
Yap_InitCPred("$get_exception", 1, get_exception, 0);
|
Yap_InitCPred("$get_exception", 1, get_exception, 0);
|
||||||
|
@ -95,34 +95,27 @@ if (APPLE)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
option (WITH_EXTENSIONS "packages and libraries that add value to YAP" ON)
|
option (WITH_EXTENSIONS "packages and libraries that add value to YAP" ON)
|
||||||
if (ANDROID)
|
|
||||||
OPTION(WITH_MYDDAS " Enable MYDDAS driver" ON)
|
|
||||||
OPTION(WITH_SQLITE3 " Enable MYDDAS SQLITE3 driver" ON)
|
|
||||||
elseif(WITH_EXTENSIONS)
|
|
||||||
if (WITH_MYDDAS)
|
|
||||||
OPTION(WITH_MYSQL " Enable MYDDAS MYSQL driver" ON)
|
|
||||||
OPTION(WITH_ODBC " Enable MYDDAS ODBC driver" ON)
|
|
||||||
OPTION(WITH_POSTGRES " Enable MYDDAS POSTGRES driver" ON)
|
|
||||||
OPTION(WITH_SQLITE3 " Enable MYDDAS SQLITE3 driver" ON)
|
|
||||||
endif()
|
|
||||||
OPTION(WITH_SWIG " Enable SWIG interfaces to foreign languages" ON)
|
|
||||||
OPTION(WITH_RAPTOR " Enable the RAPTOR RDF library" ON)
|
|
||||||
OPTION(WITH_XML2 " Enable the RAPTOR XML2 library" ON)
|
|
||||||
OPTION(WITH_XML " Enable the Prolog XML library" ON)
|
|
||||||
OPTION(WITH_CLPBN" Enable the CLPBN and PFL probabilistic languages" ON)
|
|
||||||
IF (WITH_CLPBN)
|
|
||||||
OPTION(WITH_HORUS " Enable the HORUS inference libraray for CLPBN and PFL" ON)
|
|
||||||
ENDIF()
|
|
||||||
option(WITH_PROBLOG "include Problog-I." ON)
|
|
||||||
OPTION(WITH_CPLINT " Enable the cplint probabilistic language" ON)
|
|
||||||
option(WITH_GECODE "interface gecode constraint solver" ON)
|
|
||||||
option(WITH_LBFGS "interface with lbfgs" ON)
|
|
||||||
option(WITH_PRISM "use PRISM system in YAP" ON)
|
|
||||||
option(WITH_PYTHON "Allow Python->YAP and YAP->Python" ON)
|
|
||||||
option(WITH_R "Use R Interface" ON)
|
|
||||||
option(WITH_JAVA "Try to use Java (currently Java 6,7,8)" ON)
|
|
||||||
|
|
||||||
endif()
|
OPTION(WITH_MYDDAS " Enable MYDDAS driver" ${WITH_EXTENSIONS})
|
||||||
|
OPTION(WITH_SQLITE3 " Enable MYDDAS SQLITE3 driver" ${WITH_MYDDAS})
|
||||||
|
OPTION(WITH_MYSQL " Enable MYDDAS MYSQL driver" ${WITH_MYDDAS})
|
||||||
|
OPTION(WITH_ODBC " Enable MYDDAS ODBC driver" ${WITH_MYDDAS})
|
||||||
|
OPTION(WITH_POSTGRES " Enable MYDDAS POSTGRES driver" ${WITH_MYDDAS})
|
||||||
|
OPTION(WITH_SQLITE3 " Enable MYDDAS SQLITE3 driver" ${WITH_MYDDAS})
|
||||||
|
OPTION(WITH_SWIG " Enable SWIG interfaces to foreign languages" ${WITH_EXTENSIONS})
|
||||||
|
OPTION(WITH_RAPTOR " Enable the RAPTOR RDF library" ${WITH_EXTENSIONS})
|
||||||
|
OPTION(WITH_XML2 " Enable the RAPTOR XML2 library" ${WITH_EXTENSIONS})
|
||||||
|
OPTION(WITH_XML " Enable the Prolog XML library" ${WITH_EXTENSIONS})
|
||||||
|
OPTION(WITH_CLPBN" Enable the CLPBN and PFL probabilistic languages" ${WITH_EXTENSIONS})
|
||||||
|
OPTION(WITH_HORUS " Enable the HORUS inference libraray for CLPBN and PFL" ${WITH_CLPBN})
|
||||||
|
option(WITH_PROBLOG "include Problog-I." ${WITH_EXTENSIONS})
|
||||||
|
OPTION(WITH_CPLINT " Enable the cplint probabilistic language" ${WITH_EXTENSIONS})
|
||||||
|
option(WITH_GECODE "interface gecode constraint solver" ${WITH_EXTENSIONS})
|
||||||
|
option(WITH_LBFGS "interface with lbfgs" ${WITH_EXTENSIONS})
|
||||||
|
option(WITH_PRISM "use PRISM system in YAP" ${WITH_EXTENSIONS})
|
||||||
|
option(WITH_PYTHON "Allow Python->YAP and YAP->Python" ${WITH_EXTENSIONS})
|
||||||
|
option(WITH_R "Use R Interface" ${WITH_EXTENSIONS})
|
||||||
|
option(WITH_JAVA "Try to use Java (currently Java 6,7,8)" ${WITH_EXTENSIONS})
|
||||||
|
|
||||||
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
|
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
|
||||||
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
|
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
|
||||||
|
@ -128,6 +128,7 @@ extern X_API Int YAP_RunGoalOnce(Term);
|
|||||||
/* cdmgr.c */
|
/* cdmgr.c */
|
||||||
extern Term Yap_all_calls(void);
|
extern Term Yap_all_calls(void);
|
||||||
extern Atom Yap_ConsultingFile(USES_REGS1);
|
extern Atom Yap_ConsultingFile(USES_REGS1);
|
||||||
|
extern bool Yap_Consulting(USES_REGS1);
|
||||||
extern struct pred_entry *Yap_PredForChoicePt(choiceptr bptr, op_numbers *op);
|
extern struct pred_entry *Yap_PredForChoicePt(choiceptr bptr, op_numbers *op);
|
||||||
extern void Yap_InitCdMgr(void);
|
extern void Yap_InitCdMgr(void);
|
||||||
extern struct pred_entry *Yap_PredFromClause(Term t USES_REGS);
|
extern struct pred_entry *Yap_PredFromClause(Term t USES_REGS);
|
||||||
|
@ -210,6 +210,7 @@ compose_message(error(E, Exc), Level) -->
|
|||||||
c_goal( error(E, Exc), Level ),
|
c_goal( error(E, Exc), Level ),
|
||||||
caller( error(E, Exc), Level ),
|
caller( error(E, Exc), Level ),
|
||||||
extra_info( error(E, Exc), Level ),
|
extra_info( error(E, Exc), Level ),
|
||||||
|
% { stop_low_level_trace },
|
||||||
!,
|
!,
|
||||||
[nl],
|
[nl],
|
||||||
[nl].
|
[nl].
|
||||||
@ -255,16 +256,16 @@ compose_message(Throw, _Level) -->
|
|||||||
!,
|
!,
|
||||||
[ 'UNHANDLED EXCEPTION - message ~w unknown' - [Throw] ].
|
[ 'UNHANDLED EXCEPTION - message ~w unknown' - [Throw] ].
|
||||||
|
|
||||||
location(error(syntax_error(_),Info), _Level , LC) -->
|
location( error(_,Info), Level, _LC ) -->
|
||||||
{ '$error_descriptor'(Info, Desc) },
|
{ '$error_descriptor'(Info, Desc) },
|
||||||
{ query_exception(parserReadingCode, Desc, true) },
|
{ query_exception(prologConsulting, Desc, true) },
|
||||||
{LC > 0},
|
{ query_exception(parserReadingCode, Desc, true)},
|
||||||
!,
|
!,
|
||||||
{
|
{
|
||||||
query_exception(parserFile, Desc, FileName),
|
query_exception(parserFile, Desc, FileName),
|
||||||
query_exception(parserLine, Desc, LN)
|
query_exception(parserLine, Desc, LN)
|
||||||
},
|
},
|
||||||
[ '~a:~d:~d: ' - [FileName,LN,0] ] .
|
[ '~a:~d:~d: ~a:' - [FileName,LN,0,Level] ] .
|
||||||
location(style_check(A,LN,FileName,B ), Level , LC) -->
|
location(style_check(A,LN,FileName,B ), Level , LC) -->
|
||||||
!,
|
!,
|
||||||
display_consulting( FileName, Level,style_check(A,LN,FileName,B ), LC ),
|
display_consulting( FileName, Level,style_check(A,LN,FileName,B ), LC ),
|
||||||
@ -310,7 +311,7 @@ main_message( error(syntax_error(Msg),Info), Level, _LC ) -->
|
|||||||
query_exception(parserTextB, Desc, T),
|
query_exception(parserTextB, Desc, T),
|
||||||
query_exception(parserLine, Desc, L)
|
query_exception(parserLine, Desc, L)
|
||||||
},
|
},
|
||||||
[' ~a: syntax error ~s' - [Level,Msg]],
|
[' syntax error ~s' - [Level,Msg]],
|
||||||
[nl],
|
[nl],
|
||||||
[' ~s <<== at line ~d == ~s !' - [J,L,T], nl ].
|
[' ~s <<== at line ~d == ~s !' - [J,L,T], nl ].
|
||||||
main_message(style_check(singleton(SVs),_Pos,_File,P), _Level, _LC) -->
|
main_message(style_check(singleton(SVs),_Pos,_File,P), _Level, _LC) -->
|
||||||
@ -379,7 +380,6 @@ display_consulting( F, Level, _, LC) -->
|
|||||||
display_consulting(_F, _, _, _LC) -->
|
display_consulting(_F, _, _, _LC) -->
|
||||||
[].
|
[].
|
||||||
|
|
||||||
c_goal( error(syntax_error(_),Info), _) --> !.
|
|
||||||
c_goal( error(_,Info), _) -->
|
c_goal( error(_,Info), _) -->
|
||||||
{ '$error_descriptor'(Info, Desc) },
|
{ '$error_descriptor'(Info, Desc) },
|
||||||
({ query_exception(errorGoal, Desc, Call),
|
({ query_exception(errorGoal, Desc, Call),
|
||||||
@ -399,6 +399,7 @@ c_goal( error(_,Info), _) -->
|
|||||||
!.
|
!.
|
||||||
c_goal(_,_) --> [].
|
c_goal(_,_) --> [].
|
||||||
|
|
||||||
|
caller( error(syntax_error(_),_Info), _Level ) --> !.
|
||||||
caller( error(_,Info), Level ) -->
|
caller( error(_,Info), Level ) -->
|
||||||
{ '$error_descriptor'(Info, Desc) },
|
{ '$error_descriptor'(Info, Desc) },
|
||||||
{ query_exception(errorFile, Desc, File),
|
{ query_exception(errorFile, Desc, File),
|
||||||
|
Reference in New Issue
Block a user