income, fixed up journal {book:} to [book:]

This commit is contained in:
Neil 2023-05-09 16:08:10 -07:00
parent e87f25c9ee
commit d08047d4db
2 changed files with 24 additions and 5 deletions

View File

@ -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;

View File

@ -229,6 +229,8 @@ static int scan_day(struct scan *const scan, union date32 date,
<bracket> "vaccine: " :=> vaccine
<bracket> "tax: " :=> tax
<bracket> "in: " :=> income
<bracket> "mail: " :=> mail
/* Whatsapp messages ignored. [11-03, 04:19] Contact: massage
Hopefully they don't have a ':' in their name. */
<bracket> [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,
}
<income> * { fail = "income unrecognized"; goto catch; }
/*<income> @s0 bralabel @s1 "]" => input_money {
<income> @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;
}
<mail> * { fail = "mail unrecognized"; goto catch; }
<mail> @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;
}
<income_remark> "]"*/
<place> * { fail = "place unrecognized"; goto catch; }
<place> @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;