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

Document Syntax #5

Open
lorenzleutgeb opened this issue Nov 16, 2021 · 2 comments
Open

Document Syntax #5

lorenzleutgeb opened this issue Nov 16, 2021 · 2 comments
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers

Comments

@lorenzleutgeb
Copy link

It was not clear to me from README.md which characters knut allows for account names. I am one of these weird individualists likes to use spaces in account names and slashes to separate subaccounts.

It turns out that knut "only" supports colons, unicode letters, and unicode digits (guessing from the following snippet). Which is okay, but would be nice to state in the docs.

knut/lib/parser/parser.go

Lines 512 to 520 in 598e6ac

func (p *Parser) parseAccount() (*accounts.Account, error) {
s, err := p.scanner.ReadWhile(func(r rune) bool {
return r == ':' || unicode.IsLetter(r) || unicode.IsDigit(r)
})
if err != nil {
return nil, err
}
return accounts.Get(s)
}

It might also be worth noting that there's the concept of an "identifier" and that commodities are parsed as identifiers.

@sboehler sboehler added documentation Improvements or additions to documentation good first issue Good for newcomers labels Nov 22, 2021
@sboehler
Copy link
Owner

sboehler commented Nov 22, 2021

It shares these restrictions with most PTA tools. Allowing spaces would make parsing significantly more complex, and colons seem to be the gold standard for declaring subaccounts. Agree this could be documented.

@simonjpascoe
Copy link

Can confirm about the spaces making the parser a lot more difficult to handle; you have to then rely on a double space (or more) to signify the end of an account declaration - I took it out. W.r.t. slashes, I've adopted those in blossom to be semi-virtual accounts, e.g. Liability:Bank:CreditCard1/21x9 for the September statement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants