views:

88

answers:

1

Hello :)

I'm trying to parse a string similar to the following using a spirit parser:

<junk> -somearg#this is a string with a literal ## in it# <junk>

What I'm looking for is a grammar which can extract the portion inside the # marks, but is smart to skip over the double ## in the middle, which is an escape meaning a literal #.

This was what I had in mind:
confix_p(L'#', *anychar_p, L'#' >> ~ch_p(L'#'))
However this returns:
#this is a string with a literal ##
I'd like it to skip over the ## characters .... is this possible?

Billy3

+2  A: 

I solved this by adding a kleene star to the confix parser. Thanks anyway!

*confix_p(L'#', *anychar_p, L'#' >> ~ch_p(L'#')) works as expected.

Billy ONeal