def find_content(self, text, index=0, backtick=False):
        """Find content."""

        curly_count = 0
        last = '\n'
        self.lines_num = 1
        length = len(text)
        while index < length:
            start_index = index
            c = text[index]
            if c == '{' and backtick:
                curly_count += 1
            elif c == '}' and backtick:
                if curly_count:
                    curly_count -= 1
                else:
                    index += 1
                    return index
            elif c == '`':
                done = False
                first = True
                backtick_content = []
                start_index = index
                while not done:
                    m = (RE_TEMPLATE_START if first else RE_TEMPLATE_MIDDLE_END).match(text, index)
                    first = False
                    if m:
                        self.line_num += m.group(0).count('\n')
                        content = self.evaluate_strings(m.group(1), True)
                        if content:
                            backtick_content.append(content)
                        index = m.end(0)
                        if m.group(2) == '${':
                            index = self.find_content(text, index, True)
                        else:
                            done = True
                    else:
                        done = True
                if backtick_content:
                    self.quoted_strings.append([' '.join(backtick_content), self.line_num, 'utf-8'])
            elif c in ('\'', '"'):
                m = RE_STRING.match(text, index)
                if m:
                    self.evaluate_strings(m.group(0)[1:-1])
                    self.line_num += m.group(0).count('\n')
                    index = m.end(0)
            elif c == '\n':
                self.line_num += 1
            elif last == '\n' or c == '/':
                m = RE_COMMENT.match(text, index)
                if m:
                    g = m.groupdict()
                    if g['start'] is None:
                        self.evaluate_inline_tail(g)
                    else:
                        self.evaluate_inline(g)
                    index = m.end(0)
                elif c == '/':
                    m = RE_BLOCK_COMMENT.match(text, index)
                    if m:
                        self.evaluate_block(m.group(0))
                        self.line_num += m.group(0).count('\n')
                        index = m.end(0)

            if index == start_index:
                index += 1
            last = text[index - 1]
def find_content ( self , text , index = 0 , backtick = False ) : curly_count = 0 last = '\n' self . lines_num = 1 length = len ( text ) while index < length : start_index = index c = text [ index ] if c == '{' and backtick : curly_count += 1 elif c == '}' and backtick : if curly_count : curly_count -= 1 else : index += 1 return index elif c == '`' : done = False first = True backtick_content = [ ] start_index = index while not done : m = ( RE_TEMPLATE_START if first else RE_TEMPLATE_MIDDLE_END ) . match ( text , index ) first = False if m : self . line_num += m . group ( 0 ) . count ( '\n' ) content = self . evaluate_strings ( m . group ( 1 ) , True ) if content : backtick_content . append ( content ) index = m . end ( 0 ) if m . group ( 2 ) == '${' : index = self . find_content ( text , index , True ) else : done = True else : done = True if backtick_content : self . quoted_strings . append ( [ ' ' . join ( backtick_content ) , self . line_num , 'utf-8' ] ) elif c in ( '\'' , '"' ) : m = RE_STRING . match ( text , index ) if m : self . evaluate_strings ( m . group ( 0 ) [ 1 : - 1 ] ) self . line_num += m . group ( 0 ) . count ( '\n' ) index = m . end ( 0 ) elif c == '\n' : self . line_num += 1 elif last == '\n' or c == '/' : m = RE_COMMENT . match ( text , index ) if m : g = m . groupdict ( ) if g [ 'start' ] is None : self . evaluate_inline_tail ( g ) else : self . evaluate_inline ( g ) index = m . end ( 0 ) elif c == '/' : m = RE_BLOCK_COMMENT . match ( text , index ) if m : self . evaluate_block ( m . group ( 0 ) ) self . line_num += m . group ( 0 ) . count ( '\n' ) index = m . end ( 0 ) if index == start_index : index += 1 last = text [ index - 1 ]
Find content.