protected static function parseArgs(TokenIterator $tokens, \ArrayIterator $options, $optionsFirst = false) {
        $parsed = [];

        while ($tokens->current() !== null) {
            if ($tokens->current() == '--') {
                while ($tokens->current() !== null) {
                    $parsed[] = new Argument(null, $tokens->move());
                }
                return $parsed;
            }
            elseif (strStartsWith($tokens->current(), '--')) {
                $parsed = array_merge($parsed, static::parseLong($tokens, $options));
            }
            elseif (strStartsWith($tokens->current(), '-') && $tokens->current()!='-') {
                $parsed = array_merge($parsed, static::parseShort($tokens, $options));
            }
            elseif ($optionsFirst) {
                return array_merge($parsed, array_map(function($value) {
                    return new Argument(null, $value);
                }, $tokens->left()));
            }
            else {
                $parsed[] = new Argument(null, $tokens->move());
            }
        }
        return $parsed;
    }