}
}
extras(help, version, $argv, doc);
final MatchResult m = pattern.fix().match($argv);
if (m.matched() && m.getLeft().isEmpty()) {
// @formatter:off
// >>> return Dict((a.name, a.value) for a in (pattern.flat() + collected))
// @formatter:on
final Map<String, Object> u = new HashMap<String, Object>();
for (final Pattern p : pattern.flat()) {
// TODO: Does flat always return LeafPattern objects?
if (!(p instanceof LeafPattern)) {
throw new IllegalStateException();
}
final LeafPattern lp = (LeafPattern) p;
u.put(lp.getName(), lp.getValue());
}
for (final LeafPattern p : m.getCollected()) {
u.put(p.getName(), p.getValue());
}
return u;
}