I am sure many of you have looked at the scheme in haskell example that is on the web by Jonathan Tang. If you are familiar with the code, I need a little help trying to add scheme style comments:

"; This is my comment"

I added this code here and I think it works (I replaced the name parseSpaces with his "spaces" function). But, if I start a line with a comment, it errors out with unbound variable. Anybody have any ideas?

-- Added the ';'
symbol :: Parser Char
symbol = oneOf ";!$%&|*+-/:<=>[EMAIL PROTECTED]"

--
-- Handle whitespace and comments
parseSpaces :: Parser ()
parseSpaces = (try oneLineComment) <|> whiteSpace <|> return ()
   where
     whiteSpace = do skipMany1 space
                     parseSpaces
     oneLineComment = do { try (string ";")
                         ; skipMany (satisfy (/= '\n'))
                         ; parseSpaces
                         }

http://halogen.note.amherst.edu/~jdtang/scheme_in_48/tutorial/overview.html


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to