Parsing Selector struct with alternating tokens using Boost Spirit X3
问题 I am trying to parse the following struct: struct Selector { std::string element; std::string id; std::vector<std::string> classes; }; This struct is used to parse selectors in the form element#id.class1.class2.classn . These selectors always start with 1 or no elements, could contain 1 or no ids, and could contain 0 to n classes. This gets even more complicated though, because classes and id can appear in any order, so the following selectors are all valid: element#id.class1 , .class1#id