【发布时间】:2011-09-29 06:35:22
【问题描述】:
我想使用 Flex & Bison 创建一个模板引擎解析器。问题是我只想解析 {{..}} 和 ${..} 中的表达式。
模板可以是任何带有嵌入标记的任意文本,代码如下:
</table:table-row>
{{$(/report/row.xml).embed()}}
{{$(//Accreditation/AccreditationDocument/Report).each(fragment(row) """
<table:row>
<table:table-cell office:value-type="string" office:string-value="${row["name"]}" />
</table:row>
""")}}
<table:table-row table:number-rows-repeated="1048574" table:style-name="ro1">
<table:table-cell table:number-columns-repeated="16384"/>
</table:table-row>
</table:table>
【问题讨论】:
标签: bison lex flex-lexer