@classmethod
    def _parse_argument(cls, token):
        """
        Parse an argument expression.

        :param token: The argument expression
        :type token: str

        :rtype: InputArgument
        """
        description = None
        validator = None

        if ' : ' in token:
            token, description = tuple(token.split(' : ', 2))

            token = token.strip()

            description = description.strip()

        # Checking validator:
        matches = re.match('(.*)\((.*?)\)', token)
        if matches:
            token = matches.group(1).strip()
            validator = matches.group(2).strip()

        if token.endswith('?*'):
            return InputArgument(
                token.rstrip('?*'),
                InputArgument.IS_LIST,
                description
            )
        elif token.endswith('*'):
            return InputArgument(
                token.rstrip('*'),
                InputArgument.IS_LIST | InputArgument.REQUIRED,
                description
            )
        elif token.endswith('?'):
            return InputArgument(
                token.rstrip('?'),
                InputArgument.OPTIONAL,
                description
            )

        matches = re.match('(.+)\=(.+)', token)
        if matches:
            return InputArgument(
                matches.group(1),
                InputArgument.OPTIONAL,
                description,
                matches.group(2)
            )

        return InputArgument(token, InputArgument.REQUIRED, description,
                             validator=validator)
dataset/ETHPy150Open sdispater/cleo/cleo/parser.py/Parser._parse_argument/original