diff --git a/src/scan.h b/src/scan.h index 0c57a0b..3e43af7 100644 --- a/src/scan.h +++ b/src/scan.h @@ -135,7 +135,7 @@ struct scan { struct linemap_tree dates; } edits; struct linekvpair_tree contacts, books, tvs, movies, ideas, vaccines; - struct linekvmoney_tree taxes; + struct linekvmoney_tree taxes, incomes; struct glider_tree gliders; struct flight_tree flights; struct kjv_tree kjvs; diff --git a/src/scan.re.c b/src/scan.re.c index ce02ae7..80ec2c6 100644 --- a/src/scan.re.c +++ b/src/scan.re.c @@ -229,6 +229,8 @@ static int scan_day(struct scan *const scan, union date32 date, "vaccine: " :=> vaccine "tax: " :=> tax "in: " :=> income + "mail: " :=> mail + /* Whatsapp messages ignored. [11-03, 04:19] Contact: massage Hopefully they don't have a ':' in their name. */ [0-1][0-9] "-" [0-3][0-9] ", " [0-2][0-9] ":" [0-5][0-9] "] " @@ -392,7 +394,7 @@ static int scan_day(struct scan *const scan, union date32 date, } * { fail = "income unrecognized"; goto catch; } - /* @s0 bralabel @s1 "]" => input_money { + @s0 bralabel @s1 "]" => input_money { const union line64 key = { { (uint32_t)line, date } }; struct kvmoney *pair; switch(linekvmoney_tree_bulk_assign(&scan->taxes, key, &pair)) { @@ -401,12 +403,27 @@ static int scan_day(struct scan *const scan, union date32 date, } pair->key.a = s0, pair->key.b = s1; pair->value = (struct money){0, CAD}; - input.future = yycincome_remark, input.pair = &pair->value; - fprintf(stderr, "%s[%zu]: new tax <<%.*s>>.\n", + input.future = yycline, input.money = &pair->value; + fprintf(stderr, "%s[%zu]: new money <<%.*s>>.\n", + datestr, line, (int)(s1 - s0), s0); + continue; + } + + * { fail = "mail unrecognized"; goto catch; } + @s0 bralabel @s1 "]" => input_text { + const union line64 key = { { (uint32_t)line, date } }; + struct kvpair *pair; + switch(linekvpair_tree_bulk_assign(&scan->vaccines, key, &pair)) { + case TREE_PRESENT: fail = "duplicate"; case TREE_ERROR: goto catch; + case TREE_ABSENT: break; + } + pair->key.a = s0, pair->key.b = s1; + pair->value.a = pair->value.b = 0; + input.future = yycnewline, input.pair = &pair->value; + fprintf(stderr, "%s[%zu]: new mail <<%.*s>>.\n", datestr, line, (int)(s1 - s0), s0); continue; } - "]"*/ * { fail = "place unrecognized"; goto catch; } @s0 parlabel @s1 / "\n" => skip { also_place: { @@ -873,6 +890,7 @@ void scan_(struct scan *const scan) { kjv_tree_(&scan->kjvs); flight_tree_(&scan->flights); glider_tree_(&scan->gliders); + linekvmoney_tree_(&scan->incomes); linekvmoney_tree_(&scan->taxes); linekvpair_tree_(&scan->vaccines); linekvpair_tree_(&scan->ideas); @@ -952,6 +970,7 @@ struct scan scan(struct journal *const jrnl) { || !linekvpair_tree_bulk_finish(&scan.ideas) || !linekvpair_tree_bulk_finish(&scan.vaccines) || !linekvmoney_tree_bulk_finish(&scan.taxes) + || !linekvmoney_tree_bulk_finish(&scan.incomes) || !glider_tree_bulk_finish(&scan.gliders) || !flight_tree_bulk_finish(&scan.flights) || !kjv_tree_bulk_finish(&scan.kjvs)) goto catch;