
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
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-Parse... )
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-parser... 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@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe