def parseFields(self, tokens, index):
        indexSave = index #save it since welookahead to see if "in"
        fields = []
        found = False #flag to indicate found 'in' wich indicates fields clause

        while index < len(tokens):
            field = tokens[index]
            if field == 'in': #field list present and completed
                index +=1
                found = True
                break

            if field in Reserved: #field list not present
                break

            index += 1 #eat token
            fields.append(field)

        if not found: #no fields clause
            index = indexSave #so restore index
            fields = [] #empty fields list

        #prevent using multiple fields if one of them is 'value'
        if (len(fields) > 1) and ('value' in fields):
            msg = "ParseError: Field = 'value' with multiple fields = '%s'" % (fields)
            raise excepting.ParseError(msg, tokens, index)

        for i, field in enumerate(fields):
            if REO_Quoted.match(field): # field is double quoted string
                field = field.strip('"')  #strip off quotes
                fields.insert(i, field )
            elif REO_QuotedSingle.match(field): #field is single quoted string
                field = field.strip("'")  #strip off quotes
                fields.insert(i, field )

            if not REO_IdentPub.match(field):
                msg = "ParseError: Invalid format of field '%s'" % (field)
                raise excepting.ParseError(msg, tokens, index)

        return (fields, index)
Should return the couch query result containing the items to be
dataset/ETHPy150Open ioflo/ioflo/ioflo/base/building.py/Builder.parseFields--crossover with--dataset/ETHPy150Open dimagi/commcare-hq/hqscripts/generic_queue.py/GenericEnqueuingOperation.get_items_to_be_processed