Skip to content

A parser for ledger/hledger journal files based on Chevrotain

License

Notifications You must be signed in to change notification settings

jonestristand/hledger-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Caution

This repository has been DEPRECATED. The project is still maintained at https://github.com/goldenpathtechnologies/hledger-parser.

Welcome to hledger-parser 👋

Version Documentation Maintenance License: MIT Circle CI Twitter: TDJonesEM

hledger-parser logo

A parser for ledger/hledger journal files based on Chevrotain

Grammar

🏗️ Parsing diagram

Install as Library

npm install @jones.tristand/hledger-parser

Usage

import { parseLedgerToCooked } from '@jones.tristand/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: []
// => }

Author

👤 Tristan Jones jones.tristand@gmail.com

🤝 Contributing

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

Show your support

Give a ⭐️ if this project helped you!

📝 License

Copyright © 2022 Tristan Jones jones.tristand@gmail.com.
This project is MIT licensed.


This README was generated with ❤️ by readme-md-generator

About

A parser for ledger/hledger journal files based on Chevrotain

Resources

License

Stars

Watchers

Forks

Packages

No packages published