MCPcopy Create free account
hub / github.com/docopt/docopt.cpp / parse_seq

Function parse_seq

docopt.cpp:397–419  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

395}
396
397static PatternList parse_seq(Tokens& tokens, std::vector<Option>& options)
398{
399 // seq ::= ( atom [ '...' ] )* ;"""
400
401 PatternList ret;
402
403 while (tokens) {
404 auto const& token = tokens.current();
405
406 if (token=="]" || token==")" || token=="|")
407 break;
408
409 auto atom = parse_atom(tokens, options);
410 if (tokens.current() == "...") {
411 ret.emplace_back(std::make_shared<OneOrMore>(std::move(atom)));
412 tokens.pop();
413 } else {
414 std::move(atom.begin(), atom.end(), std::back_inserter(ret));
415 }
416 }
417
418 return ret;
419}
420
421static std::shared_ptr<Pattern> maybe_collapse_to_required(PatternList&& seq)
422{

Callers 1

parse_exprFunction · 0.85

Calls 2

parse_atomFunction · 0.85
popMethod · 0.80

Tested by

no test coverage detected