本文整理汇总了C++中TokenInfo::getInteger方法的典型用法代码示例。如果您正苦于以下问题:C++ TokenInfo::getInteger方法的具体用法?C++ TokenInfo::getInteger怎么用?C++ TokenInfo::getInteger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TokenInfo
的用法示例。
在下文中一共展示了TokenInfo::getInteger方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void ECodesAssembler :: compileMCommand(ByteCode code, TokenInfo& token, MemoryWriter& writer, _Module* binary)
{
ident_t word = token.read();
if (token.terminal.state == dfaInteger || constants.exist(word)) {
int m = 0;
if(token.getInteger(m, constants)) {
writeCommand(ByteCommand(code, m), writer);
}
else token.raiseErr("Invalid number (%d)\n");
}
else if (word.compare("subject")) {
token.read(":", "Invalid operand (%d)");
token.read();
int paramCount = 0; // NOTE: paramCount might be not equal to stackCount (the actual stack size) in the case if variables are used for virtual methods
int stackCount = 0;
int verbId = mapVerb(token.value);
if (verbId == 0) {
verbId = EVAL_MESSAGE_ID;
}
IdentifierString subject;
token.read();
bool first = true;
while(token.value[0] == '&') {
if (first) {
first = false;
}
else subject.append(token.value);
token.read();
subject.append(token.value);
token.read();
}
if (token.value[0] == '[') {
paramCount = token.readInteger(constants);
}
else token.raiseErr("Invalid operand (%d)");
token.read("]", "Invalid operand (%d)");
ref_t subj = binary->mapSubject(subject, false);
writeCommand(ByteCommand(code, encodeMessage(subj, verbId, paramCount)), writer);
}
else throw AssemblerException("Invalid operand (%d)\n", token.terminal.row);
}