本文整理汇总了C++中Tokenizer::getValue方法的典型用法代码示例。如果您正苦于以下问题:C++ Tokenizer::getValue方法的具体用法?C++ Tokenizer::getValue怎么用?C++ Tokenizer::getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tokenizer
的用法示例。
在下文中一共展示了Tokenizer::getValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
SmartPointer<Entity> Parser::compareOp(Tokenizer &tokenizer) {
SmartPointer<Entity> entity = addOp(tokenizer);
while (true) {
if (tokenizer.getType() == TokenType::ID_TOKEN) {
Operator op;
string id = String::toUpper(tokenizer.getValue());
if (id == "EQ") op = Operator::EQ_OP;
else if (id == "NE") op = Operator::NE_OP;
else if (id == "GT") op = Operator::GT_OP;
else if (id == "GE") op = Operator::GE_OP;
else if (id == "LT") op = Operator::LT_OP;
else if (id == "LE") op = Operator::LE_OP;
if (op != Operator::NO_OP) {
tokenizer.advance();
entity = new BinaryOp(op, entity, addOp(tokenizer));
continue;
}
}
break;
}
return entity;
}
示例2: expOp
SmartPointer<Entity> Parser::mulOp(Tokenizer &tokenizer) {
SmartPointer<Entity> entity = expOp(tokenizer);
while (true) {
Operator op;
switch(tokenizer.getType()) {
case TokenType::MUL_TOKEN: op = Operator::MUL_OP; break;
case TokenType::DIV_TOKEN: op = Operator::DIV_OP; break;
case TokenType::ID_TOKEN:
if (String::toUpper(tokenizer.getValue()) == "MOD")
op = Operator::MOD_OP;
break;
default: break;
}
if (op != Operator::NO_OP) {
tokenizer.advance();
entity = new BinaryOp(op, entity, expOp(tokenizer));
} else break;
}
return entity;
}