本文整理汇总了C++中NxsToken::SetLabileFlagBit方法的典型用法代码示例。如果您正苦于以下问题:C++ NxsToken::SetLabileFlagBit方法的具体用法?C++ NxsToken::SetLabileFlagBit怎么用?C++ NxsToken::SetLabileFlagBit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NxsToken
的用法示例。
在下文中一共展示了NxsToken::SetLabileFlagBit方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleNextState
/*!
Called from HandleMatrix function to read in the next state. Returns true if next token encountered is a comma,
false otherwise. A comma signals the end of data for the current taxon in an UNALIGNED block.
*/
bool NxsUnalignedBlock::HandleNextState(
NxsToken & token, /* is the token used to read from `in' */
unsigned taxNum, /* is the row in range [0..ntax) (used for error reporting only) */
unsigned charNum, /* is the column (used for error reporting only) */
NxsDiscreteStateRow & row, const NxsString &nameStr) /* is the container for storing new state */
{
token.SetLabileFlagBit(NxsToken::parentheticalToken);
token.SetLabileFlagBit(NxsToken::curlyBracketedToken);
token.SetLabileFlagBit(NxsToken::singleCharacterToken);
token.GetNextToken();
if (token.Equals(",") || token.Equals(";"))
return false;
const NxsString stateAsNexus = token.GetToken();
const NxsDiscreteStateCell stateCode = mapper.EncodeNexusStateString(stateAsNexus, token, taxNum, charNum, NULL, nameStr);
if (charNum < row.size())
row[charNum] = stateCode;
else
{
while (charNum < row.size())
row.push_back(NXS_INVALID_STATE_CODE);
row.push_back(stateCode);
}
return true;
}
示例2: 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)
{
//.........这里部分代码省略.........
示例3: HandleFormat
//.........这里部分代码省略.........
errormsg += " was specified)";
throw NxsException(errormsg, token.GetFilePosition(), token.GetFileLine(), token.GetFileColumn());
}
missing = token.GetToken()[0];
ignoreCaseAssumed = true;
standardDataTypeAssumed = true;
}
else if (token.Equals("SYMBOLS") || token.Equals("SYMBOL"))
{
NxsDiscreteStateCell numDefStates;
unsigned maxNewStates;
switch(datatype)
{
case NxsCharactersBlock::dna:
case NxsCharactersBlock::rna:
case NxsCharactersBlock::nucleotide:
numDefStates = 4;
maxNewStates = NCL_MAX_STATES-4;
break;
case NxsCharactersBlock::protein:
numDefStates = 21;
maxNewStates = NCL_MAX_STATES-21;
break;
default:
numDefStates = 0; // replace symbols list for standard datatype
symbols[0] = '\0';
maxNewStates = NCL_MAX_STATES;
}
DemandEquals(token, "after keyword SYMBOLS");
// This should be the symbols list
token.SetLabileFlagBit(NxsToken::doubleQuotedToken);
token.GetNextToken();
token.StripWhitespace();
unsigned numNewSymbols = token.GetTokenLength();
if (numNewSymbols > maxNewStates)
{
errormsg = "SYMBOLS defines ";
errormsg += numNewSymbols;
errormsg += " new states but only ";
errormsg += maxNewStates;
errormsg += " new states allowed for this DATATYPE";
throw NxsException(errormsg, token.GetFilePosition(), token.GetFileLine(), token.GetFileColumn());
}
NxsString to = token.GetToken();
unsigned tlen = (unsigned)to.size();
NxsString processedS;
// Check to make sure user has not used any symbols already in the
// default symbols list for this data type
for (unsigned i = 0; i < tlen; i++)
{
if (IsInSymbols(to[i]))
{
errormsg = "The character ";
errormsg << to[i] << " defined in SYMBOLS is predefined for this DATATYPE and shoud not occur in a SYMBOLS subcommand of a FORMAT command.";
if (nexusReader)
{
nexusReader->NexusWarnToken(errormsg, NxsReader::SKIPPING_CONTENT_WARNING, token);
errormsg.clear();
}
}
示例4: Read
/*----------------------------------------------------------------------------------------------------------------------
| This function provides the ability to read everything following the block name (which is read by the NxsReader
| object) to the end or endblock statement. Characters are read from the input stream in. Overrides the abstract
| virtual function in the base class.
*/
void NxsTaxaBlock::Read(
NxsToken &token) /* the token used to read from in */
{
ntax = 0;
int nominal_ntax = 0;
isEmpty = false;
isUserSupplied = true;
// This should be the semicolon after the block name
//
token.GetNextToken();
if (!token.Equals(";"))
{
errormsg = "Expecting ';' after TAXA block name, but found ";
errormsg += token.GetToken();
errormsg += " instead";
throw NxsException(errormsg, token.GetFilePosition(), token.GetFileLine(), token.GetFileColumn());
}
for (;;)
{
token.GetNextToken();
if (token.Equals("DIMENSIONS"))
{
// This should be the NTAX keyword
//
token.GetNextToken();
if (!token.Equals("NTAX"))
{
errormsg = "Expecting NTAX keyword, but found ";
errormsg += token.GetToken();
errormsg += " instead";
throw NxsException(errormsg, token.GetFilePosition(), token.GetFileLine(), token.GetFileColumn());
}
// This should be the equals sign
//
token.GetNextToken();
if (!token.Equals("="))
{
errormsg = "Expecting '=', but found ";
errormsg += token.GetToken();
errormsg += " instead";
throw NxsException(errormsg, token.GetFilePosition(), token.GetFileLine(), token.GetFileColumn());
}
// This should be the number of taxa
//
token.GetNextToken();
nominal_ntax = atoi(token.GetToken().c_str());
if (nominal_ntax <= 0)
{
errormsg = "NTAX should be greater than zero (";
errormsg += token.GetToken();
errormsg += " was specified)";
throw NxsException(errormsg, token.GetFilePosition(), token.GetFileLine(), token.GetFileColumn());
}
// This should be the terminating semicolon
//
token.GetNextToken();
if (!token.Equals(";"))
{
errormsg = "Expecting ';' to terminate DIMENSIONS command, but found ";
errormsg += token.GetToken();
errormsg += " instead";
throw NxsException(errormsg, token.GetFilePosition(), token.GetFileLine(), token.GetFileColumn());
}
} // if (token.Equals("DIMENSIONS"))
else if (token.Equals("TAXLABELS"))
{
if (nominal_ntax <= 0)
{
errormsg = "NTAX must be specified before TAXLABELS command";
throw NxsException(errormsg, token.GetFilePosition(), token.GetFileLine(), token.GetFileColumn());
}
for (unsigned i = 0; (int)i < nominal_ntax; i++)
{
token.SetLabileFlagBit(NxsToken::hyphenNotPunctuation + NxsToken::preserveUnderscores);
token.GetNextToken();
//@pol should check to make sure this is not punctuation
AddTaxonLabel(token.GetToken());
}
// This should be terminating semicolon
//
token.GetNextToken();
//.........这里部分代码省略.........