def generate_terms(self, ref, root, file_type=None):
last_section = root<EOL>t = None<EOL>if isinstance(ref, Source):<EOL><INDENT>row_gen = ref<EOL>ref_path = row_gen.__class__.__name__<EOL><DEDENT>else:<EOL><INDENT>row_gen = get_generator(ref)<EOL>ref_path = ref.path<EOL><DEDENT>try:<EOL><INDENT>for line_n, row in enumerate(row_gen, <NUM_LIT:1>):<EOL><INDENT>if not row or not row[<NUM_LIT:0>] or not row[<NUM_LIT:0>].strip() or row[<NUM_LIT:0>].strip().startswith('<STR_LIT:#>'):<EOL><INDENT>continue<EOL><DEDENT>tt = Term(row[<NUM_LIT:0>], None) <EOL>term_class = self.get_term_class(tt.join_lc)<EOL>t = term_class(tt.join_lc,<EOL>row[<NUM_LIT:1>] if len(row) > <NUM_LIT:1> else '<STR_LIT>',<EOL>row[<NUM_LIT:2>:] if len(row) > <NUM_LIT:2> else [],<EOL>row=line_n,<EOL>col=<NUM_LIT:1>,<EOL>file_name=ref_path, file_type=file_type, doc=self.doc)<EOL>if t.term_is('<STR_LIT>') or t.term_is('<STR_LIT>'):<EOL><INDENT>if t.term_is('<STR_LIT>'):<EOL><INDENT>resolved = self.find_include_doc(dirname(ref_path), t.value.strip())<EOL><DEDENT>else:<EOL><INDENT>resolved = self.find_declare_doc(dirname(ref_path), t.value.strip())<EOL><DEDENT>if row_gen.ref == resolved:<EOL><INDENT>raise IncludeError("<STR_LIT>".format(resolved))<EOL><DEDENT>yield t<EOL>try:<EOL><INDENT>sub_gen = get_generator(resolved.get_resource().get_target())<EOL>for t in self.generate_terms(sub_gen, root, file_type=t.record_term_lc):<EOL><INDENT>yield t<EOL><DEDENT>if last_section:<EOL><INDENT>yield last_section  <EOL><DEDENT><DEDENT>except IncludeError as e:<EOL><INDENT>e.term = t<EOL>raise<EOL><DEDENT>except (OSError,  FileNotFoundError, GenerateError, DownloadError) as e:<EOL><INDENT>e = IncludeError("<STR_LIT>".format(e))<EOL>e.term = t<EOL>raise e<EOL><DEDENT>continue  <EOL><DEDENT>elif t.term_is('<STR_LIT>'):<EOL><INDENT>try:<EOL><INDENT>last_section = self.doc[t.name]<EOL>t = last_section<EOL><DEDENT>except (KeyError, TypeError): <EOL><INDENT>last_section = t<EOL><DEDENT><DEDENT>yield t<EOL>if not t.term_is('<STR_LIT>') and not t.term_is('<STR_LIT>'):<EOL><INDENT>for col, value in enumerate(t.args, <NUM_LIT:0>):<EOL><INDENT>if str(value).strip():<EOL><INDENT>term_name = t.record_term_lc + '<STR_LIT:.>' + str(col)<EOL>term_class = self.get_term_class(term_name)<EOL>yield term_class(term_name, str(value), [],<EOL>row=line_n,<EOL>col=col + <NUM_LIT:2>,  <EOL>file_name=ref_path,<EOL>file_type=file_type,<EOL>parent=t) <EOL><DEDENT><DEDENT><DEDENT><DEDENT><DEDENT>except IncludeError as e:<EOL><INDENT>exc = IncludeError(str(e) + "<STR_LIT>".format(ref_path))<EOL>exc.term = e.term if hasattr(e, '<STR_LIT>') else None<EOL>raise exc<EOL><DEDENT>
An generator that yields term objects, handling includes and argument
        children.
        :param file_type:
        :param doc:
        :param root:
        :param ref: