https://github.com/goldenpathtechnologies/hledger-parser
A parser for hledger journal files based on Chevrotain
https://github.com/goldenpathtechnologies/hledger-parser
hledger ledger plaintext-accounting
Last synced: 5 months ago
JSON representation
A parser for hledger journal files based on Chevrotain
- Host: GitHub
- URL: https://github.com/goldenpathtechnologies/hledger-parser
- Owner: goldenpathtechnologies
- License: mit
- Created: 2023-08-01T01:54:08.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-06-10T01:17:05.000Z (about 2 years ago)
- Last Synced: 2025-08-26T22:09:12.532Z (10 months ago)
- Topics: hledger, ledger, plaintext-accounting
- Language: TypeScript
- Homepage: https://hledger-parser.goldenpath.ca/
- Size: 1.9 MB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 19
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Roadmap: ROADMAP.md
Awesome Lists containing this project
README
# hledger-parser



[](https://conventionalcommits.org)


A parser for hledger journal files based on Chevrotain.
## Grammar
[🏗️ Parsing diagram](https://raw.githack.com/goldenpathtechnologies/hledger-parser/main/diagram.html)
## Installation
```sh
npm install hledger-parser
```
## Usage
```typescript
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
- Tristan Jones ([@jonestristand](https://github.com/jonestristand)), Author
- Daryl G. Wright ([@darylwright](https://github.com/darylwright)), Lead Maintainer
## Contributing
Contributions, issues and feature requests are welcome!
Feel free to check the
[issues page](https://github.com/goldenpathtechnologies/hledger-parser/issues). You can also take a
look at the [contributing guide](https://github.com/goldenapathtechnologies/hledger-parser/blob/master/CONTRIBUTING.md).
## Project roadmap
Please see the [roadmap](ROADMAP.md) for project status and a list of features to be implemented.
## Note
This is a detached fork of the original
[`hledger-parser`](https://github.com/jonestristand/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 ](https://github.com/jonestristand).
Copyright © 2024 [Daryl G. Wright ](https://github.com/darylwright).
This project is [MIT](https://github.com/goldenpathtechnologies/hledger-parser/blob/master/LICENSE) licensed.