Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. Parsec lexeme parsers and whitespace/eol characters
(Sean Cormican)
2. Re: Parsec lexeme parsers and whitespace/eol characters
(Brent Yorgey)
----------------------------------------------------------------------
Message: 1
Date: Sat, 2 Mar 2013 16:57:14 +0000
From: Sean Cormican <[email protected]>
Subject: [Haskell-beginners] Parsec lexeme parsers and whitespace/eol
characters
To: [email protected]
Message-ID:
<caf6xeqcmqhr_mz4e1p0cp_uowkqaw1rcrsbb1pctcvrwoaw...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
Hi,
I'm working with expressions in which I use parsec libraries lexeme
parsers: identifier, integer, whiteSpace etc.
I am attempting to parse haskell declarations and I am facing some
difficulty when trying to delimit the declarations which span multiple
lines using eol character for some reason ( I am led to believe is due to
the removal of whitespace with lexemes )
data Express = Seq [Express]
| ID String
| Num Integer
| BoolConst Bool
| EmptyList String
seqOfExpr8 =
do list <- (sepBy1 expr8 eol)
return $ if length list == 1 then head list else Seq list
where Seq list is a data declaration for a list of expression8's
The parser works correctly unless trying to parse a lexeme parser token
such as an identifier. Upon reading a lexeme token the parser will stop and
output all tokens up until and including that token but no tokens past it.
Also when trying to separate declarations that span multiple lines, does
anyone have an idea on how to achieve this? I have been thinking that the
parser should ignore any end line characters that are followed by
whitespace ( as whitespace is used in Haskell layout rules )
Any thoughts on how I might solve this would be greatly appreciated!
Se?n
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20130302/0223749a/attachment-0001.htm>
------------------------------
Message: 2
Date: Sat, 2 Mar 2013 12:33:20 -0500
From: Brent Yorgey <[email protected]>
Subject: Re: [Haskell-beginners] Parsec lexeme parsers and
whitespace/eol characters
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=iso-8859-1
Hi Sean,
I haven't read your entire message carefully, but I read "I am
attempting to parse Haskell declarations" and I would like to ask: is
there a reason you cannot/do not want to use the 'haskell-src-exts'
package?
-Brent
On Sat, Mar 02, 2013 at 04:57:14PM +0000, Sean Cormican wrote:
> Hi,
>
> I'm working with expressions in which I use parsec libraries lexeme
> parsers: identifier, integer, whiteSpace etc.
>
> I am attempting to parse haskell declarations and I am facing some
> difficulty when trying to delimit the declarations which span multiple
> lines using eol character for some reason ( I am led to believe is due to
> the removal of whitespace with lexemes )
>
> data Express = Seq [Express]
> | ID String
> | Num Integer
> | BoolConst Bool
> | EmptyList String
>
> seqOfExpr8 =
> do list <- (sepBy1 expr8 eol)
> return $ if length list == 1 then head list else Seq list
>
> where Seq list is a data declaration for a list of expression8's
>
> The parser works correctly unless trying to parse a lexeme parser token
> such as an identifier. Upon reading a lexeme token the parser will stop and
> output all tokens up until and including that token but no tokens past it.
>
> Also when trying to separate declarations that span multiple lines, does
> anyone have an idea on how to achieve this? I have been thinking that the
> parser should ignore any end line characters that are followed by
> whitespace ( as whitespace is used in Haskell layout rules )
>
> Any thoughts on how I might solve this would be greatly appreciated!
>
> Se?n
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
------------------------------
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
End of Beginners Digest, Vol 57, Issue 1
****************************************