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

Function TokenToBOOL

source/script2.cpp:16821–16837  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16819
16820
16821BOOL TokenToBOOL(ExprTokenType &aToken)
16822{
16823 switch (aToken.symbol)
16824 {
16825 case SYM_INTEGER: // Probably the most common; e.g. both sides of "if (x>3 and x<6)" are the number 1/0.
16826 return aToken.value_int64 != 0; // Force it to be purely 1 or 0.
16827 case SYM_VAR:
16828 return VarToBOOL(*aToken.var);
16829 case SYM_FLOAT:
16830 return aToken.value_double != 0.0;
16831 case SYM_STRING:
16832 return ResultToBOOL(aToken.marker);
16833 default:
16834 // The only remaining valid symbol is SYM_OBJECT, which is always TRUE.
16835 return TRUE;
16836 }
16837}
16838
16839
16840

Callers 4

ExpandExpressionMethod · 0.85
CallEnumeratorFunction · 0.85
ExecUntilMethod · 0.85
TokenToVarTypeFunction · 0.85

Calls 2

VarToBOOLFunction · 0.85
ResultToBOOLFunction · 0.85

Tested by

no test coverage detected