@@ -161,7 +161,7 @@ std::vector<InputSpec> DataDescriptorQueryBuilder::parse(char const* config)
161161 lifetime = Lifetime::Sporadic;
162162 }
163163 }
164- return InputSpec{binding, std::move (*lastMatcher. release () ), lifetime, attributes};
164+ return InputSpec{binding, std::move (*lastMatcher), lifetime, attributes};
165165 };
166166
167167 auto pushMatcher = [&nodes, &states](auto && matcher) {
@@ -201,6 +201,12 @@ std::vector<InputSpec> DataDescriptorQueryBuilder::parse(char const* config)
201201 case IN_BEGIN_MATCHER : {
202202 nodes.clear ();
203203 attributes.clear ();
204+ // Reset per-query state, so a ;-separated query cannot inherit it.
205+ currentBinding.reset ();
206+ currentOrigin.reset ();
207+ currentDescription.reset ();
208+ currentSubSpec.reset ();
209+ currentTimeModulo.reset ();
204210 pushState (IN_BEGIN_BINDING );
205211 } break ;
206212 case IN_BEGIN_BINDING : {
@@ -210,7 +216,7 @@ std::vector<InputSpec> DataDescriptorQueryBuilder::parse(char const* config)
210216 case IN_END_BINDING : {
211217 // We are at the end of the string already.
212218 // This is really an origin...
213- if (strchr (" \0 /;" , *next)) {
219+ if (memchr (" \0 /;" , *next, 3 )) {
214220 pushState (IN_END_ORIGIN );
215221 continue ;
216222 }
@@ -286,7 +292,8 @@ std::vector<InputSpec> DataDescriptorQueryBuilder::parse(char const* config)
286292 error (" Remove trailing ;" );
287293 continue ;
288294 }
289- result.push_back (buildMatchingTree (*currentBinding, attributes));
295+ // A query without a binding, e.g. "TST/A1", is named after its origin.
296+ result.push_back (buildMatchingTree (currentBinding.value_or (currentOrigin.value_or (" " )), attributes));
290297 if (*cur == ' \0 ' ) {
291298 pushState (IN_END_QUERY );
292299 } else if (*cur == ' ;' ) {
0 commit comments