diff --git a/hyperdbg/hprdbgctrl/code/debugger/commands/debugging-commands/eval.cpp b/hyperdbg/hprdbgctrl/code/debugger/commands/debugging-commands/eval.cpp index c3ba77e9..75bb72a0 100644 --- a/hyperdbg/hprdbgctrl/code/debugger/commands/debugging-commands/eval.cpp +++ b/hyperdbg/hprdbgctrl/code/debugger/commands/debugging-commands/eval.cpp @@ -242,11 +242,7 @@ CommandEval(vector SplittedCommand, string Command) return; } - // - // TODO: end of string must have a whitspace. fix it. - // - Command.append(" "); - // Expr = " x = 4 >> 1; "; + if (g_IsSerialConnectedToRemoteDebuggee) { diff --git a/hyperdbg/hprdbgctrl/code/debugger/commands/debugging-commands/print.cpp b/hyperdbg/hprdbgctrl/code/debugger/commands/debugging-commands/print.cpp index c0482316..f9c28ba7 100644 --- a/hyperdbg/hprdbgctrl/code/debugger/commands/debugging-commands/print.cpp +++ b/hyperdbg/hprdbgctrl/code/debugger/commands/debugging-commands/print.cpp @@ -78,10 +78,7 @@ CommandPrint(vector SplittedCommand, string Command) Command.insert(0, "print("); Command.append(");"); - // - // TODO: end of string must have a whitspace. fix it. - // - Command.append(" "); + if (g_IsSerialConnectedToRemoteDebuggee) { diff --git a/hyperdbg/hprdbgctrl/code/debugger/script-engine-wrapper/script-engine.cpp b/hyperdbg/hprdbgctrl/code/debugger/script-engine-wrapper/script-engine.cpp index eed9ce21..6a06f1f3 100644 --- a/hyperdbg/hprdbgctrl/code/debugger/script-engine-wrapper/script-engine.cpp +++ b/hyperdbg/hprdbgctrl/code/debugger/script-engine-wrapper/script-engine.cpp @@ -41,10 +41,7 @@ ScriptEngineEvalSingleExpression(string Expr, PBOOLEAN HasError) Expr.insert(0, "formats("); Expr.append(");"); - // - // TODO: end of string must have a whitspace. fix it. - // - Expr.append(" "); + // // Run script engine handler diff --git a/hyperdbg/script-engine/code/scanner.c b/hyperdbg/script-engine/code/scanner.c index b537ef4f..6761fda5 100644 --- a/hyperdbg/script-engine/code/scanner.c +++ b/hyperdbg/script-engine/code/scanner.c @@ -740,24 +740,37 @@ GetToken(char * c, char * str) PTOKEN Scan(char * str, char * c) { + static BOOLEAN ReturnEndOfString; PTOKEN Token; + if (InputIdx == 0) + { + ReturnEndOfString = FALSE; + } + + if (ReturnEndOfString) + { + Token = NewToken(END_OF_STACK, "$"); + return Token; + } + + if (str[InputIdx - 1] == '\0') + { + + } while (1) { CurrentTokenIdx = InputIdx - 1; Token = GetToken(c, str); - // - // check end of string - // - if ((int)*c == EOF) + if ((char)*c == EOF) { - Token->Type = END_OF_STACK; - strcpy(Token->Value, "$"); - return Token; + ReturnEndOfString = TRUE; } - else if (Token->Type == WHITE_SPACE) + + + if (Token->Type == WHITE_SPACE) { if (!strcmp(Token->Value, "\n")) {