[Haskell-cafe] Wanted: composoable parsers from haskell-src-exts

Niklas Broberg niklas.broberg at gmail.com
Tue Mar 15 09:15:52 CET 2011


Hi Johannes,

The answer is:

A) You can't, the way haskell-src-exts is built. You need to specify the
%partial directives in the happy grammar, so without editing
haskell-src-exts there's no way you could tack on partiality to the existing
parsing primitives.

B) It's a great feature request (to the point where I wonder why I haven't
thought of it before), that should be quite easy to implement. I already
export a partial parser for top-of-file pragmas, there's no reason why I
couldn't export partial parsers for all the other entry points as well. I
hope I can implement it shortly, but if you want it really fast and certain
- patches are most welcome!

Cheers,

/Niklas


On Mon, Mar 14, 2011 at 6:55 PM, J. Waldmann
<waldmann at imn.htwk-leipzig.de>wrote:

> Hi.
>
> I want to use parsers from haskell-src-exts as sub-parsers,
> which does not seem to work since they insist on consuming the input
> completely.
>
> I would need them to parse a maximal prefix,
> and return the (unconsumed) rest of input as well
> (cf.
>
> http://hackage.haskell.org/packages/archive/parsec/3.1.1/doc/html/Text-Parsec-Prim.html#v:getInput
> )
>
> I figure that happy has the %partial directive for that, but the
> description
>
> http://www.haskell.org/happy/doc/html/sec-directives.html#sec-partial-parsers
> does not really tell me how to obtain the rest of the input.
>
> Any hints (or code samples) appreciated. Thanks - J.W.
>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110315/197e5730/attachment.htm>


More information about the Haskell-Cafe mailing list