I\'m attempting to parse lisp-style comments from an s-expression language with FParsec. I got a bit of help with parsing single-line comments in this previous thread - How
Try changing the bool argument for closeMultilineCommentStr
to false
(charsTillString closeMultilineCommentStr false System.Int32.MaxValue)
Otherwise it will skip over the closeMultilineCommentStr
string.
To make it work with nested comments
let rec multilineComment o=
let ign x = charsTillString x false System.Int32.MaxValue
between
(pstring openMultilineCommentStr)
(pstring closeMultilineCommentStr)
(attempt (ign openMultilineCommentStr >>. multilineComment >>. ign closeMultilineCommentStr) <|>
ign closeMultilineCommentStr) <|o