conf_dict_block: ^name\s*=\s*\{(.*?)^\} -- the text between, or false. */
| 232 | |
| 233 | /* conf_dict_block: ^name\s*=\s*\{(.*?)^\} -- the text between, or false. */ |
| 234 | static bool py_conf_block(const char *s, size_t n, const char *name, size_t *a, size_t *b) { |
| 235 | for (size_t line = 0; line < n;) { |
| 236 | size_t i = py_assign_at(s, n, line, name); |
| 237 | if (i > 0 && i < n && s[i] == '{') { |
| 238 | size_t k = i + 1; |
| 239 | while (k < n) { |
| 240 | if (s[k] == '}' && (k == 0 || s[k - 1] == '\n')) { |
| 241 | *a = i + 1; |
| 242 | *b = k; |
| 243 | return true; |
| 244 | } |
| 245 | k++; |
| 246 | } |
| 247 | return false; |
| 248 | } |
| 249 | const char *nl = memchr(s + line, '\n', n - line); |
| 250 | line = nl ? (size_t)(nl - s) + 1 : n; |
| 251 | } |
| 252 | return false; |
| 253 | } |
| 254 | |
| 255 | /* ["']([\w.-]+)["'] at s[i] (extra: also '.'): its end after the closing quote, or 0. */ |
| 256 | static size_t py_quoted_key(const char *s, size_t n, size_t i, bool dots, size_t *ka, size_t *kb) { |
no test coverage detected