On Friday, May 8, 2015 at 12:03:29 PM UTC-4, John Wiegley wrote:
>
> >>>>> David Sklar <[email protected] <javascript:>> writes: 
>
> > What if the code in textual.cc was augmented so that as the case 
> statement 
> > in read_next_directive() dispatches control to the various *_directive() 
> > methods (and as those methods do their own parsing of e.g. transaction 
> > parts) some stream of tokens could be emitted? Then something that could 
> > read those tokens could then operate on that set of tokens, perhaps 
> adding 
> > new ones, removing, etc., and then feed it back into something which 
> would 
> > re-construct the ledger file. 
> > 
> > There are a number of implementation details to sort out but is this 
> sort of 
> > thing something people would find useful? The alternative (for my use 
> cases) 
> > would be to essentially duplicate the parsing logic in textual.cc to be 
> able 
> > to generate my own token stream. Which is obviously not ideal for a 
> variety 
> > of reasons. 
>
> Note that I have written a standalone parser for Ledger files, except it's 
> in 
> Haskell.  However, what you're suggesting sounds like it could be useful, 
> it 
> would just be a fair bit of work to instrument the parser everywhere with 
> sufficiently accurate token emitting code. 
>
> John 
>

Hi, John. Is the code for your Haskell parser available anywhere to 
examine? After looking through textual.cc and the various things that get 
called, I am less sanguine about the feasibility of accurately 
instrumenting the existing code to emit tokens properly (including skipped 
whitespace, etc.)

David

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to