MCPcopy Create free account
hub / github.com/ZDoom/Raze / GetToken

Method GetToken

source/common/engine/sc_man.cpp:529–576  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

527//==========================================================================
528
529bool FScanner::GetToken (bool evaluate)
530{
531 if (ScanString (true))
532 {
533 if (TokenType == TK_IntConst)
534 {
535 char *stopper;
536 // Check for unsigned
537 if (String[StringLen - 1] == 'u' || String[StringLen - 1] == 'U' ||
538 String[StringLen - 2] == 'u' || String[StringLen - 2] == 'U')
539 {
540 TokenType = TK_UIntConst;
541 BigNumber = (int64_t)strtoull(String, &stopper, 0);
542 Number = (int)BigNumber;// clamp<int64_t>(BigNumber, 0, UINT_MAX);
543 Float = (unsigned)Number;
544 }
545 else
546 {
547 BigNumber = mystrtoll(String, &stopper, 0);
548 Number = (int)BigNumber;// clamp<int64_t>(BigNumber, 0, UINT_MAX);
549 Float = Number;
550 }
551 }
552 else if (TokenType == TK_FloatConst)
553 {
554 char *stopper;
555 Float = strtod(String, &stopper);
556 }
557 else if (TokenType == TK_StringConst)
558 {
559 StringLen = strbin(const_cast<char*>(String));
560 }
561 else if (TokenType == TK_Identifier && evaluate && symbols.CountUsed() > 0)
562 {
563 auto sym = symbols.CheckKey(String);
564 if (sym)
565 {
566 TokenType = sym->tokenType;
567 BigNumber = sym->Number;
568 Number = (int)sym->Number;
569 Float = sym->Float;
570 // String will retain the actual symbol name.
571 }
572 }
573 return true;
574 }
575 return false;
576}
577
578//==========================================================================
579//

Callers 8

ParseGrpInfoFunction · 0.80
ParseGameInfoFunction · 0.80
DoParseDefsMethod · 0.80
PSR_FindAndEnterBlockFunction · 0.80
PSR_ReadBaseInstallsFunction · 0.80
FFontMethod · 0.80
ParseSingleFileFunction · 0.80
ParseOneScriptFunction · 0.80

Calls 4

strtoullFunction · 0.85
strbinFunction · 0.85
CountUsedMethod · 0.80
CheckKeyMethod · 0.45

Tested by

no test coverage detected