本文整理汇总了C++中CTokenizer::AtEndOfLine方法的典型用法代码示例。如果您正苦于以下问题:C++ CTokenizer::AtEndOfLine方法的具体用法?C++ CTokenizer::AtEndOfLine怎么用?C++ CTokenizer::AtEndOfLine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTokenizer
的用法示例。
在下文中一共展示了CTokenizer::AtEndOfLine方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EvaluateExpression
//Generates the Opcode sequenz for the trigger statement
//evaluates and + and - expression
void CStateParser::EvaluateExpression(CTokenizer &tok,CStateManager &StateManager)
{
Term(tok,StateManager);
while( tok.CheckToken("+",false) || tok.CheckToken("-",false) ||
tok.CheckToken("&&",false) || tok.CheckToken("||",false)
&& !tok.AtEndOfLine() )
{
if( tok.CheckToken("+") )
{
Term(tok,StateManager);
StateManager.AddInstruction(OP_ADD,0,"#");
}
if( tok.CheckToken("-") )
{
Term(tok,StateManager);
StateManager.AddInstruction(OP_SUB,0,"#");
}
if( tok.CheckToken("&&") )
{
Term(tok,StateManager);
StateManager.AddInstruction(OP_AND,0,"#");
}
if( tok.CheckToken("||") )
{
Term(tok,StateManager);
StateManager.AddInstruction(OP_OR,0,"#");
}
}
}
示例2: Term
//evaluates and * and / expression
void CStateParser::Term(CTokenizer &tok,CStateManager &StateManager)
{
Primary(tok,StateManager);
//search for operators
while( tok.CheckToken("*",false) || tok.CheckToken("/",false) ||
tok.CheckToken("=",false) || tok.CheckToken("!=",false) ||
tok.CheckToken("<",false) || tok.CheckToken("<=",false) ||
tok.CheckToken(">",false) || tok.CheckToken(">=",false) ||
tok.CheckToken(":",false) || /*tok.CheckToken("&&",false) ||
tok.CheckToken("||",false)||*/ tok.CheckToken("^^",false) ||
tok.CheckToken("&",false) || tok.CheckToken("~",false) ||
tok.CheckToken("|",false) || tok.CheckToken("^",false) ||
tok.CheckToken("%",false) || tok.CheckToken("(", false)
&& !tok.AtEndOfLine() )
{
if( tok.CheckToken("*") )
{
//Have we a ** operator?
if( tok.CheckToken("*") )
{
Primary(tok,StateManager);
StateManager.AddInstruction(OP_SQUARE,0,"#");
}else
{
Primary(tok,StateManager);
StateManager.AddInstruction(OP_MUL,0,"#");
}
}
if( tok.CheckToken("/") )
{
Primary(tok,StateManager);
StateManager.AddInstruction(OP_DIV,0,"#");
}
if( tok.CheckToken("=") )
{
//check for intervall operator
if( tok.CheckToken("(") )
{
//evaluate first expression
EvaluateExpression(tok,StateManager);
if( !tok.CheckToken(",") )
Error("Expectetd a , in intervall operator",tok);
//evaluate second expression
EvaluateExpression(tok,StateManager);
//intervall op =(,)
if( tok.CheckToken(")") )
{
StateManager.AddInstruction(OP_INTERVALOP4,0,"#");
}else if( tok.CheckToken("]") )
{
StateManager.AddInstruction(OP_INTERVALOP3,0,"#");
}
}else if (tok.CheckToken("[") )
{
//evaluate first expression
EvaluateExpression(tok,StateManager);
if( !tok.CheckToken(",") )
Error("Expectetd a , in intervall operator",tok);
//evaluate second expression
EvaluateExpression(tok,StateManager);
//intervall op =[,)
if( tok.CheckToken(")") )
{
StateManager.AddInstruction(OP_INTERVALOP2,0,"#");
}else if( tok.CheckToken("]") )
{
StateManager.AddInstruction(OP_INTERVALOP1,0,"#");
}
}
else // is the = op
{
//evalute the right side of the operator
Primary(tok,StateManager);
StateManager.AddInstruction(OP_EQUAL,0,"#");
}
}
if( tok.CheckToken(":") )
{ //evalute the right side of the operator
if(tok.CheckToken("="))
{
EvaluateExpression(tok,StateManager);
PrintMessage("TODO:Handel assign operator :=");
}
}
if( tok.CheckToken("!=") )
//.........这里部分代码省略.........
示例3: Primary
//.........这里部分代码省略.........
{
if (!tok.CheckToken("("))
Error("Missing (",tok);
StateManager.AddInstruction(OP_Const,0.0,tok.GetToken());
if (!tok.CheckToken(")"))
Error("Missing )",tok);
}
else if ( i == OP_IfElse - OP_Abs)
{
if (!tok.CheckToken("("))
Error("Missing (",tok);
EvaluateExpression(tok,StateManager);
if (!tok.CheckToken(","))
Error("Missing ,",tok);
Term(tok,StateManager);
if (!tok.CheckToken(","))
Error("Missing ,",tok);
Term(tok,StateManager);
StateManager.AddInstruction(OP_IfElse,0,"#");
if (!tok.CheckToken(")"))
Error("Missing )",tok);
}
else if (i == OP_StateType - OP_Abs)
{
if (tok.CheckToken("="))
{
StateManager.AddInstruction(OP_StateType,0,"#");
StateManager.AddInstruction(OP_PUSH,0,tok.GetToken());
StateManager.AddInstruction(OP_EQUAL,0,"#");
}else if (tok.CheckToken("!="))
{
StateManager.AddInstruction(OP_StateType,0,"#");
StateManager.AddInstruction(OP_PUSH,0,tok.GetToken());
StateManager.AddInstruction(OP_NOTEQUAL,0,"#");
}
}
else if (i == OP_P2StateType - OP_Abs)
{
if (tok.CheckToken("="))
{
StateManager.AddInstruction(OP_P2StateType,0,"#");
StateManager.AddInstruction(OP_PUSH,0,tok.GetToken());
StateManager.AddInstruction(OP_EQUAL,0,"#");
}else if (tok.CheckToken("!="))
{
StateManager.AddInstruction(OP_P2StateType,0,"#");
StateManager.AddInstruction(OP_PUSH,0,tok.GetToken());
StateManager.AddInstruction(OP_NOTEQUAL,0,"#");
}
}
else if (i == OP_P2MoveType - OP_Abs)
{
if (tok.CheckToken("="))
{
StateManager.AddInstruction(OP_P2MoveType,0,"#");
StateManager.AddInstruction(OP_PUSH,0,tok.GetToken());
StateManager.AddInstruction(OP_EQUAL,0,"#");
}else if (tok.CheckToken("!="))
{
StateManager.AddInstruction(OP_P2MoveType,0,"#");
StateManager.AddInstruction(OP_PUSH,0,tok.GetToken());
StateManager.AddInstruction(OP_NOTEQUAL,0,"#");
}
}
else if (i == OP_GetHitVar - OP_Abs)
{
if (!tok.CheckToken("("))
Error("Missing (",tok);
StateManager.AddInstruction(OP_GetHitVar,0,tok.GetToken());
if (!tok.CheckToken(")"))
Error("Missing )",tok);
}
else if (i == OP_HitDefAttr - OP_Abs)
{
while (!tok.AtEndOfLine())
tok.GetToken();
}
else if (i == OP_P2BodyDist - OP_Abs)
{
while (!tok.AtEndOfLine())
tok.GetToken();
}
else
{
StateManager.AddInstruction(i+OP_Abs,0,"#");
}
}
}
示例4: ParseStateFile
void CStateParser::ParseStateFile(const char* strFileName,CStateManager &StateManager,CAllocater *a)
{
//Set pointer to allocater
m_pAlloc=a;
CTokenizer tok;
bool foundState=false;
if( !tok.OpenFile(strFileName) )
throw(CError("CStateParser::ParseState: File %s not found",strFileName));
tok.SetIsCaseSensitive(false);
tok.SetReturnNegativeSeperatelyFromNumber(false);
while( !tok.AtEndOfFile() )
{
foundState=false;
if( tok.CheckToken("[") )
{
if( tok.CheckToken("statedef") )
{
foundState=true;
if(!tok.CheckTokenIsNumber())
Error("Expected a number in statedef block",tok);
StateManager.AddStateDef(tok.GetInt());
//Skip useless stuff
while( !tok.AtEndOfLine() )
tok.GetToken();
//parse the state def
ParseStateDef(tok,StateManager);
}
if( tok.CheckToken("state") )
{
foundState=true;
if(!tok.CheckTokenIsNumber())
Error("Expected a number in state block",tok);
int stateno = tok.GetInt();
tok.CheckToken(",");
// if(!tok.CheckTokenIsQuotedString()
// && !tok.CheckTokenIsNumber())
// Error("Expected a number in state block",tok);
std::string str = tok.GetToken();
StateManager.AddState(stateno, str.c_str());
while(!tok.AtEndOfLine())
tok.GetToken();
PareseState(tok,StateManager);
}
}
//skip useless stuff
if(!foundState)
tok.GetToken();
}
tok.CloseFile();
}
示例5: LoadCMDFile
//.........这里部分代码省略.........
while( !tok.AtEndOfFile() )
{
bool foundCommand = false;
if( tok.CheckToken( "[" ) )
{
if( tok.CheckToken( "Command" ) )
{
if( !tok.CheckToken( "]" ) )
{
}
foundCommand = true;
command->nCommandTime = defaultCommandTime;
command->nBufferTime = defaultBufferTime;
command->strCommand[0] = 0;
command->nHowManyCommand = 0;
while( command->nHowManyCommand < MAXCOMMAND && !tok.CheckToken( "[", false ) && !tok.AtEndOfFile() )
{
if( tok.CheckToken( "name" ) )
{
if( !tok.CheckToken( "=" ) )
{
}
strcpy( command->strCommand, tok.GetToken() );
}
else if( tok.CheckToken( "command" ) )
{
if( !tok.CheckToken( "=" ) )
{
}
while( !tok.AtEndOfLine() )
{
const char* token = tok.GetToken();
if( !strcmp( token, "~" ) )
{
command->nCommand[ command->nHowManyCommand ].keyModifier += PLC_KEYMOD_ON_RELEASE;
if( tok.CheckTokenIsNumber() )
{
command->nCommand[ command->nHowManyCommand ].gameTicksForHold = tok.GetInt();
}
else
{
command->nCommand[ command->nHowManyCommand ].gameTicksForHold = 1;
}
}
else if( !strcmp( token, "+" ) )
{
}
else if( !strcmp( token, "/" ) )
{
command->nCommand[ command->nHowManyCommand ].keyModifier += PLC_KEYMOD_MUST_BE_HELD;
}
else if( !strcmp( token, "$" ) )
{
command->nCommand[ command->nHowManyCommand ].keyModifier += PLC_KEYMOD_DETECT_AS_4WAY;
}
else if( !strcmp( token, ">" ) )
{
command->nCommand[ command->nHowManyCommand ].keyModifier += PLC_KEYMOD_BAN_OTHER_INPUT;
}
else if( !strcmp( token, "," ) )
{