#parser #hledger #journal #jornal

bin+lib hledger-parser

Hledger jornal parser

2 releases

new 1.0.0-beta.2 Nov 4, 2024
1.0.0-beta.1 Oct 27, 2024

#587 in Filesystem

Download history 97/week @ 2024-10-22 72/week @ 2024-10-29

173 downloads per month

MIT license

135KB
4K SLoC

hledger-parser

Coverage Status crates.io docs.rs License actions-badge

parser for hledger journals powered by chumsky

goals

  • parse plaintext .journals into structured data to build tools on top

non goals

  • re-build hledger in rust

current state

public beta

it's able to parse cheatsheet and my personal ledger (which is quite extensive)

i don't like the api so far, so it will probably change

things i don't like:

  • year directive - it is only used for parsing, probably no reason to export it?
  • decimal mark directive - same thing
  • error messages
  • period::interval type definitions
  • exporting chrono and rust_decimal types. maybe it's better to define own types?

binary

a small binary comes with this lib that i found helpful during development and testing

it takes path to a .journal file, and outputs parse result or parsing error

> cargo run --features cli -- --help
Usage: hledger-parser --ledger-file <LEDGER_FILE>

Options:
      --ledger-file <LEDGER_FILE>  [env: LEDGER_FILE=/path/to/ledger.journal]
  -h, --help                       Print help

Dependencies

~7–14MB
~171K SLoC