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
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
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
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
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
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
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
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
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