2
我想使用Flex & Bison創建模板引擎的解析器。問題是我只想解析{{..}}和$ {..}中的表達式。如何使用Flex僅在上下文中掃描令牌?
模板可以用代碼嵌入令牌這樣的任意文本:我已經找到了解決自己
</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>