-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
As noted in the 2006 item, I have years of data in this tab-separated format; for example:
3/28/08 D0962 S STAPLES 00108084 ANKENY IA Canon Powershot SD Stuff:Major:AV R -249.99
I played with invisible XML and its playground and turned that into...
<tx num="S">
<date month="3" day="28" year="08"/>
<account>D0962</account>
<description>STAPLES 00108084 ANKENY IA</description>
<split status="R">
<memo>Canon Powershot SD</memo>
<category>Stuff:Major:AV</category>
<amount>-249.99</amount>
</split>
</tx>using...
tx: date, account, @num, description, split.
split: memo, category, @status, amount.
date: @month, -"/", @day, -"/", @year, tab.
month: ["0"-"9"]+.
day: ["0"-"9"]+.
year: ["0"-"9"]+.
account: field, tab.
num: -space?, field, tab.
description: field, tab.
memo: field, tab.
category: field, tab { TODO: split on : ? }.
status: field, tab.
amount: field { TODO: constrain to number syntax? }.
-field: ~[" "], (~[#9])*. { don't start with space to avoid ambiguity in num }
-tab: -#9.
-space: -[" "]+.
TODO:
- handle >1 tx
- handle >1 split
- write JSON lines instead of XML
- find a simple implementation, preferably by aggressively pre-compiling
- perhaps just use this as a spec for a hand-rolled parser
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels