def _parse_literal(self) -> ASTLiteral:
    self.skip_ws()
    if self.skip_word('nullptr'):
        return ASTPointerLiteral()
    if self.skip_word('true'):
        return ASTBooleanLiteral(True)
    if self.skip_word('false'):
        return ASTBooleanLiteral(False)
    for regex in [float_literal_re, binary_literal_re, hex_literal_re, integer_literal_re, octal_literal_re]:
        pos = self.pos
        if self.match(regex):
            while (self.current_char in 'uUlLfF'):
                self.pos += 1
            return ASTNumberLiteral(self.definition[pos:self.pos])
    string = self._parse_string()
    if (string is not None):
        return ASTStringLiteral(string)
    if self.match(char_literal_re):
        prefix = self.last_match.group(1)
        data = self.last_match.group(2)
        try:
            return ASTCharLiteral(prefix, data)
        except UnicodeDecodeError as e:
            self.fail(('Can not handle character literal. Internal error was: %s' % e))
        except UnsupportedMultiCharacterCharLiteral:
            self.fail('Can not handle character literal resulting in multiple decoded characters.')
    return None
def _parse_literal(self) -> ASTLiteral:
    self.skip_ws()
    if self.skip_word('nullptr'):
        return ASTPointerLiteral()
    if self.skip_word('true'):
        return ASTBooleanLiteral(True)
    if self.skip_word('false'):
        return ASTBooleanLiteral(False)
    for regex in [float_literal_re, binary_literal_re, hex_literal_re, integer_literal_re, octal_literal_re]:
        pos = self.pos
        if self.match(regex):
            while (self.current_char in 'uUlLfF'):
                self.pos += 1
            return ASTNumberLiteral(self.definition[pos:self.pos])
    string = self._parse_string()
    if (string is not None):
        return ASTStringLiteral(string)
    if self.match(char_literal_re):
        prefix = self.last_match.group(1)
        data = self.last_match.group(2)
        try:
            return ASTCharLiteral(prefix, data)
        except UnicodeDecodeError as e:
            self.fail(('Can not handle character literal. Internal error was: %s' % e))
        except UnsupportedMultiCharacterCharLiteral:
            self.fail('Can not handle character literal resulting in multiple decoded characters.')
    return None