
16 Dec
2012
16 Dec
'12
11:55 a.m.
Hey, I want to parse a string like this: <cell>,<cell>,<lastCell> All cells but the last cell are parsed with "cell", the last one is parsed with "lastCell". So I am trying: file = do res <- endBy cell (char ',') l <- lastCell eof return res cell = many1 (noneOf ",") lastCell = many1 (noneOf "\n") This results in unexpected end of input expecting "," I am assuming this is because the lastCell is comsumed by a "cell" parser. lastCell and cell look pretty similar, so the cell parser can does not fail when presented the <lastCell>. Can I still do this with "endBy" or is there a better combinator? Thanks! Nathan