1

鉴于 boost 文档中的示例,我如何为同一个结构编写另一个规则?

例如,假设我希望解析器也接受如下规则:

start2 %=
        lit("employee2")
        >> '['
        >>  double_ >> ','
        >>  quoted_string >> ','
        >>  quoted_string >> ','
        >>  int_
        >>  ']'
        ;

这样输入将接受格式的数据

employee { int, "string", "string", double} 

或者

employee2 [ double, "string", "string", int")

在使用与示例中提供的相同结构时。这是否可能无需使用另一个“适配器”结构?如果是这样,怎么做?

4

0 回答 0