本文整理汇总了C++中SyntaxErrorMessage函数的典型用法代码示例。如果您正苦于以下问题:C++ SyntaxErrorMessage函数的具体用法?C++ SyntaxErrorMessage怎么用?C++ SyntaxErrorMessage使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SyntaxErrorMessage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParseQueryRestrictions
/***********************************************************************
NAME : ParseQueryNoAction
DESCRIPTION : Parses the following functions :
(any-instancep)
(find-first-instance)
(find-all-instances)
INPUTS : 1) The address of the top node of the query function
2) The logical name of the input
RETURNS : The completed expression chain, or NULL on errors
SIDE EFFECTS : The expression chain is extended, or the "top" node
is deleted on errors
NOTES : H/L Syntax :
(<function> <query-block>)
<query-block> :== (<instance-var>+) <query-expression>
<instance-var> :== (<var-name> <class-name>+)
Parses into following form :
<query-function>
|
V
<query-expression> ->
<class-1a> -> <class-1b> -> (QDS) ->
<class-2a> -> <class-2b> -> (QDS) -> ...
***********************************************************************/
globle EXPRESSION *ParseQueryNoAction(
void *theEnv,
EXPRESSION *top,
char *readSource)
{
EXPRESSION *insQuerySetVars;
struct token queryInputToken;
insQuerySetVars = ParseQueryRestrictions(theEnv,top,readSource,&queryInputToken);
if (insQuerySetVars == NULL)
return(NULL);
IncrementIndentDepth(theEnv,3);
PPCRAndIndent(theEnv);
if (ParseQueryTestExpression(theEnv,top,readSource) == FALSE)
{
DecrementIndentDepth(theEnv,3);
ReturnExpression(theEnv,insQuerySetVars);
return(NULL);
}
DecrementIndentDepth(theEnv,3);
GetToken(theEnv,readSource,&queryInputToken);
if (GetType(queryInputToken) != RPAREN)
{
SyntaxErrorMessage(theEnv,"instance-set query function");
ReturnExpression(theEnv,top);
ReturnExpression(theEnv,insQuerySetVars);
return(NULL);
}
ReplaceInstanceVariables(theEnv,insQuerySetVars,top->argList,TRUE,0);
ReturnExpression(theEnv,insQuerySetVars);
return(top);
}
示例2: GetToken
globle struct expr *Function0Parse(
void *theEnv,
char *logicalName)
{
struct token theToken;
struct expr *top;
/*=================================*/
/* All functions begin with a '('. */
/*=================================*/
GetToken(theEnv,logicalName,&theToken);
if (theToken.type != LPAREN)
{
SyntaxErrorMessage(theEnv,"function calls");
return(NULL);
}
/*=================================*/
/* Parse the rest of the function. */
/*=================================*/
top = Function1Parse(theEnv,logicalName);
return(top);
}
示例3: PrintErrorID
static struct expr *BreakParse(
void *theEnv,
struct expr *top,
char *infile)
{
struct token theToken;
if (ExpressionData(theEnv)->svContexts->brk == FALSE)
{
PrintErrorID(theEnv,"PRCDRPSR",2,TRUE);
EnvPrintRouter(theEnv,WERROR,"The break function not valid in this context.\n");
ReturnExpression(theEnv,top);
return(NULL);
}
SavePPBuffer(theEnv," ");
GetToken(theEnv,infile,&theToken);
if (theToken.type != RPAREN)
{
SyntaxErrorMessage(theEnv,"break function");
ReturnExpression(theEnv,top);
return(NULL);
}
PPBackup(theEnv);
PPBackup(theEnv);
SavePPBuffer(theEnv,")");
return(top);
}
示例4: while
/**********************************************************
NAME : DetermineQueryTemplates
DESCRIPTION : Builds a list of templates to be used in
fact queries - uses parse form.
INPUTS : 1) The parse template expression chain
2) The name of the function being executed
3) Caller's buffer for restriction count
(# of separate lists)
RETURNS : The query list, or NULL on errors
SIDE EFFECTS : Memory allocated for list
Busy count incremented for all templates
NOTES : Each restriction is linked by nxt pointer,
multiple templates in a restriction are
linked by the chain pointer.
Rcnt caller's buffer is set to reflect the
total number of chains
Assumes templateExp is not NULL and that each
restriction chain is terminated with
the QUERY_DELIMITER_SYMBOL "(QDS)"
**********************************************************/
static QUERY_TEMPLATE *DetermineQueryTemplates(
Environment *theEnv,
Expression *templateExp,
const char *func,
unsigned *rcnt)
{
QUERY_TEMPLATE *clist = NULL, *cnxt = NULL, *cchain = NULL, *tmp;
bool new_list = false;
UDFValue temp;
Deftemplate *theDeftemplate;
*rcnt = 0;
while (templateExp != NULL)
{
theDeftemplate = NULL;
if (templateExp->type == DEFTEMPLATE_PTR)
{ theDeftemplate = (Deftemplate *) templateExp->value; }
else if (EvaluateExpression(theEnv,templateExp,&temp))
{
DeleteQueryTemplates(theEnv,clist);
return NULL;
}
if ((theDeftemplate == NULL) &&
(temp.value == (void *) FactQueryData(theEnv)->QUERY_DELIMITER_SYMBOL))
{
new_list = true;
(*rcnt)++;
}
else if ((tmp = FormChain(theEnv,func,theDeftemplate,&temp)) != NULL)
{
if (clist == NULL)
{ clist = cnxt = cchain = tmp; }
else if (new_list == true)
{
new_list = false;
cnxt->nxt = tmp;
cnxt = cchain = tmp;
}
else
{ cchain->chain = tmp; }
while (cchain->chain != NULL)
{ cchain = cchain->chain; }
}
else
{
SyntaxErrorMessage(theEnv,"fact-set query class restrictions");
DeleteQueryTemplates(theEnv,clist);
SetEvaluationError(theEnv,true);
return NULL;
}
templateExp = templateExp->nextArg;
}
return clist;
}
示例5: GetToken
globle struct lhsParseNode *DeftemplateLHSParse(
void *theEnv,
char *readSource,
struct deftemplate *theDeftemplate)
{
struct lhsParseNode *head, *firstSlot;
struct token theToken;
int error;
/*===============================================================*/
/* Make sure the deftemplate name is not connected to subfields. */
/*===============================================================*/
GetToken(theEnv,readSource,&theToken);
if ((theToken.type == OR_CONSTRAINT) || (theToken.type == AND_CONSTRAINT))
{
SyntaxErrorMessage(theEnv,(char*)"deftemplate patterns");
return(NULL);
}
/*===================================================*/
/* Create the pattern node for the deftemplate name. */
/*===================================================*/
head = GetLHSParseNode(theEnv);
head->type = SF_WILDCARD;
head->negated = FALSE;
head->exists = FALSE;
head->index = 0;
head->slotNumber = 1;
head->bottom = GetLHSParseNode(theEnv);
head->bottom->type = SYMBOL;
head->bottom->negated = FALSE;
head->bottom->exists = FALSE;
head->bottom->value = (void *) theDeftemplate->header.name;
/*==========================================*/
/* Get the other fields in the deftemplate. */
/*==========================================*/
error = FALSE;
firstSlot = GetLHSSlots(theEnv,readSource,&theToken,theDeftemplate,&error);
if (error)
{
ReturnLHSParseNodes(theEnv,firstSlot);
ReturnLHSParseNodes(theEnv,head);
return(NULL);
}
/*=========================*/
/* Return the LHS pattern. */
/*=========================*/
head->right = firstSlot;
return(head);
}
示例6: ParseQueryTestExpression
/*************************************************************
NAME : ParseQueryTestExpression
DESCRIPTION : Parses the test-expression for a query
INPUTS : 1) The top node of the query expression
2) The logical name of the input
RETURNS : TRUE if all OK, FALSE otherwise
SIDE EFFECTS : Entire query-expression deleted on errors
Nodes allocated for new expression
Test shoved in front of class-restrictions on
query argument list
NOTES : Expects top != NULL
*************************************************************/
static int ParseQueryTestExpression(
void *theEnv,
EXPRESSION *top,
const char *readSource)
{
EXPRESSION *qtest;
int error;
struct BindInfo *oldBindList;
error = FALSE;
oldBindList = GetParsedBindNames(theEnv);
SetParsedBindNames(theEnv,NULL);
qtest = ArgumentParse(theEnv,readSource,&error);
if (error == TRUE)
{
ClearParsedBindNames(theEnv);
SetParsedBindNames(theEnv,oldBindList);
ReturnExpression(theEnv,top);
return(FALSE);
}
if (qtest == NULL)
{
ClearParsedBindNames(theEnv);
SetParsedBindNames(theEnv,oldBindList);
SyntaxErrorMessage(theEnv,"fact-set query function");
ReturnExpression(theEnv,top);
return(FALSE);
}
qtest->nextArg = top->argList;
top->argList = qtest;
if (ParsedBindNamesEmpty(theEnv) == FALSE)
{
ClearParsedBindNames(theEnv);
SetParsedBindNames(theEnv,oldBindList);
PrintErrorID(theEnv,"FACTQPSR",2,FALSE);
EnvPrintRouter(theEnv,WERROR,"Binds are not allowed in fact-set query in function ");
EnvPrintRouter(theEnv,WERROR,ValueToString(ExpressionFunctionCallName(top)));
EnvPrintRouter(theEnv,WERROR,".\n");
ReturnExpression(theEnv,top);
return(FALSE);
}
SetParsedBindNames(theEnv,oldBindList);
return(TRUE);
}
示例7: ParseAutoFocus
static void ParseAutoFocus(
void *theEnv,
EXEC_STATUS,
char *readSource,
int *error)
{
struct token theToken;
/*========================================*/
/* The auto-focus value must be a symbol. */
/*========================================*/
SavePPBuffer(theEnv,execStatus," ");
GetToken(theEnv,execStatus,readSource,&theToken);
if (theToken.type != SYMBOL)
{
SyntaxErrorMessage(theEnv,execStatus,"auto-focus statement");
*error = TRUE;
return;
}
/*====================================================*/
/* The auto-focus value must be either TRUE or FALSE. */
/* If a valid value is parsed, then set the value of */
/* the global variable GlobalAutoFocus. */
/*====================================================*/
if (strcmp(ValueToString(theToken.value),"TRUE") == 0)
{ PatternData(theEnv,execStatus)->GlobalAutoFocus = TRUE; }
else if (strcmp(ValueToString(theToken.value),"FALSE") == 0)
{ PatternData(theEnv,execStatus)->GlobalAutoFocus = FALSE; }
else
{
SyntaxErrorMessage(theEnv,execStatus,"auto-focus statement");
*error = TRUE;
}
}
示例8: while
/**********************************************************
NAME : DetermineQueryClasses
DESCRIPTION : Builds a list of classes to be used in
instance queries - uses parse form.
INPUTS : 1) The parse class expression chain
2) The name of the function being executed
3) Caller's buffer for restriction count
(# of separate lists)
RETURNS : The query list, or NULL on errors
SIDE EFFECTS : Memory allocated for list
Busy count incremented for all classes
NOTES : Each restriction is linked by nxt pointer,
multiple classes in a restriction are
linked by the chain pointer.
Rcnt caller's buffer is set to reflect the
total number of chains
Assumes classExp is not NULL and that each
restriction chain is terminated with
the QUERY_DELIMITER_SYMBOL "(QDS)"
**********************************************************/
static QUERY_CLASS *DetermineQueryClasses(
void *theEnv,
EXEC_STATUS,
EXPRESSION *classExp,
char *func,
unsigned *rcnt)
{
QUERY_CLASS *clist = NULL,*cnxt = NULL,*cchain = NULL,*tmp;
int new_list = FALSE;
DATA_OBJECT temp;
*rcnt = 0;
while (classExp != NULL)
{
if (EvaluateExpression(theEnv,execStatus,classExp,&temp))
{
DeleteQueryClasses(theEnv,execStatus,clist);
return(NULL);
}
if ((temp.type == SYMBOL) && (temp.value == (void *) InstanceQueryData(theEnv,execStatus)->QUERY_DELIMETER_SYMBOL))
{
new_list = TRUE;
(*rcnt)++;
}
else if ((tmp = FormChain(theEnv,execStatus,func,&temp)) != NULL)
{
if (clist == NULL)
clist = cnxt = cchain = tmp;
else if (new_list == TRUE)
{
new_list = FALSE;
cnxt->nxt = tmp;
cnxt = cchain = tmp;
}
else
cchain->chain = tmp;
while (cchain->chain != NULL)
cchain = cchain->chain;
}
else
{
SyntaxErrorMessage(theEnv,execStatus,"instance-set query class restrictions");
DeleteQueryClasses(theEnv,execStatus,clist);
SetEvaluationError(theEnv,execStatus,TRUE);
return(NULL);
}
classExp = classExp->nextArg;
}
return(clist);
}
示例9: ExpressionData
static struct expr *ReturnParse(
void *theEnv,
struct expr *top,
char *infile)
{
int error_flag = FALSE;
struct token theToken;
if (ExpressionData(theEnv)->svContexts->rtn == TRUE)
ExpressionData(theEnv)->ReturnContext = TRUE;
if (ExpressionData(theEnv)->ReturnContext == FALSE)
{
PrintErrorID(theEnv,"PRCDRPSR",2,TRUE);
EnvPrintRouter(theEnv,WERROR,"The return function is not valid in this context.\n");
ReturnExpression(theEnv,top);
return(NULL);
}
ExpressionData(theEnv)->ReturnContext = FALSE;
SavePPBuffer(theEnv," ");
top->argList = ArgumentParse(theEnv,infile,&error_flag);
if (error_flag)
{
ReturnExpression(theEnv,top);
return(NULL);
}
else if (top->argList == NULL)
{
PPBackup(theEnv);
PPBackup(theEnv);
SavePPBuffer(theEnv,")");
}
else
{
SavePPBuffer(theEnv," ");
GetToken(theEnv,infile,&theToken);
if (theToken.type != RPAREN)
{
SyntaxErrorMessage(theEnv,"return function");
ReturnExpression(theEnv,top);
return(NULL);
}
PPBackup(theEnv);
PPBackup(theEnv);
SavePPBuffer(theEnv,")");
}
return(top);
}
示例10: while
/**********************************************************
NAME : DetermineQueryTemplates
DESCRIPTION : Builds a list of templates to be used in
fact queries - uses parse form.
INPUTS : 1) The parse template expression chain
2) The name of the function being executed
3) Caller's buffer for restriction count
(# of separate lists)
RETURNS : The query list, or NULL on errors
SIDE EFFECTS : Memory allocated for list
Busy count incremented for all templates
NOTES : Each restriction is linked by nxt pointer,
multiple templates in a restriction are
linked by the chain pointer.
Rcnt caller's buffer is set to reflect the
total number of chains
Assumes classExp is not NULL and that each
restriction chain is terminated with
the QUERY_DELIMITER_SYMBOL "(QDS)"
**********************************************************/
static QUERY_TEMPLATE *DetermineQueryTemplates(
void *theEnv,
EXPRESSION *templateExp,
char *func,
unsigned *rcnt)
{
QUERY_TEMPLATE *clist = NULL,*cnxt = NULL,*cchain = NULL,*tmp;
int new_list = FALSE;
DATA_OBJECT temp;
*rcnt = 0;
while (templateExp != NULL)
{
if (EvaluateExpression(theEnv,templateExp,&temp))
{
DeleteQueryTemplates(theEnv,clist);
return(NULL);
}
if ((temp.type == SYMBOL) && (temp.value == (void *) FactQueryData(theEnv)->QUERY_DELIMETER_SYMBOL))
{
new_list = TRUE;
(*rcnt)++;
}
else if ((tmp = FormChain(theEnv,func,&temp)) != NULL)
{
if (clist == NULL)
clist = cnxt = cchain = tmp;
else if (new_list == TRUE)
{
new_list = FALSE;
cnxt->nxt = tmp;
cnxt = cchain = tmp;
}
else
cchain->chain = tmp;
while (cchain->chain != NULL)
cchain = cchain->chain;
}
else
{
SyntaxErrorMessage(theEnv,"fact-set query class restrictions");
DeleteQueryTemplates(theEnv,clist);
SetEvaluationError(theEnv,TRUE);
return(NULL);
}
templateExp = templateExp->nextArg;
}
return(clist);
}
示例11: while
/********************************************************************************
NAME : ParseSlotOverrides
DESCRIPTION : Forms expressions for slot-overrides
INPUTS : 1) The logical name of the input
2) Caller's buffer for error flkag
RETURNS : Address override expressions, NULL
if none or error.
SIDE EFFECTS : Slot-expression built
Caller's error flag set
NOTES : <slot-override> ::= (<slot-name> <value>*)*
goes to
<slot-name> --> <dummy-node> --> <slot-name> --> <dummy-node>...
|
V
<value-expression> --> <value-expression> --> ...
Assumes first token has already been scanned
********************************************************************************/
globle EXPRESSION *ParseSlotOverrides(
void *theEnv,
const char *readSource,
int *error)
{
EXPRESSION *top = NULL,*bot = NULL,*theExp;
EXPRESSION *theExpNext;
while (GetType(DefclassData(theEnv)->ObjectParseToken) == LPAREN)
{
*error = FALSE;
theExp = ArgumentParse(theEnv,readSource,error);
if (*error == TRUE)
{
ReturnExpression(theEnv,top);
return(NULL);
}
else if (theExp == NULL)
{
SyntaxErrorMessage(theEnv,"slot-override");
*error = TRUE;
ReturnExpression(theEnv,top);
SetEvaluationError(theEnv,TRUE);
return(NULL);
}
theExpNext = GenConstant(theEnv,SYMBOL,EnvTrueSymbol(theEnv));
if (CollectArguments(theEnv,theExpNext,readSource) == NULL)
{
*error = TRUE;
ReturnExpression(theEnv,top);
ReturnExpression(theEnv,theExp);
return(NULL);
}
theExp->nextArg = theExpNext;
if (top == NULL)
top = theExp;
else
bot->nextArg = theExp;
bot = theExp->nextArg;
PPCRAndIndent(theEnv);
GetToken(theEnv,readSource,&DefclassData(theEnv)->ObjectParseToken);
}
PPBackup(theEnv);
PPBackup(theEnv);
SavePPBuffer(theEnv,DefclassData(theEnv)->ObjectParseToken.printForm);
return(top);
}
示例12: SavePPBuffer
static struct lhsParseNode *TestPattern(
void *theEnv,
EXEC_STATUS,
char *readSource,
int *error)
{
struct lhsParseNode *theNode;
struct token theToken;
struct expr *theExpression;
/*================================================*/
/* Create the data specification for the test CE. */
/*================================================*/
SavePPBuffer(theEnv,execStatus," ");
theNode = GetLHSParseNode(theEnv,execStatus);
theNode->type = TEST_CE;
theExpression = Function0Parse(theEnv,execStatus,readSource);
theNode->expression = ExpressionToLHSParseNodes(theEnv,execStatus,theExpression);
ReturnExpression(theEnv,execStatus,theExpression);
if (theNode->expression == NULL)
{
*error = TRUE;
ReturnLHSParseNodes(theEnv,execStatus,theNode);
return(NULL);
}
/*=========================================================*/
/* Check for the closing right parenthesis of the test CE. */
/*=========================================================*/
GetToken(theEnv,execStatus,readSource,&theToken);
if (theToken.type != RPAREN)
{
SyntaxErrorMessage(theEnv,execStatus,"test conditional element");
*error = TRUE;
ReturnLHSParseNodes(theEnv,execStatus,theNode);
return(NULL);
}
/*=====================*/
/* Return the test CE. */
/*=====================*/
return(theNode);
}
示例13: ParseQueryRestrictions
/***********************************************************************
NAME : FactParseQueryAction
DESCRIPTION : Parses the following functions :
(do-for-fact)
(do-for-all-facts)
(delayed-do-for-all-facts)
INPUTS : 1) The address of the top node of the query function
2) The logical name of the input
RETURNS : The completed expression chain, or NULL on errors
SIDE EFFECTS : The expression chain is extended, or the "top" node
is deleted on errors
NOTES : H/L Syntax :
(<function> <query-block> <query-action>)
<query-block> :== (<fact-var>+) <query-expression>
<fact-var> :== (<var-name> <template-name>+)
Parses into following form :
<query-function>
|
V
<query-expression> -> <query-action> ->
<template-1a> -> <template-1b> -> (QDS) ->
<template-2a> -> <template-2b> -> (QDS) -> ...
***********************************************************************/
globle EXPRESSION *FactParseQueryAction(
void *theEnv,
EXPRESSION *top,
const char *readSource)
{
EXPRESSION *factQuerySetVars;
struct token queryInputToken;
factQuerySetVars = ParseQueryRestrictions(theEnv,top,readSource,&queryInputToken);
if (factQuerySetVars == NULL)
{ return(NULL); }
IncrementIndentDepth(theEnv,3);
PPCRAndIndent(theEnv);
if (ParseQueryTestExpression(theEnv,top,readSource) == FALSE)
{
DecrementIndentDepth(theEnv,3);
ReturnExpression(theEnv,factQuerySetVars);
return(NULL);
}
PPCRAndIndent(theEnv);
if (ParseQueryActionExpression(theEnv,top,readSource,factQuerySetVars,&queryInputToken) == FALSE)
{
DecrementIndentDepth(theEnv,3);
ReturnExpression(theEnv,factQuerySetVars);
return(NULL);
}
DecrementIndentDepth(theEnv,3);
if (GetType(queryInputToken) != RPAREN)
{
SyntaxErrorMessage(theEnv,"fact-set query function");
ReturnExpression(theEnv,top);
ReturnExpression(theEnv,factQuerySetVars);
return(NULL);
}
ReplaceFactVariables(theEnv,factQuerySetVars,top->argList,TRUE,0);
ReplaceFactVariables(theEnv,factQuerySetVars,top->argList->nextArg,FALSE,0);
ReturnExpression(theEnv,factQuerySetVars);
return(top);
}
示例14: while
/********************************************************************************
NAME : ParseSlotOverrides
DESCRIPTION : Forms expressions for slot-overrides
INPUTS : 1) The logical name of the input
2) Caller's buffer for error flkag
RETURNS : Address override expressions, NULL
if none or error.
SIDE EFFECTS : Slot-expression built
Caller's error flag set
NOTES : <slot-override> ::= (<slot-name> <value>*)*
goes to
<slot-name> --> <dummy-node> --> <slot-name> --> <dummy-node>...
|
V
<value-expression> --> <value-expression> --> ...
Assumes first token has already been scanned
********************************************************************************/
globle EXPRESSION *ParseSlotOverrides(
char *readSource,
int *error)
{
EXPRESSION *top = NULL,*bot = NULL,*exp;
while (GetType(ObjectParseToken) == LPAREN)
{
*error = FALSE;
exp = ArgumentParse(readSource,error);
if (*error == TRUE)
{
ReturnExpression(top);
return(NULL);
}
else if (exp == NULL)
{
SyntaxErrorMessage("slot-override");
*error = TRUE;
ReturnExpression(top);
SetEvaluationError(TRUE);
return(NULL);
}
exp->nextArg = GenConstant(SYMBOL,TrueSymbol);
if (CollectArguments(exp->nextArg,readSource) == NULL)
{
*error = TRUE;
ReturnExpression(top);
return(NULL);
}
if (top == NULL)
top = exp;
else
bot->nextArg = exp;
bot = exp->nextArg;
PPCRAndIndent();
GetToken(readSource,&ObjectParseToken);
}
PPBackup();
PPBackup();
SavePPBuffer(ObjectParseToken.print_rep);
return(top);
}
示例15: SavePPBuffer
static struct expr *ParseRuleRHS(
void *theEnv,
const char *readSource)
{
struct expr *actions;
struct token theToken;
/*=========================================================*/
/* Process the actions on the right hand side of the rule. */
/*=========================================================*/
SavePPBuffer(theEnv,"\n ");
SetIndentDepth(theEnv,3);
actions = GroupActions(theEnv,readSource,&theToken,TRUE,NULL,FALSE);
if (actions == NULL) return(NULL);
/*=============================*/
/* Reformat the closing token. */
/*=============================*/
PPBackup(theEnv);
PPBackup(theEnv);
SavePPBuffer(theEnv,theToken.printForm);
/*======================================================*/
/* Check for the closing right parenthesis of the rule. */
/*======================================================*/
if (theToken.type != RPAREN)
{
SyntaxErrorMessage(theEnv,"defrule");
ReturnExpression(theEnv,actions);
return(NULL);
}
/*========================*/
/* Return the rule's RHS. */
/*========================*/
return(actions);
}