Parse `[section.path]` header — returns the section name as a flat * dotted string, e.g. "dependencies" or "workspace.dependencies". */
| 118 | /* Parse `[section.path]` header — returns the section name as a flat |
| 119 | * dotted string, e.g. "dependencies" or "workspace.dependencies". */ |
| 120 | static int parse_section(CBMArena* a, const char* s, int len, int from, |
| 121 | const char** out) { |
| 122 | if (from >= len || s[from] != '[') return from; |
| 123 | /* Skip leading `[` or `[[`. */ |
| 124 | bool array_of_tables = false; |
| 125 | from++; |
| 126 | if (from < len && s[from] == '[') { array_of_tables = true; from++; } |
| 127 | int start = from; |
| 128 | while (from < len && s[from] != ']') from++; |
| 129 | *out = cbm_arena_strndup(a, s + start, (size_t)(from - start)); |
| 130 | /* Consume closing `]` (or `]]`). */ |
| 131 | if (from < len) from++; |
| 132 | if (array_of_tables && from < len && s[from] == ']') from++; |
| 133 | return from; |
| 134 | } |
| 135 | |
| 136 | /* For the `[dependencies]` / `[dev-dependencies]` / `[workspace.dependencies]` |
| 137 | * sections, parse `key = value` lines until the next section. The value |
no test coverage detected