| 395 | } |
| 396 | |
| 397 | static 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 | |
| 421 | static std::shared_ptr<Pattern> maybe_collapse_to_required(PatternList&& seq) |
| 422 | { |
no test coverage detected