Review comment: .map() as late as possible.

This commit is contained in:
Nick Alexander 2017-04-03 13:11:41 -07:00
parent f7fb22ae7e
commit 678a116130

View file

@ -289,16 +289,16 @@ def_matches_plain_symbol!(Find, ellipsis, "...");
def_parser!(Find, find_scalar, FindSpec, {
Query::variable()
.map(|var| FindSpec::FindScalar(Element::Variable(var)))
.skip(Find::period())
.skip(eof())
.map(|var| FindSpec::FindScalar(Element::Variable(var)))
});
def_parser!(Find, find_coll, FindSpec, {
vector()
.of_exactly(Query::variable()
.map(|var| FindSpec::FindColl(Element::Variable(var)))
.skip(Find::ellipsis()))
.map(|var| FindSpec::FindColl(Element::Variable(var)))
});
def_parser!(Find, elements, Vec<Element>, {
@ -314,7 +314,7 @@ def_parser!(Find, find_tuple, FindSpec, {
.of_exactly(Find::elements().map(FindSpec::FindTuple))
});
/// Parse a stream values into one of four find specs.
/// Parse a stream of values into one of four find specs.
///
/// `:find` must be an array of plain var symbols (?foo), pull expressions, and aggregates. For now
/// we only support variables and the annotations necessary to declare which flavor of :find we