line breaks

This commit is contained in:
Neil 2023-05-06 23:36:23 -07:00
parent ecf33b18df
commit 04c87cbfa6
1 changed files with 4 additions and 11 deletions

View File

@ -115,6 +115,8 @@ static int scan_day(struct scan *const scan, union date32 date,
const char *const buffer) {
const char *YYCURSOR, *YYMARKER, *yyt1, *yyt2, *yyt3, *s0, *s1, *t0, *t1;
enum YYCONDTYPE condition = yycline;
/* All '\n' might overflow on last, but it wouldn't matter because there's
no content. */
size_t line = 1;
char datestr[12] = {0};
const char *fail = "perhaps a bat?";
@ -220,8 +222,8 @@ static int scan_day(struct scan *const scan, union date32 date,
case TREE_ABSENT:
*pi = (size_t)(ed - scan->edits.array.data); break;
}
fprintf(stderr, "%s[%zu]: new edit from %"
PRIu32 "-%" PRIu32 "-%" PRIu32 " stored at %zu.\n",
fprintf(stderr, "%s[%zu]: new remark from %"
PRIu32 "-%.2" PRIu32 "-%.2" PRIu32 " stored at %zu.\n",
datestr, line, ed->edit.year, ed->edit.month, ed->edit.day, *pi);
continue;
}
@ -231,8 +233,6 @@ static int scan_day(struct scan *const scan, union date32 date,
const struct pair keyword = pair(s0, s1);
const union line64 key = { { (uint32_t)line, date } };
size_t i, *pi;
if(line > UINT32_MAX)
{ errno = ERANGE; fail = "too many lines of text"; goto catch; }
/*fprintf(stderr, "map: <<%.*s>> out of %s\n", (int)(s1 - s0), s0,
pair_map_table_to_string(&scan->places.map));*/
if(!(i = pair_map_table_get(&scan->places.map, keyword)))
@ -287,9 +287,6 @@ static int scan_day(struct scan *const scan, union date32 date,
const struct pair keyword = pair(s0, s1);
const union line64 key = { { (uint32_t)line, date } };
size_t i, *pi;
//fixme: verify way before
if(line > UINT32_MAX)
{ errno = ERANGE; fail = "too many lines of text"; goto catch; }
if(!(i = pair_map_table_get(&scan->sources.map, keyword)))
{ fail = "keyword not introduced"; goto catch; }
switch(linemap_tree_bulk_assign(&scan->sources.dates, key, &pi)) {
@ -327,8 +324,6 @@ static int scan_day(struct scan *const scan, union date32 date,
const struct pair keyword = pair(s0, s1);
const union line64 key = { { (uint32_t)line, date } };
size_t idx, *pidx;
if(line > UINT32_MAX)
{ errno = ERANGE; fail = "too many lines of text"; goto catch; }
if(!(idx = pair_map_table_get(&scan->scores.map, keyword)))
{ fail = "keyword not introduced"; goto catch; }
if(scan->scores.array.data[idx].last.u32 >= date.u32)
@ -392,7 +387,6 @@ static int scan_day(struct scan *const scan, union date32 date,
<glider_type> ws* @s0 semilabel @s1 ";" => glider_reg {
const union line64 key = {{ (uint32_t)line, date }};
assert(!new_glider);
if(line > UINT32_MAX) { fail = "line overflow"; goto catch; }
switch(glider_tree_bulk_assign(&scan->gliders, key, &new_glider)) {
case TREE_PRESENT: fail = "duplicate"; case TREE_ERROR: goto catch;
case TREE_ABSENT: break;
@ -462,7 +456,6 @@ static int scan_day(struct scan *const scan, union date32 date,
<flight_type> ws* @s0 semilabel @s1 ";" => flight_reg {
const union line64 key = {{ (uint32_t)line, date }};
assert(!new_flight);
if(line > UINT32_MAX) { fail = "line overflow"; goto catch; }
switch(flight_tree_bulk_assign(&scan->flights, key, &new_flight)) {
case TREE_PRESENT: fail = "duplicate key";
case TREE_ERROR: goto catch;