How to use boost spirit list operator with mandatory minimum amount of elements?
问题 I would like to parse dot language (http://www.graphviz.org/content/dot-language). It's a graph definition language that defines nodes and connections between them. A typical statement looks like node1->node2->node3; . It would be nice to use a boost::spirit list operator % to make a list of nodes. A naive approach would be: edge_stmt %= ( node_or_subgraph(_r1) % (qi::eps(_r1) >> tok.diredgeop | tok.undiredgeop) ) >> -attr_list; _r1 indicates if this is directed or undirected graph, diredgeop