MCPcopy Create free account
hub / github.com/MultiMC/Launcher / parse_table_header

Function parse_table_header

libraries/hoedown/src/document.c:2252–2342  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2250}
2251
2252static size_t
2253parse_table_header(
2254 hoedown_buffer *ob,
2255 hoedown_document *doc,
2256 uint8_t *data,
2257 size_t size,
2258 size_t *columns,
2259 hoedown_table_flags **column_data)
2260{
2261 int pipes;
2262 size_t i = 0, col, header_end, under_end;
2263
2264 pipes = 0;
2265 while (i < size && data[i] != '\n')
2266 if (data[i++] == '|')
2267 pipes++;
2268
2269 if (i == size || pipes == 0)
2270 return 0;
2271
2272 header_end = i;
2273
2274 while (header_end > 0 && _isspace(data[header_end - 1]))
2275 header_end--;
2276
2277 if (data[0] == '|')
2278 pipes--;
2279
2280 if (header_end && data[header_end - 1] == '|')
2281 pipes--;
2282
2283 if (pipes < 0)
2284 return 0;
2285
2286 *columns = pipes + 1;
2287 *column_data = hoedown_calloc(*columns, sizeof(hoedown_table_flags));
2288
2289 /* Parse the header underline */
2290 i++;
2291 if (i < size && data[i] == '|')
2292 i++;
2293
2294 under_end = i;
2295 while (under_end < size && data[under_end] != '\n')
2296 under_end++;
2297
2298 for (col = 0; col < *columns && i < under_end; ++col) {
2299 size_t dashes = 0;
2300
2301 while (i < under_end && data[i] == ' ')
2302 i++;
2303
2304 if (data[i] == ':') {
2305 i++; (*column_data)[col] |= HOEDOWN_TABLE_ALIGN_LEFT;
2306 dashes++;
2307 }
2308
2309 while (i < under_end && data[i] == '-') {

Callers 1

parse_tableFunction · 0.85

Calls 3

_isspaceFunction · 0.85
hoedown_callocFunction · 0.85
parse_table_rowFunction · 0.85

Tested by

no test coverage detected