def parseKeyValuePair(self, parent):
        """
        Parse a key-value pair, and add it to the provided L{Mapping}.

        @param parent: The mapping to add entries to.
        @type parent: A L{Mapping} instance.
        @raise ConfigFormatError: if a syntax error is found.
        """
        comment = self.comment
        tt, tv = self.token
        if tt == WORD:
            key = tv
            suffix = tv
        elif tt == STRING:
            key = eval(tv)
            suffix = '[%s]' % tv
        else:
            msg = "%s: expecting word or string, found %r"
            raise ConfigFormatError(msg % (self.location(), tv))
        self.token = self.getToken()
        # for now, we allow key on its own as a short form of key : True
        if self.token[0] == COLON:
            self.token = self.getToken()
            value = self.parseValue(parent, suffix)
        else:
            value = True
        try:
            parent.addMapping(key, value, comment)
        except Exception, e:
            raise ConfigFormatError("%s: %s, %r" % (self.location(), e,
                                    self.token[1]))
        tt = self.token[0]
        if tt not in [EOF, WORD, STRING, RCURLY, COMMA]:
            msg = "%s: expecting one of EOF, WORD, STRING,\
RCURLY, COMMA, found %r"
            raise ConfigFormatError(msg  % (self.location(), self.token[1]))
        if tt == COMMA:
            self.token = self.getToken()
dataset/ETHPy150Open twitterdev/twitter-for-bigquery/libs/config.py/ConfigReader.parseKeyValuePair/original