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

Function consumeLuaWord

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

* @brief Consumes a Lua identifier, applying block open/close keyword deltas; returns next index. */

Source from the content-addressed store, hash-verified

372 * @brief Consumes a Lua identifier, applying block open/close keyword deltas; returns next index.
373 */
374static int consumeLuaWord(QStringView line, int i, TokenTrack& tk, LineInfo& info)
375{
376 int j = i;
377 while (j < line.size() && isLuaIdentChar(line[j], false))
378 ++j;
379
380 const QString word = line.mid(i, j - i).toString();
381 if (luaCloseKeywords().contains(word)) {
382 if (!tk.sawCode)
383 ++info.outdentLeading;
384
385 --info.netDelta;
386 }
387
388 if (luaOpenKeywords().contains(word))
389 ++info.netDelta;
390
391 if (tk.firstWord.isEmpty())
392 tk.firstWord = word;
393
394 tk.lastWord = word;
395 markCode(tk, line[j - 1], true);
396 return j;
397}
398
399/**
400 * @brief Consumes a JavaScript identifier and records it in the track; returns next index.

Callers 1

analyzeLineFunction · 0.85

Calls 5

isLuaIdentCharFunction · 0.85
markCodeFunction · 0.85
isEmptyMethod · 0.80
sizeMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected