* @brief If line[i:] opens a Lua long-bracket form, returns its level and length. */
| 133 | * @brief If line[i:] opens a Lua long-bracket form, returns its level and length. |
| 134 | */ |
| 135 | static bool tryLuaLongOpen(QStringView line, int i, int& outLevel, int& outConsume) |
| 136 | { |
| 137 | if (i >= line.size() || line[i] != QLatin1Char('[')) |
| 138 | return false; |
| 139 | |
| 140 | int level = 0; |
| 141 | int j = i + 1; |
| 142 | while (j < line.size() && line[j] == QLatin1Char('=')) { |
| 143 | ++level; |
| 144 | ++j; |
| 145 | } |
| 146 | |
| 147 | if (j >= line.size() || line[j] != QLatin1Char('[')) |
| 148 | return false; |
| 149 | |
| 150 | outLevel = level; |
| 151 | outConsume = (j - i) + 1; |
| 152 | return true; |
| 153 | } |
| 154 | |
| 155 | /** |
| 156 | * @brief If line[i:] closes a Lua long-bracket form at the given level, returns the length. |
no test coverage detected