【发布时间】:2020-09-05 08:09:27
【问题描述】:
我正在查看 attoparsec 文档中的 this example:
simpleComment = string "<!--" *> manyTill anyChar (string "-->")
这将构建一个 [Char] 而不是 ByteString 切片。这对巨大的 cmets 不好,对吧?
另一种选择,takeWhile:
takeWhile :: (Word8 -> Bool) -> Parser ByteString
不能接受解析器(即不能匹配ByteString,只能匹配Word8)。
有没有办法用 attoparsec 解析 ByteString 的块,而不涉及在此过程中构建 [Char]?
【问题讨论】:
标签: haskell attoparsec