MCPcopy Create free account
hub / github.com/HyperDbg/HyperDbg / Scan

Function Scan

hyperdbg/script-engine/code/scanner.c:975–1033  ·  view source on GitHub ↗

* @brief Perform scanning the script engine * * @param str * @param c * @return PSCRIPT_ENGINE_TOKEN */

Source from the content-addressed store, hash-verified

973 * @return PSCRIPT_ENGINE_TOKEN
974 */
975PSCRIPT_ENGINE_TOKEN
976Scan(char * str, char * c)
977{
978 static BOOLEAN ReturnEndOfString;
979 PSCRIPT_ENGINE_TOKEN Token;
980
981 if (InputIdx <= 1)
982 {
983 ReturnEndOfString = FALSE;
984 }
985
986 if (ReturnEndOfString)
987 {
988 Token = NewToken(END_OF_STACK, "$");
989 return Token;
990 }
991
992 if (str[InputIdx - 1] == '\0')
993 {
994 }
995 while (1)
996 {
997 CurrentTokenIdx = InputIdx - 1;
998
999 Token = GetToken(c, str);
1000
1001 if ((int)*c == EOF)
1002 {
1003 ReturnEndOfString = TRUE;
1004 }
1005
1006 if (Token->Type == WHITE_SPACE)
1007 {
1008 if (!strcmp(Token->Value, "\n"))
1009 {
1010 CurrentLine++;
1011 CurrentLineIdx = InputIdx;
1012 }
1013 RemoveToken(&Token);
1014 if (ReturnEndOfString)
1015 {
1016 Token = NewToken(END_OF_STACK, "$");
1017 return Token;
1018 }
1019 continue;
1020 }
1021 else if (Token->Type == COMMENT)
1022 {
1023 RemoveToken(&Token);
1024 if (ReturnEndOfString)
1025 {
1026 Token = NewToken(END_OF_STACK, "$");
1027 return Token;
1028 }
1029 continue;
1030 }
1031 return Token;
1032 }

Callers 2

ScriptEngineParseFunction · 0.85

Calls 3

NewTokenFunction · 0.85
GetTokenFunction · 0.85
RemoveTokenFunction · 0.85

Tested by

no test coverage detected