hledger-parser

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

Generated using TypeDoc