本文整理汇总了C++中CTokenizer::SetKeywords方法的典型用法代码示例。如果您正苦于以下问题:C++ CTokenizer::SetKeywords方法的具体用法?C++ CTokenizer::SetKeywords怎么用?C++ CTokenizer::SetKeywords使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTokenizer
的用法示例。
在下文中一共展示了CTokenizer::SetKeywords方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadASEHeader_Actual
//
// this actually reads XSI or GLA headers... historical mutation strikes again...
//
static void ReadASEHeader_Actual(LPCSTR psFilename, int &iStartFrame, int &iFrameCount, int &iFrameSpeed, bool bReadingGLA, bool bCanSkipXSIRead /* = false */)
{
// since the XSI loader is so damn slow and flakey I'm going to have to cache the info to avoid re-reading...
//
// do we have it in the cache?...
//
if (strstr(psFilename,".xsi") || strstr(psFilename,".XSI"))
{
ASECachedInfo_t::iterator iter = ASECachedInfo.find(psFilename);
if (iter != ASECachedInfo.end())
{
iStartFrame = 0;
iFrameCount = (*iter).second.first;
iFrameSpeed = (*iter).second.second;
return;
}
}
// is it a GLA file?...
//
if (bReadingGLA)
{
char sTemp[1024];
strcpy(sTemp,psFilename);
if (!(strstr(psFilename,".gla") || strstr(psFilename,".GLA")))
{
strcat(sTemp,".gla");
}
iStartFrame = 0;
iFrameCount = GLA_ReadHeader(sTemp);
iFrameSpeed = 20; // any old value for GLA file
return;
}
// it's not in the cache, but we may be able to avoid having to read it under some circumstances...
//
bool bXSIShouldBeRead = true;
if (gbCarWash_DoingScan)
{
bCanSkipXSIRead = false; // stop it asking the question
bXSIShouldBeRead= gbCarWash_YesToXSIScan;
}
if ( (strstr(psFilename,".xsi") || strstr(psFilename,".XSI"))
&& bCanSkipXSIRead
)
{
if (!gbSkipXSIRead && !gbSkipXSIRead_QuestionAsked)
{
gbSkipXSIRead_QuestionAsked = true;
gbSkipXSIRead = !GetYesNo(va("Model file: \"%s\"\n\n... is an XSI, and they can be damn slow to read in\n\nDo you want to scan all the XSIs?",psFilename));
}
bXSIShouldBeRead = !gbSkipXSIRead;
}
if (strstr(psFilename,".xsi") || strstr(psFilename,".XSI"))
{
if (bXSIShouldBeRead)
{
ReadXSIHeader(psFilename, iStartFrame, iFrameCount, iFrameSpeed);
if (iFrameCount!=0)
{
// cache it for future...
//
ASECachedInfo[psFilename] = FrameCountAndSpeed_t(iFrameCount,iFrameSpeed);
}
}
return;
}
// it must be an ASE file then instead....
//
CTokenizer* tokenizer = CTokenizer::Create();
tokenizer->AddParseFile(psFilename, ((CAssimilateApp*)AfxGetApp())->GetBufferSize());
tokenizer->SetSymbols(CSequence_s_Symbols);
tokenizer->SetKeywords(CSequence_s_Keywords);
CToken* curToken = tokenizer->GetToken();
while(curToken != NULL)
{
switch (curToken->GetType())
{
case TK_EOF:
curToken->Delete();
curToken = NULL;
break;
case TK_ASTERISK:
curToken->Delete();
curToken = tokenizer->GetToken();
switch(curToken->GetType())
{
//.........这里部分代码省略.........
示例2: Parse
void CASEFile::Parse()
{
if (m_file == NULL)
{
return;
}
CAlertErrHandler errhandler;
CTokenizer* tokenizer = CTokenizer::Create(TKF_USES_EOL | TKF_NUMERICIDENTIFIERSTART);
tokenizer->SetErrHandler(&errhandler);
tokenizer->SetKeywords(s_keywords);
tokenizer->SetSymbols(s_symbols);
tokenizer->AddParseFile(m_file, 16 * 1024);
int tokType = TK_UNDEFINED;
while(tokType != TK_EOF)
{
CToken* curToken = tokenizer->GetToken();
if (curToken->GetType() == TK_EOF)
{
curToken->Delete();
tokType = TK_EOF;
break;
}
if (curToken->GetType() == TK_EOL)
{
curToken->Delete();
continue;
}
if (curToken->GetType() != TK_ASE_ASTERISK)
{
tokenizer->Error(TKERR_UNEXPECTED_TOKEN);
curToken->Delete();
tokenizer->GetToEndOfLine()->Delete();
continue;
}
curToken->Delete();
curToken = tokenizer->GetToken();
tokType = curToken->GetType();
curToken->Delete();
switch(tokType)
{
case TK_EOF:
break;
case TK_GEOMOBJECT:
ParseGeomObject(tokenizer);
break;
case TK_SCENE:
ParseScene(tokenizer);
break;
case TK_MATERIAL_LIST:
ParseMaterialList(tokenizer);
break;
case TK_ASE_COMMENT:
ParseComment(tokenizer);
break;
case TK_3DSMAX_ASCIIEXPORT:
ParseAsciiExport(tokenizer);
break;
default:
tokenizer->Error(TKERR_UNEXPECTED_TOKEN);
tokenizer->GetToEndOfLine()->Delete();
break;
}
}
}