def _parse_template_argument_list(self) -> ASTTemplateArgs:
    self.skip_ws()
    if (not self.skip_string_and_ws('<')):
        return None
    if self.skip_string('>'):
        return ASTTemplateArgs([], False)
    prevErrors = []
    templateArgs = []
    packExpansion = False
    while 1:
        pos = self.pos
        parsedComma = False
        parsedEnd = False
        try:
            type = self._parse_type(named=False)
            self.skip_ws()
            if self.skip_string_and_ws('...'):
                packExpansion = True
                parsedEnd = True
                if (not self.skip_string('>')):
                    self.fail('Expected ">" after "..." in template argument list.')
            elif self.skip_string('>'):
                parsedEnd = True
            elif self.skip_string(','):
                parsedComma = True
            else:
                self.fail('Expected "...>", ">" or "," in template argument list.')
            templateArgs.append(type)
        except DefinitionError as e:
            prevErrors.append((e, 'If type argument'))
            self.pos = pos
            try:
                value = self._parse_constant_expression(inTemplate=True)
                self.skip_ws()
                if self.skip_string_and_ws('...'):
                    packExpansion = True
                    parsedEnd = True
                    if (not self.skip_string('>')):
                        self.fail('Expected ">" after "..." in template argument list.')
                elif self.skip_string('>'):
                    parsedEnd = True
                elif self.skip_string(','):
                    parsedComma = True
                else:
                    self.fail('Expected "...>", ">" or "," in template argument list.')
                templateArgs.append(ASTTemplateArgConstant(value))
            except DefinitionError as e:
                self.pos = pos
                prevErrors.append((e, 'If non-type argument'))
                header = 'Error in parsing template argument list.'
                raise self._make_multi_error(prevErrors, header)
        if parsedEnd:
            assert (not parsedComma)
            break
        else:
            assert (not packExpansion)
    return ASTTemplateArgs(templateArgs, packExpansion)
def _parse_template_argument_list(self) -> ASTTemplateArgs:
    self.skip_ws()
    if (not self.skip_string_and_ws('<')):
        return None
    if self.skip_string('>'):
        return ASTTemplateArgs([], False)
    prevErrors = []
    templateArgs = []
    packExpansion = False
    while 1:
        pos = self.pos
        parsedComma = False
        parsedEnd = False
        try:
            type = self._parse_type(named=False)
            self.skip_ws()
            if self.skip_string_and_ws('...'):
                packExpansion = True
                parsedEnd = True
                if (not self.skip_string('>')):
                    self.fail('Expected ">" after "..." in template argument list.')
            elif self.skip_string('>'):
                parsedEnd = True
            elif self.skip_string(','):
                parsedComma = True
            else:
                self.fail('Expected "...>", ">" or "," in template argument list.')
            templateArgs.append(type)
        except DefinitionError as e:
            prevErrors.append((e, 'If type argument'))
            self.pos = pos
            try:
                value = self._parse_constant_expression(inTemplate=True)
                self.skip_ws()
                if self.skip_string_and_ws('...'):
                    packExpansion = True
                    parsedEnd = True
                    if (not self.skip_string('>')):
                        self.fail('Expected ">" after "..." in template argument list.')
                elif self.skip_string('>'):
                    parsedEnd = True
                elif self.skip_string(','):
                    parsedComma = True
                else:
                    self.fail('Expected "...>", ">" or "," in template argument list.')
                templateArgs.append(ASTTemplateArgConstant(value))
            except DefinitionError as e:
                self.pos = pos
                prevErrors.append((e, 'If non-type argument'))
                header = 'Error in parsing template argument list.'
                raise self._make_multi_error(prevErrors, header)
        if parsedEnd:
            assert (not parsedComma)
            break
        else:
            assert (not packExpansion)
    return ASTTemplateArgs(templateArgs, packExpansion)