'Function to extract all the strings from a file'

def parseAll(self, strings, entry):

    if isinstance(entry, list):
        id = entry[0]
        value = entry[1]
        if isinstance(value, list):
            parseAll = self.parseAll
            for element in entry:
                parseAll(strings, element)
        elif ((token.tok_name[id] == 'NAME') and (value == 'T')):
            self.sflag = 1
        elif (self.sflag == 1):
            if (token.tok_name[id] == 'LPAR'):
                self.tflag = 1
                self.bracket = 1
            self.sflag = 0
        elif (self.tflag == 1):
            if (token.tok_name[id] == 'LPAR'):
                self.bracket += 1
                if (self.bracket > 1):
                    self.outstr += '('
            elif (token.tok_name[id] == 'RPAR'):
                self.bracket -= 1
                if (self.bracket > 0):
                    self.outstr += ')'
                else:
                    strings.append((entry[2], self.outstr))
                    self.outstr = ''
                    self.tflag = 0
            elif (self.bracket > 0):
                self.outstr += value
        elif ((token.tok_name[id] == 'NAME') and (value == 'M')):
            self.mflag = 1
        elif (self.mflag == 1):
            if (token.tok_name[id] == 'STRING'):
                strings.append((entry[2], value))
            elif ((token.tok_name[id] == 'EQUAL') or (token.tok_name[id] == 'RPAR')):
                self.mflag = 0
