MCPcopy Create free account
hub / github.com/AutoHotkey/AutoHotkey / TokenToStringCase

Function TokenToStringCase

source/script2.cpp:17053–17084  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17051
17052
17053StringCaseSenseType TokenToStringCase(ExprTokenType& aToken)
17054{
17055 // Pure integers 1 and 0 corresponds to SCS_SENSITIVE and SCS_INSENSITIVE, respectively.
17056 // Pure floats returns SCS_INVALID.
17057 // For strings see Line::ConvertStringCaseSense.
17058 LPTSTR str = NULL;
17059 __int64 int_val = 0;
17060 switch (aToken.symbol)
17061 {
17062 case SYM_VAR:
17063
17064 switch (aToken.var->IsPureNumeric())
17065 {
17066 case PURE_INTEGER: int_val = aToken.var->ToInt64(); break;
17067 case PURE_NOT_NUMERIC: str = aToken.var->Contents(); break;
17068 case PURE_FLOAT:
17069 default:
17070 return SCS_INVALID;
17071 }
17072 break;
17073
17074 case SYM_INTEGER: int_val = TokenToInt64(aToken); break;
17075 case SYM_FLOAT: return SCS_INVALID;
17076 default: str = TokenToString(aToken); break;
17077 }
17078 if (str)
17079 return !_tcsicmp(str, _T("Logical")) ? SCS_INSENSITIVE_LOGICAL
17080 : Line::ConvertStringCaseSense(str);
17081 return int_val == 1 ? SCS_SENSITIVE // 1 - Sensitive
17082 : (int_val == 0 ? SCS_INSENSITIVE // 0 - Insensitive
17083 : SCS_INVALID); // else - invalid.
17084}
17085
17086
17087

Callers 1

ExecUntilMethod · 0.85

Calls 5

TokenToInt64Function · 0.85
TokenToStringFunction · 0.85
IsPureNumericMethod · 0.80
ToInt64Method · 0.80
ContentsMethod · 0.45

Tested by

no test coverage detected