本文整理汇总了C++中Translator::outputInsert方法的典型用法代码示例。如果您正苦于以下问题:C++ Translator::outputInsert方法的具体用法?C++ Translator::outputInsert怎么用?C++ Translator::outputInsert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Translator
的用法示例。
在下文中一共展示了Translator::outputInsert方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: inputTranslate
// INPUT command translate function
TokenStatus inputTranslate(Translator &translator, Token *commandToken,
Token *&token)
{
TokenStatus status;
int indexBegin;
bool done;
Token *inputToken;
if (commandToken->isCode(Input_Code))
{
token = translator.table().newToken(InputBegin_Code);
}
else // InputPrompt_Code
{
token = NULL;
status = translator.getExpression(token, String_DataType);
if (status != Done_TokenStatus)
{
if (status == Parser_TokenStatus
&& token->isDataType(None_DataType))
{
status = ExpSemiOrComma_TokenStatus;
}
delete commandToken;
return status;
}
translator.doneStackDrop();
if (token->isCode(Comma_Code))
{
token->addSubCode(Option_SubCode);
}
else if (!token->isCode(SemiColon_Code))
{
delete commandToken;
return ExpOpSemiOrComma_TokenStatus;
}
token->setCode(InputBeginStr_Code);
}
// save index where to insert input parse codes and append input begin
indexBegin = translator.outputCount();
translator.outputAppend(token);
// loop to read input variables
do
{
// get variable reference
token = NULL;
if ((status = translator.getOperand(token, Any_DataType,
Translator::Variable_Reference)) != Good_TokenStatus)
{
break;
}
// get and check next token
if ((status = translator.getToken(token)) != Good_TokenStatus)
{
status = ExpCommaSemiOrEnd_TokenStatus;
break;
}
if (token->isCode(Comma_Code))
{
done = false;
inputToken = token;
}
else if (token->isCode(SemiColon_Code))
{
commandToken->addSubCode(Option_SubCode);
done = true;
inputToken = token;
// get and check next token
if ((status = translator.getToken(token)) != Good_TokenStatus)
{
status = ExpEndStmt_TokenStatus;
break;
}
}
else // possible end-of-statement (checked below)
{
done = true;
inputToken = new Token;
}
// change token to appropriate assign code and append to output
translator.table().setToken(inputToken, InputAssign_Code);
status = translator.processFinalOperand(inputToken);
if (status != Good_TokenStatus)
{
break;
}
// create and insert input parse code at beginning
// (inserted in reverse order for each input variable)
translator.outputInsert(indexBegin, translator.table()
.newToken(translator.table()
.secondAssociatedCode(inputToken->code())));
}
while (!done);
//.........这里部分代码省略.........