diff --git a/src/scan.re.c b/src/scan.re.c index ec3b05a..261a108 100644 --- a/src/scan.re.c +++ b/src/scan.re.c @@ -170,7 +170,7 @@ static int scan_day(struct scan *const scan, union date32 date, /*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))) - { fail = "keyword not introduced"; /*goto catch;*/ continue; } + { fail = "keyword not introduced"; goto catch; } switch(linemap_tree_bulk_assign(&scan->places.dates, key, &pi)) { case TREE_PRESENT: fail = "duplicate"; case TREE_ERROR: goto catch; case TREE_ABSENT: *pi = i; break; @@ -198,6 +198,23 @@ static int scan_day(struct scan *const scan, union date32 date, datestr, line, (int)(s1 - s0), s0, x, y, *idx); goto also_place; } + // anonymous place: bypass map and have a 1:1 correspondence + "(" @t0 decimal "," @t1 decimal ")" / "\n" => skip { + size_t *idx; + struct place *place; + const double x = strtod(t0, 0), y = strtod(t1, 0); /* Safe? */ + const union line64 key = { { (uint32_t)line, date } }; + if(!(place = place_array_new(&scan->places.array))) goto catch; + place->name.a = place->name.b = 0; + place->x = x, place->y = y; + switch(linemap_tree_bulk_assign(&scan->places.dates, key, &idx)) { + case TREE_PRESENT: fail = "duplicate"; case TREE_ERROR: goto catch; + case TREE_ABSENT: break; + } + *idx = (size_t)(place - scan->places.array.data); + continue; + } + * { fail = "source unrecognized"; goto catch; } @@ -614,6 +631,11 @@ struct scan scan(struct journal *const jrnl) { if(!(nul = source_array_new(&scan.sources.array))) goto catch; *nul = (struct source){0}; } + { + struct place *nul; + if(!(nul = place_array_new(&scan.places.array))) goto catch; + *nul = (struct place){0}; + } { struct score *nul; if(!(nul = score_array_new(&scan.scores.array))) goto catch;