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

Function consumeJsWord

app/src/DataModel/Editors/CodeFormatter.cpp:402–414  ·  view source on GitHub ↗

* @brief Consumes a JavaScript identifier and records it in the track; returns next index. */

Source from the content-addressed store, hash-verified

400 * @brief Consumes a JavaScript identifier and records it in the track; returns next index.
401 */
402static int consumeJsWord(QStringView line, int i, TokenTrack& tk)
403{
404 int j = i;
405 while (j < line.size() && isJsIdentChar(line[j], false))
406 ++j;
407
408 if (tk.firstWord.isEmpty())
409 tk.firstWord = line.mid(i, j - i).toString();
410
411 tk.lastWord = line.mid(i, j - i).toString();
412 markCode(tk, line[j - 1], true);
413 return j;
414}
415
416/**
417 * @brief Flags the line as a hanging header when its code is a brace-free JS control statement.

Callers 1

analyzeLineFunction · 0.85

Calls 4

isJsIdentCharFunction · 0.85
markCodeFunction · 0.85
isEmptyMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected