Skip to content

goldenpathtechnologies/hledger-parser

Repository files navigation

hledger-parser

Project Status NPM Version Release Conventional Commits LICENSE

hledger-parser logo

A parser for hledger journal files based on Chevrotain.

Grammar

🏗️ Parsing diagram

Installation

npm install hledger-parser

Usage

import { parseLedgerToCooked } from 'hledger-parser';

const parseResult = parseLedgerToCooked(sourceCode);

console.log(`Lexing errors: ${parseResult.lexErrors.length}`);
console.log(`Parsing errors: ${parseResult.parseErrors.length}`);
console.log('Result:', parseResult.cookedJournal);

// Output:
// => Lexing errors: 0
// => Parsing errors: 0
// => Result: {
// =>   transactions: [
// =>     {
// =>       date: [Object],
// =>       status: 'unmarked',
// =>       description: 'Transaction',
// =>       postings: [Array],
// =>       tags: []
// =>     }
// =>   ],
// =>   accounts: [],
// =>   prices: []
// => }

Contributors

Contributing

Contributions, issues and feature requests are welcome!
Feel free to check the issues page. You can also take a look at the contributing guide.

Project roadmap

Please see the roadmap for project status and a list of features to be implemented.

Note

This is a detached fork of the original hledger-parser, and is in active development. Special thanks goes out to @jonestristand for all the initial work he put into this project!

Show your support

Give a ⭐️ if this project helped you!

License

Copyright © 2022 Tristan Jones jones.tristand@gmail.com.
Copyright © 2024 Daryl G. Wright daryl@goldenpath.ca.
This project is MIT licensed.