Re: [Haskell-cafe] A simple attoparsec question

2011-03-03 Thread Malcolm Wallace
On 1 Mar 2011, at 21:58, Evan Laforge wrote: parseConstant = Reference $ try parseLocLabel | PlainNum $ decimal | char '#' * fmap PlainNum hexadecimal | char '\'' * (CharLit $ notChar '\n') * char '\'' | try $ (char '' * (StringLit . B.pack

[Haskell-cafe] A simple attoparsec question

2011-03-01 Thread Robert Clausecker
Hi Haskellers! I'm currently trying to write an assembler for Knuths MMIXAL language. Currently, I'm writing the parser using attoparsec, and have one question: In MMIXAL, a string literal starts with a , followed by an arbitrary amount of arbitrary characters excluding the newline character and

Re: [Haskell-cafe] A simple attoparsec question

2011-03-01 Thread Evan Laforge
 parseConstant = Reference $ try parseLocLabel              | PlainNum $ decimal              | char '#' * fmap PlainNum hexadecimal              | char '\'' * (CharLit $ notChar '\n') * char '\''              | try $ (char '' * (StringLit . B.pack $                    manyTill (notChar

Re: [Haskell-cafe] A simple attoparsec question

2011-03-01 Thread Daniel Fischer
On Tuesday 01 March 2011 22:15:38, Robert Clausecker wrote: I hope, you understand my question. Not sure. If I understand correctly, if you have someParser = foo | bar | parseConstant | baz | quux and invoke someParser on something like \Line\nLine\ it tries baz and quux

Re: [Haskell-cafe] A simple attoparsec question

2011-03-01 Thread Steve Schafer
On Tue, 01 Mar 2011 22:15:38 +0100, you wrote: The problem is, that attoparsec just silently fails on this kind of strings and tries other parsers afterwards, which leads to strange results. Can you give a concrete example of the problem that you're seeing here? (Basically, you're describing