【发布时间】:2010-04-25 01:32:58
【问题描述】:
我正在使用Text.ParserCombinators.Parsec 和Text.XHtml 来解析这样的输入:
this is the beginning of the paragraph --this is an emphasized text-- and this is the end\n
我的输出应该是:
<p>this is the beginning of the paragraph <em>this is an emphasized text</em> and this is the end\n</p>
这段代码解析并返回一个强调的元素
em = do{
;count 2 (char '-') ;
;s <- manyTill anyChar (count 2 (char '-'))
;return (emphasize << s)
}
但我不知道如何获得强调项目的段落
有什么想法吗?
谢谢!!
【问题讨论】:
-
我理解正确吗?您想要包含字符流和强调项目的段落的 Parsec 术语?
标签: parsing haskell html-parsing parsec