Thankyou all. Once I get more familiar with Parsec I might do my own
lexeme parser. For now I've changed its definition of "simpleSpace" to 

simpleSpace =
   skipMany1 (satisfy (\c -> (c /= '\n') && (isSpace c)))

so that it skips whitespace, but not newlines. My parser then explicitly
matches newlines whenever I need to.

Cheers,
Paul

-----Original Message-----
From: Brandon S. Allbery KF8NH [mailto:[EMAIL PROTECTED] 
Sent: 26 March 2008 11:48
To: [email protected] Cafe; Paul Keir
Subject: Re: [Haskell-cafe] No newlines in the whitespace for Parsec
lexeme parsers


On Mar 26, 2008, at 7:42 , Bulat Ziganshin wrote:
> Wednesday, March 26, 2008, 2:32:53 PM, you wrote:
>>  I'm looking to parse a Fortran dialect using Parsec, and was
>
> afair, some months ago BASIC parsing was discussed here.
>
> the first solution one can imagine is to add preprocessing stage
> replacing line ends with ';'-alike

FWIW I just ignored the lexeme parser and did my own on top of the  
basic Parsec primitives.

You may need to do that anyway if you want to support older variants  
of Fortran, which don't actually have keywords and ignore spaces  
outside of string constants (Hollerith constants) --- Parsec's lexeme  
stuff doesn't even pretend to support this.

-- 
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED]
system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED]
electrical and computer engineering, carnegie mellon university    KF8NH


_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to