Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

account directives are not lexed #5

Open
hellerbarde opened this issue May 17, 2016 · 1 comment
Open

account directives are not lexed #5

hellerbarde opened this issue May 17, 2016 · 1 comment

Comments

@hellerbarde
Copy link

Explicit definitions of accounts are not lexed or parsed. How hard would this be to implement? could you point me in the right direction? Maybe I can find some time to do it and file a pull request. (No promises though, exams are looming :)

A snippet from my test ledger file (fantasy values, obviously):

<snip/>
account Expenses
    note Expenses
    check commodity == "CHF"

account Expenses:Taxes:Social Security
    note Social Security
    check commodity == "CHF"

account Expenses:Bank Service Charge
    note Bank Service Charge
    check commodity == "CHF"

account Income:Bonus
    note Bonus
    check commodity == "CHF"

account Income:Interest Income:Savings Interest
    note Savings Interest
    check commodity == "CHF"


2016/05/14 * Opening Balance
    Assets:Current Assets:Mieterkautionssparkonto    100.00 CHF
    Equity:Opening Balances                    -100.00 CHF

2016/05/14 * opening balance
    Assets:Current Assets:Sparkonto        100.00 CHF
    Equity:Opening Balances                   -100.00 CHF

2016/05/14 * opening balance
    Assets:Current Assets:Main              100.00 CHF
    Equity:Opening Balances                    -100.00 CHF

2016/05/14 * initial
    Liabilities:Credit Card                      100.00 CHF
    Equity:Opening Balances                     -100.00 CHF

@Rudd-O
Copy link
Owner

Rudd-O commented May 17, 2016

On 05/17/2016 12:04 PM, P Stark wrote:

Explicit definitions of accounts are not lexed or parsed. How hard
would this be to implement? could you point me in the right direction?
Maybe I can find some time to do it and file a pull request. (No
promises though, exams are looming :)

A snippet from my test ledger file (fantasy values, obviously):

| account Expenses note Expenses check commodity == "CHF"
account Expenses:Taxes:Social Security note Social Security check
commodity == "CHF" account Expenses:Bank Service Charge note Bank
Service Charge check commodity == "CHF" account Income:Bonus note
Bonus check commodity == "CHF" account Income:Interest Income:Savings
Interest note Savings Interest check commodity == "CHF" 2016/05/14 *
Opening Balance Assets:Current Assets:Mieterkautionssparkonto 100.00
CHF Equity:Opening Balances -100.00 CHF 2016/05/14 * opening balance
Assets:Current Assets:Sparkonto 100.00 CHF Equity:Opening Balances
-100.00 CHF 2016/05/14 * opening balance Assets:Current Assets:Main
100.00 CHF Equity:Opening Balances -100.00 CHF 2016/05/14 * initial
Liabilities:Credit Card 100.00 CHF Equity:Opening Balances -100.00 CHF |

This should be trivial to add to the lexer, actually. If you look into
the lexer Python file, it should be a case to be added, following the
examples in the file. You can also check in this file example you sent,
and then wire it into the tests, so that you can run "nosetests -v"
against the repository with your changes, and it will tell you whether
your lexing case worked or not.

A formal lexer grammar that generated lexing code would be even better.

Happy to take pull requests!
You also have a Mieterkautionssparkonto! Cool!

Rudd-O
http://rudd-o.com/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants