MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / parseString

Method parseString

app/src/DataModel/Scripting/JsScriptEngine.cpp:321–345  ·  view source on GitHub ↗

* @brief Runs the JS parse function over a text frame. */

Source from the content-addressed store, hash-verified

319 * @brief Runs the JS parse function over a text frame.
320 */
321QList<QStringList> DataModel::JsScriptEngine::parseString(const QString& frame)
322{
323 Q_ASSERT(!frame.isEmpty());
324
325 if (!m_parseFunction.isCallable() || m_disabled)
326 return {};
327
328 QJSValueList args;
329 args << frame;
330 const auto jsResult = guardedCall(args);
331
332 if (m_watchdog.lastCallTimedOut()) [[unlikely]] {
333 qWarning() << "[JsScriptEngine] parse() timed out after" << kRuntimeWatchdogMs << "ms";
334 (void)noteTimeoutAndCheckDisabled(0);
335 return {};
336 }
337
338 if (jsResult.isError()) [[unlikely]] {
339 qWarning() << "[JsScriptEngine] JS error:" << jsResult.property("message").toString();
340 return {};
341 }
342
343 resetTimeoutCounter();
344 return convertJsResult(jsResult);
345}
346
347/**
348 * @brief Runs the JS parse function over a binary frame.

Callers

nothing calls this directly

Calls 4

convertJsResultFunction · 0.85
isEmptyMethod · 0.80
lastCallTimedOutMethod · 0.80
isErrorMethod · 0.80

Tested by

no test coverage detected