Re: [PATCH v2 2/2] mailinfo: unescape quoted-pair in header fields
- From
Kevin Daudt <me@ikke.info>
- Date
- Sep 26, 2016, 05:02 UTC
- Message-ID
- <20160926050230.GA19089@ikke.info>
- In-Reply-To
- <0b6cbc53-e058-f064-59e8-b73203f3e400@gmail.com>
On Mon, Sep 26, 2016 at 12:38:42AM +0200, Jakub Narębski wrote:
Show 16 quoted lines
> W dniu 25.09.2016 o 22:17, Kevin Daudt pisze: > > On Fri, Sep 23, 2016 at 12:15:41AM -0400, Jeff King wrote: > > >> Oops, yes. It is beginning to make the "strbuf_swap()" look less > >> convoluted. :) > >> > > > > I've switched to strbuf_swap now, much better. I've implemented > > recursive parsing without looking at what you provided, just to see what > > I'd came up with. Though I've not implemented a recursive descent > > parser, but it might suffice. > > I think you can implement a parser handling proper nesting of parens > without recursion. > > Though... what is the definition in the RFC?
This part describes comments.
ccontent = ctext / quoted-pair / comment
comment = "(" *([FWS] ccontent) [FWS] ")"CFWS = *([FWS] comment) (([FWS] comment) / FWS)
So each comment can itself also contain a comment.
This could be done without recursion by keeping a count of how many open parens we have encountered.
Kevin