No it's great your ticket description is spot on. Thanks for filing it. I'll try to prototype comments parsing plus printer for intermediate ast in v3 and let you know. The new parser is working at this point - generates exactly what the python one did but in c++ protos - I just have to figure out the python bindings for protos.
On Tue, Dec 1, 2020, 10:33 Aaron Lindsay <[email protected]> wrote: > > > On Tuesday, December 1, 2020 at 9:36:42 AM UTC-5 Aaron Lindsay wrote: > >> On Monday, November 30, 2020 at 11:26:13 PM UTC-5 [email protected] wrote: >> >>> What you may be able to do instead is manipulate the input text. But in >>> v3 I'll provide both beginning and end lines as part of all directive data, >>> so that should allow you to break apart your file cleanly, using the same >>> parser used for processing. Also, I could easily provide some library >>> function to accept a file and produce a mapping of >>> >>> (parser-directive, text) >>> >>> whereby the parser directive is the unprocessed, >>> straightforward translation of your input text to the intermediate data >>> structure, which you could more easily inspect and reason about - keeping >>> in mind that some of the fields may be unset,e.g. if you leave out a number >>> to be interpolated -- in order to decide where to reinsert the >>> corresponding text in your output file. Please file a ticket if this would >>> be useful. I'm in the process of rewriting the parser in C++ (almost done >>> actually). >>> >> >> I do think this would be useful - I'll try to write it up. How would user >> code hook into beancount to get this listing? Would there just be a parser >> function call to be imported and called via arbitrary python that would >> return a list of these tuples? >> > > I filed https://github.com/beancount/beancount/issues/586. One thing I > realized when writing it up is that many of the more sophisticated things I > can envision wanting to do with a programmatic ability to re-write a ledger > involve adding or changing the contents of directives in addition to merely > moving them around. Obviously this adds complexity, but it seems like maybe > the main pieces are already being discussed (parsing comments inside > transactions, and being able to print the intermediate representation)? > Feel free to tell me I'm getting a little too crazy, though! > > -Aaron > > -- > 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/37d0dbe1-0d15-4edf-8081-6c876250dcd5n%40googlegroups.com > <https://groups.google.com/d/msgid/beancount/37d0dbe1-0d15-4edf-8081-6c876250dcd5n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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/CAK21%2BhO0NL29cv24x69-v68GPxikgPwDhMOUUD8jRiUvbno4sw%40mail.gmail.com.
