f# - Parser identifiers and free format text. Can this be done with FParsec? -
as follow-on to: how test 2 characters fparsec?
i need parse string consists of pairs of identifiers followed freeform text. can construct parser finds identifiers of form of newline followed 2 uppercase characters followed space. freeform text, associated preceding identifier, following identifier not including next identifier.
so example:
ab time men. cd 4 score , 7 years ago ef our.
contains 2 identifiers ab
, cd
, 2 pieces of freeform text
now \ntime men.
four score , 7 years ago ef our.
my problem don't know how construct parser match freeform text not match identifiers. case need backtracking?
can done , if how?
i think notfollowedby
you're looking for. should trick:
// adapted other question let identifier = skipnewline >>. manyminmaxsatisfy 2 2 charparsers.isupper let freeform = manychars (notfollowedby identifier >>. anychar)
Comments
Post a Comment