def generateReport (self) :
      
        report = ""

        # Post processing: Create an array of the lines of input.  The
        # last line probably won't end with an newline because the error
        # probably happened in the middle of the line.
        lines = []
        current_line = ""
        for ii in xrange(0, len(self.data_)) :
            c = self.data_.peek(ii)
            current_line = current_line + c
            if (c=='\n') :
                lines.append(current_line)
                current_line = ""
                
        if (current_line != "") :
            current_line = current_line + '\n'
            lines.append(current_line)


        # Only take the last few lines for error reporting
        context_lines = self.contextLines_
        if (len(lines) < self.contextLines_) : context_lines = len(lines)

        if (context_lines) :
            start_line = len(lines)-context_lines

            report = "****Syntax Error on line:"+str(self.lineNumber_)+\
                     " Last "+str(context_lines)+ " line"
            if (context_lines!=1) :
                report = report + "s"
            report = report + " of input (lines "+ \
                     str(start_line+1)+"-"+str(start_line+context_lines)+") "\
                     "shown below****\n"

            for ii in xrange(0, context_lines) :
                report = report + "  " + lines[start_line+ii]
      
            # Show, on last line, where!
            cursor = "-"*(self.charNumber_+1) + "^\n"
            report = report + cursor

        # All done
        return report
dataset/ETHPy150Open redhat-imaging/imagefactory/imgfac/picklingtools/parsereader.py/Context_.generateReport/original