diff --git a/spargebra/src/parser.rs b/spargebra/src/parser.rs index c98a9826..80e268cc 100644 --- a/spargebra/src/parser.rs +++ b/spargebra/src/parser.rs @@ -1331,16 +1331,10 @@ parser! { } //[52] - rule TriplesTemplate() -> Vec = h:TriplesSameSubject() _ t:TriplesTemplate_tail()? { - let mut triples = h; - if let Some(l) = t { - triples.extend(l) - } - triples - } - rule TriplesTemplate_tail() -> Vec = "." _ t:TriplesTemplate()? _ { - t.unwrap_or_default() + rule TriplesTemplate() -> Vec = ts:TriplesTemplate_inner() ++ (".") ("." _)? { + ts.into_iter().flatten().collect() } + rule TriplesTemplate_inner() -> Vec = _ t:TriplesSameSubject() _ { t } //[53] rule GroupGraphPattern() -> GraphPattern = @@ -1400,16 +1394,10 @@ parser! { } //[55] - rule TriplesBlock() -> Vec = h:TriplesSameSubjectPath() _ t:TriplesBlock_tail()? { - let mut triples = h; - if let Some(l) = t { - triples.extend(l) - } - triples - } - rule TriplesBlock_tail() -> Vec = "." _ t:TriplesBlock()? _ { - t.unwrap_or_default() + rule TriplesBlock() -> Vec = hs:TriplesBlock_inner() ++ (".") ("." _)? { + hs.into_iter().flatten().collect() } + rule TriplesBlock_inner() -> Vec = _ h:TriplesSameSubjectPath() _ { h } //[56] rule GraphPatternNotTriples() -> PartialGraphPattern = GroupOrUnionGraphPattern() / OptionalGraphPattern() / MinusGraphPattern() / GraphGraphPattern() / ServiceGraphPattern() / Filter() / Bind() / InlineData()