Re: [Haskell-cafe] How to use notFollowedBy function in Parsec

2005-11-22 Thread Daniel Fischer
Am Montag, 21. November 2005 03:27 schrieb Sara Kenedy: May I suggest endBy anyToken semi ? -- optionally replace semi by char ';', if you don't want to skip whitespace I think this is what you want --- stop at the first semicolon. If you want to ignore just a final semicolon, you might use

Re: [Haskell-cafe] How to use notFollowedBy function in Parsec

2005-11-22 Thread Daniel Fischer
Am Dienstag, 22. November 2005 14:51 schrieben Sie: Am Montag, 21. November 2005 03:27 schrieb Sara Kenedy: May I suggest endBy anyToken semi ? -- optionally replace semi by char ';', if you Oops, I confused endBy and manyTill !! Also below. And since maybe there isn't any

Re: [Haskell-cafe] How to use notFollowedBy function in Parsec

2005-11-22 Thread Sara Kenedy
Hello, I run as follows: simple::Parser String simple = do manyTill anyToken (semi | eof) run:: Show a = Parser a - String - IO() run p input = case (parse p input) of Left err - do {putStr parse error at ;print err} Right x - print x

Re: [Haskell-cafe] How to use notFollowedBy function in Parsec

2005-11-22 Thread Daniel Fischer
Am Dienstag, 22. November 2005 15:58 schrieben Sie: Hello, I run as follows: simple::Parser String simple = do manyTill anyToken (semi | eof) run:: Show a = Parser a - String - IO() run p input = case (parse p input) of Left err - do {putStr parse error at ;print

Re: [Haskell-cafe] How to use notFollowedBy function in Parsec

2005-11-21 Thread Christian Maeder
Sara Kenedy wrote: import qualified ParsecToken as P the proper hierarchical module name is: Text.ParserCombinators.Parsec.Token str1 :: Parser String str1 = do {str - many anyToken; notFollowedBy semi; return str} simply try: str - many anyToken; notFollowedBy (char ';'); return str

Re: [Haskell-cafe] How to use notFollowedBy function in Parsec

2005-11-21 Thread Andrew Pimlott
On Sun, Nov 20, 2005 at 09:27:53PM -0500, Sara Kenedy wrote: Thanks for your solution. However, when I try this, str1 :: Parser String str1 = do str - many anyToken notFollowedBy' semi return str notFollowedBy' :: Show a = GenParser tok st a

Re: [Haskell-cafe] How to use notFollowedBy function in Parsec

2005-11-20 Thread Sara Kenedy
Thanks for your solution. However, when I try this, str1 :: Parser String str1 = do str - many anyToken notFollowedBy' semi return str notFollowedBy' :: Show a = GenParser tok st a - GenParser tok st () notFollowedBy' p = try $ join $ do a

[Haskell-cafe] How to use notFollowedBy function in Parsec

2005-11-19 Thread Sara Kenedy
Dear all, Using Parsec, I want to represent a string (of anyToken) not ended with symbol semi (;). I use the command notFollowedby as follows: module Parser where import Parsec import qualified ParsecToken as P import ParsecLanguage langDef::LanguageDef () langDef = emptyDef

Re: [Haskell-cafe] How to use notFollowedBy function in Parsec

2005-11-19 Thread Andrew Pimlott
On Sat, Nov 19, 2005 at 06:43:48PM -0500, Sara Kenedy wrote: str1 :: Parser String str1 = do {str - many anyToken; notFollowedBy semi; return str} However, when I compile, there is an error. ERROR Test.hs:17 - Type error in application *** Expression : notFollowedBy semi *** Term