On 10/04/2022 00:35, Fang-Pen Lin wrote:
On Saturday, April 9, 2022 at 12:53:06 PM UTC-7 [email protected] wrote:
     > I really like Python's black formatter and how it works. With the
     > needs in mind, I built two projects:
     >
     > beancount-parser
     > <https://github.com/LaunchPlatform/beancount-parser
    <https://github.com/LaunchPlatform/beancount-parser>> - Standalone
     > Lark based Beancount syntax parser

    I don't know Lark much and I had just a quick look, but something seems
    odd: how do you handle indentation? I don't see anything about it in
    the
    grammar files. I realize that ignoring this aspect may be fine if the
    goal is to generate a syntax three to use in a formatting tool
    operating
    on known valid input files. Otherwise, this is not a validating parser.
    Maybe something to mention in the documentation.


You are right, my parser tool won't validate the syntax. It's not meant to be a replacement of beancount core library, only to facilitate the formatter. And yeah, I will update the document to make it clear that there won't be validation for syntax.

Without handling indentation, how do you distinguish between this:

* Assets:Section:With:Funny:Name

and this:

2022-04-10 * "Test"
  * Assets:Posting:With:Flag

or between this two metadata entries:

2022-04-10 * "Test"
  transaction-metadata: 42
  Assets:Tests  1 TEST
    posting:metadata: 25

?

I gave it a quick try via the online formatter and the posting flag is interpreted as an org-mode heading and posting metadata entries are not supported.

It also seems that flag characters are limited to '*' and '!'.

Cheers,
Dan

--
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/d73bba16-3514-d1a4-6605-25e9b65e4170%40grinta.net.

Reply via email to