Skip to content
This repository has been archived by the owner on Sep 14, 2023. It is now read-only.

Remove seemingly unnecessary Repeat patterns #201

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -482,10 +482,7 @@ impl<'a> PatParser<'a> {
let stacked: String = self.cur()[1..].into();
for (i, c) in stacked.chars().enumerate() {
let atom = self.dopt.descs.resolve(&Short(c));
let mut pat = PatAtom(atom.clone());
if self.dopt.has_repeat(&atom) {
pat = Pattern::repeat(pat);
}
let pat = PatAtom(atom.clone());
seq.push(pat);

// The only way for a short option to have an argument is if
Expand Down Expand Up @@ -544,11 +541,7 @@ impl<'a> PatParser<'a> {
}
self.add_atom_ifnotexists(arg, &atom);
self.next();
let pat = if self.dopt.has_repeat(&atom) {
Pattern::repeat(PatAtom(atom))
} else {
PatAtom(atom)
};
let pat = PatAtom(atom);
Ok(self.maybe_repeat(pat))
}

Expand Down