本文整理汇总了C++中NxsToken::GetTokenReference方法的典型用法代码示例。如果您正苦于以下问题:C++ NxsToken::GetTokenReference方法的具体用法?C++ NxsToken::GetTokenReference怎么用?C++ NxsToken::GetTokenReference使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NxsToken
的用法示例。
在下文中一共展示了NxsToken::GetTokenReference方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleTaxaCommand
void NxsTaxaAssociationBlock::HandleTaxaCommand(
NxsToken &token)
{
if (!this->nexusReader)
{
NxsNCLAPIException("No NxsReader when reading TaxaAssociation block.");
}
token.GetNextToken();
this->firstTaxaBlock = this->ProcessTaxaBlockName(token.GetTokenReference(), token);
token.GetNextToken();
if (!token.Equals(","))
{
errormsg << "Expecting comma in the TAXA command, found \"" << token.GetTokenReference() << "\".";
throw NxsException(errormsg, token);
}
token.GetNextToken();
this->secondTaxaBlock = this->ProcessTaxaBlockName(token.GetTokenReference(), token);
NxsToken::DemandEndSemicolon(token, this->errormsg, "TAXA");
}
示例2: SkipCommand
void NxsBlock::SkipCommand(NxsToken & token)
{
if (nexusReader)
{
errormsg = "Skipping command: ";
errormsg << token.GetTokenReference();
nexusReader->NexusWarnToken(errormsg, NxsReader::SKIPPING_CONTENT_WARNING, token);
errormsg.clear();
}
if (!token.Equals(";"))
SkippingCommand(token.GetToken());
if (storeSkippedCommands)
{
ProcessedNxsCommand pnc;
token.ProcessAsCommand(&pnc);
skippedCommands.push_back(pnc);
}
else
token.ProcessAsCommand(NULL);
}
示例3: CoreExecutionTasks
/*! used internally to do most of the work of Execute() */
void NxsReader::CoreExecutionTasks(
NxsToken &token, /* the token object used to grab NxsReader tokens */
bool notifyStartStop) /* if true, ExecuteStarting and ExecuteStopping will be called */
{
unsigned numSigInts = NxsReader::getNumSignalIntsCaught();
const bool checkingSignals = NxsReader::getNCLCatchesSignals();
lastExecuteBlocksInOrder.clear();
currBlock = NULL;
NxsString errormsg;
token.SetEOFAllowed(true);
try
{
token.SetLabileFlagBit(NxsToken::saveCommandComments);
token.GetNextToken();
}
catch (NxsException x)
{
NexusError(token.errormsg, 0, 0, 0);
return;
}
if (token.Equals("#NEXUS"))
{
token.SetLabileFlagBit(NxsToken::saveCommandComments);
token.GetNextToken();
}
else
{
errormsg = "Expecting #NEXUS to be the first token in the file, but found ";
errormsg += token.GetToken();
errormsg += " instead";
/*mth changed this to a warning instead of an error because of the large number
of files that violate this requirement.
*/
NexusWarn(errormsg, NxsReader::AMBIGUOUS_CONTENT_WARNING, token.GetFilePosition(), token.GetFileLine(), token.GetFileColumn());
}
if (notifyStartStop)
{
ExecuteStarting();
}
bool keepReading = true;
for (; keepReading && !token.AtEOF(); )
{
if (checkingSignals && NxsReader::getNumSignalIntsCaught() != numSigInts)
{
throw NxsSignalCanceledParseException("Reading NEXUS content");
}
if (token.Equals("BEGIN"))
{
token.SetEOFAllowed(false); /*must exit the block before and EOF*/
token.GetNextToken();
token.SetBlockName(token.GetTokenReference().c_str());
for (currBlock = blockList; currBlock != NULL; currBlock = currBlock->next)
{
if (currBlock->CanReadBlockType(token))
{
break;
}
}
NxsString currBlockName = token.GetToken();
currBlockName.ToUpper();
NxsBlockFactory * sourceOfBlock = NULL;
if (currBlock == NULL)
{
try
{
currBlock = CreateBlockFromFactories(currBlockName, token, &sourceOfBlock);
}
catch (NxsException x)
{
NexusError(x.msg, x.pos, x.line, x.col);
token.SetBlockName(0L);
token.SetEOFAllowed(true);
return;
}
}
if (currBlock == NULL)
{
SkippingBlock(currBlockName);
if (!ReadUntilEndblock(token, currBlockName))
{
token.SetBlockName(0L);
token.SetEOFAllowed(true);
return;
}
}
else if (currBlock->IsEnabled())
{
keepReading = ExecuteBlock(token, currBlockName, currBlock, sourceOfBlock);
}
else
{
SkippingDisabledBlock(token.GetToken());
if (sourceOfBlock)
{
//.........这里部分代码省略.........
示例4: HandleAssociatesCommand
void NxsTaxaAssociationBlock::HandleAssociatesCommand(
NxsToken &token)
{
if (this->firstTaxaBlock == 0L || this->secondTaxaBlock == 0L)
{
errormsg << "Expecting TAXA command to precede an ASSOCIATES command.";
throw NxsException(errormsg, token);
}
token.GetNextToken();
for (;; )
{
std::set<unsigned> fSet;
while (!token.IsPunctuationToken() || !(token.Equals(";") || token.Equals(",") || token.Equals("/")))
{
try {
this->firstTaxaBlock->GetIndicesForLabel(token.GetTokenReference(), &fSet);
}
catch(...)
{
errormsg << "Unrecognized taxon \"" << token.GetTokenReference() << "\" in ASSOCIATES command";
throw NxsException(errormsg, token);
}
token.GetNextToken();
}
if (!token.Equals("/"))
{
errormsg << "Expecting / in ASSOCIATES command, found \"" << token.GetTokenReference() << "\"";
throw NxsException(errormsg, token);
}
if (fSet.empty())
{
errormsg << "Expecting taxon labels from the first TAXA block before the / in ASSOCIATES command.";
throw NxsException(errormsg, token);
}
token.GetNextToken();
std::set<unsigned> sSet;
while (!token.IsPunctuationToken() || !(token.Equals(";") || token.Equals(",") || token.Equals("/")))
{
try {
this->secondTaxaBlock->GetIndicesForLabel(token.GetTokenReference(), &sSet);
}
catch(...)
{
errormsg << "Unrecognized taxon \"" << token.GetTokenReference() << "\" in ASSOCIATES command";
throw NxsException(errormsg, token);
}
token.GetNextToken();
}
if (!(token.Equals(";") || token.Equals(",")))
{
errormsg << "Expecting , or ; in ASSOCIATES command, found \"" << token.GetTokenReference() << "\"";
throw NxsException(errormsg, token);
}
if (sSet.empty())
{
errormsg << "Expecting taxon labels from the second TAXA block after the / in ASSOCIATES command.";
throw NxsException(errormsg, token);
}
for (std::set<unsigned>::const_iterator fIt = fSet.begin(); fIt != fSet.end(); ++fIt)
{
this->AddAssociation(*fIt, sSet);
}
if (token.Equals(";"))
{
break;
}
token.GetNextToken();
}
}