Am 29.09.2010 05:35, schrieb Peter Schmitz: [...] > Error parsing file: "...\sampleTaggedContent.txt" (line 4, column 1): > unexpected end of input > expecting "<" > > The input was: [...] > >> -- Parsers: >> taggedContent = do >> optionalWhiteSpace >> aTag >> many tagOrContent >> aTag
"many tagOrContent" will consume all tags, so that no tag for the following "aTag" will be left. Cheers Christian >> eof >> return "Parse complete." >> >> tagOrContent = aTag <|> someContent <?> "tagOrContent" >> >> aTag = do >> tagBegin >> xs <- many (noneOf [tagEndChar]) >> tagEnd >> optionalWhiteSpace >> return () >> >> someContent = do >> manyTill anyChar tagBegin >> return () >> >> optionalWhiteSpace = spaces -- i.e., any of " \v\f\t\r\n" >> tagBegin = char tagBeginChar >> tagEnd = char tagEndChar >> >> -- Etc: >> tagBeginChar = '<' >> tagEndChar = '>' > > -------- _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe