本文整理汇总了C++中Translator::doneStackPop方法的典型用法代码示例。如果您正苦于以下问题:C++ Translator::doneStackPop方法的具体用法?C++ Translator::doneStackPop怎么用?C++ Translator::doneStackPop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Translator
的用法示例。
在下文中一共展示了Translator::doneStackPop方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: letTranslate
// LET command translate function
TokenStatus letTranslate(Translator &translator, Token *commandToken,
Token *&token)
{
TokenStatus status;
int column;
bool hidden;
DataType dataType;
bool done;
TokenStack letStack;
bool haveSubStr = false;
if (commandToken == NULL)
{
column = token->column();
hidden = true;
}
else // delete unneeded command token and get another token
{
column = commandToken->column();
delete commandToken;
hidden = false;
}
dataType = Any_DataType;
do
{
if ((status = translator.getOperand(token, dataType,
Translator::All_Reference)) != Good_TokenStatus)
{
if (token->column() > column)
{
return status;
}
// next token determines error
Token *nextToken;
if ((status = translator.getToken(nextToken)) != Good_TokenStatus)
{
status = ExpCmd_TokenStatus;
}
if (nextToken->isCode(Comma_Code) || nextToken->isCode(Eq_Code))
{
status = ExpAssignItem_TokenStatus;
}
else
{
status = ExpCmd_TokenStatus;
}
delete nextToken;
return status;
}
// get and check next token for comma or equal
status = translator.getToken(token);
if (token->isCode(Comma_Code))
{
done = false;
}
else if (token->isCode(Eq_Code))
{
done = true;
}
else // invalid token or parser error
{
if (translator.table().hasFlag(translator.doneStackTopToken(),
SubStr_Flag))
{
delete translator.doneStackPop();
}
return ExpEqualOrComma_TokenStatus;
}
// check if this is a sub-string assignment
if (translator.table().hasFlag(translator.doneStackTopToken(),
SubStr_Flag))
{
// delete comma/equal token, use sub-string function token
delete token;
// get sub-string function token from rpn item on top of stack
// (delete rpn item since it was not appended to output)
RpnItem *rpnItem = translator.doneStackPop();
token = rpnItem->token();
rpnItem->setToken(NULL); // prevent delete of token
delete rpnItem;
// change to assign sub-string code (first associated code)
translator.table().setToken(token,
translator.table().associatedCode(token->code()));
haveSubStr = true;
}
else // use comma/equal token
{
// change token to appropriate assign code
translator.table().setToken(token, Assign_Code);
status = translator.processDoneStackTop(token);
if (status != Good_TokenStatus)
{
return status;
}
//.........这里部分代码省略.........