ledger-parser
Rust library for parsing Ledger-cli input files.
File format
Only a subset of the ledger-cli's file format is implemented.
Supported elements:
-
Line comments (starting with:
; # % | *
) -
Inline comments (starting with
;
) -
Transaction headers with format (minimum two spaces or one tab between
DESC
andNOTE
):DATE[=EDATE] [*|!] [(CODE)] DESC [; NOTE]
-
Transaction postings with format (minimum two spaces or one tab between
ACCOUNT
andAMOUNT
):ACCOUNT [AMOUNT] [= BALANCE] [; NOTE]
- Virtual accounts are supported
-
AMOUNT
can be combined with lot and commodity prices ({}, {{}}, @, @@) -
Commodity prices with format:
P DATE SYMBOL PRICE
-
Command directives:
include
Example
Parsing:
let ledger = parse?;
Serializing:
use ;
println!;
println!;
See also
- ledger-utils - ledger-cli file processing Rust library, useful for calculating balances, creating reports etc.