本文整理汇总了C++中Scanner::MustGetToken方法的典型用法代码示例。如果您正苦于以下问题:C++ Scanner::MustGetToken方法的具体用法?C++ Scanner::MustGetToken怎么用?C++ Scanner::MustGetToken使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Scanner
的用法示例。
在下文中一共展示了Scanner::MustGetToken方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MustGetSignedInteger
static inline int MustGetSignedInteger(Scanner &sc)
{
bool neg = sc.CheckToken('-');
sc.MustGetToken(TK_IntConst);
return neg ? -sc->number : sc->number;
}
示例2: ParseMap
void LumpRemapper::ParseMap(Scanner &sc)
{
while(sc.TokensLeft())
{
if(!sc.CheckToken(TK_Identifier))
sc.ScriptMessage(Scanner::ERROR, "Expected identifier in map.\n");
bool parseSprites = false;
TArray<FString> *map = NULL;
if(sc->str.Compare("graphics") == 0)
map = &graphics;
else if(sc->str.Compare("sprites") == 0)
{
parseSprites = true;
map = &sprites;
}
else if(sc->str.Compare("sounds") == 0)
map = &sounds;
else if(sc->str.Compare("digitalsounds") == 0)
{
// Check for sample rate change
if(sc.CheckToken('('))
{
sc.MustGetToken(TK_Identifier);
if(sc->str.Compare("timervalue") != 0)
sc.ScriptMessage(Scanner::ERROR, "Expected timervalue.\n");
sc.MustGetToken('=');
sc.MustGetToken(TK_IntConst);
digiTimerValue = sc->number;
sc.MustGetToken(')');
}
map = &digitalsounds;
}
else if(sc->str.Compare("music") == 0)
map = &music;
else if(sc->str.Compare("textures") == 0)
map = &textures;
else
sc.ScriptMessage(Scanner::ERROR, "Unknown map section '%s'.\n", sc->str.GetChars());
if(!sc.CheckToken('{'))
sc.ScriptMessage(Scanner::ERROR, "Expected '{'.");
if(!sc.CheckToken('}'))
{
while(true)
{
if(!sc.CheckToken(TK_StringConst))
sc.ScriptMessage(Scanner::ERROR, "Expected string constant.\n");
const FString spriteName = sc->str;
map->Push(spriteName);
if(parseSprites && sc.CheckToken(':'))
{
sc.MustGetToken(TK_Identifier);
if(sc->str.Compare("pspr") == 0)
psprites.Push(PSprite(spriteName, PSPR_NORMAL));
else if(sc->str.Compare("blakepspr") == 0)
psprites.Push(PSprite(spriteName, PSPR_BLAKE));
else
sc.ScriptMessage(Scanner::ERROR, "Expected pspr modifier.\n");
}
if(sc.CheckToken('}'))
break;
if(!sc.CheckToken(','))
sc.ScriptMessage(Scanner::ERROR, "Expected ','.\n");
}
}
}
}