ブーストスピリットx3を使用して、文字列を構造体に解析しようとしています:
struct identifier {
std::vector<std::string> namespaces;
std::vector<std::string> classes;
std::string identifier;
};
これで、次のような文字列に一致するパーサー ルールができました。
foo::bar::baz.bla.blub
foo.bar
boo::bar
foo
私のパーサールールは次のようになります。
auto const nested_identifier_def =
x3::lexeme[
-(id_string % "::")
>> -(id_string % ".")
>> id_string
];
whereid_string
の組み合わせを解析しalphanum
ます。foo.bar
たとえば、解析中にルールのこの部分が-(id_string % ".")
文字列全体を消費するため、このルールが意図したとおりに解析できないことはわかっています。構造体で正しく解析するようにルールを変更するにはどうすればよいですか?