Write end-of-file comments

 @return [undefined]

 @api private
188038
def emit_eof_comments
      emit_eol_comments
      comments_left = comments.take_all
      return if comments_left.empty?

      buffer.nl
      emit_comments(comments_left)
    end
413538
private void commentLinesAfter( String content, int line )
  {
    int offset = _root.getElement( line ).getEndOffset();
    // End of comment not found, nothing to do
    int endDelimiter = indexOf( content, getEndDelimiter(), offset );
    if( endDelimiter < 0 )
    {
      return;
    }
    // Matching start/end of comment found, comment the lines
    int startDelimiter = lastIndexOf( content, getStartDelimiter(), endDelimiter );
    if( startDelimiter < 0 || startDelimiter <= offset )
    {
      setCharacterAttributes( offset, endDelimiter - offset + 1, _comment, false );
    }
  }
1072214
def write_file(filename = 'foo', string = nil)
      raise ExportError, 'Nothing to export for #{filename}.' if string.nil? || string == ""
      f = File.new( File.expand_path(File.join(export_path, filename)), 'w+')
      f.puts string
      f.close
    end
228516
def scan

      # remove private comment
      remaining_code = remove_private_comments(@body)

      # continuation lines are united to one line
      remaining_code = united_to_one_line(remaining_code)

      # semicolons are replaced to line feed
      remaining_code = semicolon_to_linefeed(remaining_code)

      # collect comment for file entity
      whole_comment, remaining_code = collect_first_comment(remaining_code)
      @top_level.comment = whole_comment

      # String "remaining_code" is converted to Array "remaining_lines"
      remaining_lines = remaining_code.split("\n")

      # "module" or "program" parts are parsed (new)
      #
      level_depth = 0
      block_searching_flag = nil
      block_searching_lines = []
      pre_comment = []
      module_program_trailing = ""
      module_program_name = ""
      other_block_level_depth = 0
      other_block_searching_flag = nil
      remaining_lines.collect!{|line|
        if !block_searching_flag && !other_block_searching_flag
          if line =~ /^\s*?module\s+(\w+)\s*?(!.*?)?$/i
            block_searching_flag = :module
            block_searching_lines << line
            module_program_name = $1
            module_program_trailing = find_comments($2)
            next false
          elsif line =~ /^\s*?program\s+(\w+)\s*?(!.*?)?$/i ||
                 line =~ /^\s*?\w/ && !block_start?(line)
            block_searching_flag = :program
            block_searching_lines << line
            module_program_name = $1 || ""
            module_program_trailing = find_comments($2)
            next false

          elsif block_start?(line)
            other_block_searching_flag = true
            next line

          elsif line =~ /^\s*?!\s?(.*)/
            pre_comment << line
            next line
          else
            pre_comment = []
            next line
          end
        elsif other_block_searching_flag
          other_block_level_depth += 1 if block_start?(line)
          other_block_level_depth -= 1 if block_end?(line)
          if other_block_level_depth < 0
            other_block_level_depth = 0
            other_block_searching_flag = nil
          end
          next line
        end

        block_searching_lines << line
        level_depth += 1 if block_start?(line)
        level_depth -= 1 if block_end?(line)
        if level_depth >= 0
          next false
        end

        # "module_program_code" is formatted.
        # ":nodoc:" flag is checked.
        #
        module_program_code = block_searching_lines.join("\n")
        module_program_code = remove_empty_head_lines(module_program_code)
        if module_program_trailing =~ /^:nodoc:/
          # next loop to search next block
          level_depth = 0
          block_searching_flag = false
          block_searching_lines = []
          pre_comment = []
          next false
        end

        # NormalClass is created, and added to @top_level
        #
        if block_searching_flag == :module
          module_name = module_program_name
          module_code = module_program_code
          module_trailing = module_program_trailing
          progress "m"
          @stats.num_modules += 1
          f9x_module = @top_level.add_module NormalClass, module_name
          f9x_module.record_location @top_level

          f9x_comment = COMMENTS_ARE_UPPER ? 
            find_comments(pre_comment.join("\n"))  + "\n" + module_trailing :
              module_trailing + "\n" + find_comments(module_code.sub(/^.*$\n/i, ''))
          f9x_module.comment = f9x_comment
          parse_program_or_module(f9x_module, module_code)

          TopLevel.all_files.each do |name, toplevel|
            if toplevel.include_includes?(module_name, @options.ignore_case)
              if !toplevel.include_requires?(@file_name, @options.ignore_case)
                toplevel.add_require(Require.new(@file_name, ""))
              end
            end
            toplevel.each_classmodule{|m|
              if m.include_includes?(module_name, @options.ignore_case)
                if !m.include_requires?(@file_name, @options.ignore_case)
                  m.add_require(Require.new(@file_name, ""))
                end
              end
            }
          end
        elsif block_searching_flag == :program
          program_name = module_program_name
          program_code = module_program_code
          program_trailing = module_program_trailing
          progress "p"
          program_comment = COMMENTS_ARE_UPPER ? 
            find_comments(pre_comment.join("\n")) + "\n" + program_trailing : 
              program_trailing + "\n" + find_comments(program_code.sub(/^.*$\n/i, ''))
          program_comment = "\n\n= <i>Program</i> <tt>#{program_name}</tt>\n\n" \
                            + program_comment
          @top_level.comment << program_comment
          parse_program_or_module(@top_level, program_code, :private)
        end

        # next loop to search next block
        level_depth = 0
        block_searching_flag = false
        block_searching_lines = []
        pre_comment = []
        next false
      }

      remaining_lines.delete_if{ |line|
        line == false
      }

      # External subprograms and functions are parsed
      #
      parse_program_or_module(@top_level, remaining_lines.join("\n"),
                              :public, true)

      @top_level
    end
257740
def transform_comments(separator, &block)
      if @comments.empty?
        nil
      else
        block ||= lambda { |c| c }
        @comments.map(&block).join(separator)
      end
    end
774041
function getLastCommentLineOfBlock(commentStartLine) {
            const currentCommentEnd = commentEndLine[commentStartLine];

            return commentEndLine[currentCommentEnd + 1] ? getLastCommentLineOfBlock(currentCommentEnd + 1) : currentCommentEnd;
        }
924244
function(){
	// Attributes
	this.firstblock = true;
	this.firstcomment = true;
	this.openinfo = false;
	this.infobuff = '';

	// Writeable stream
	this.output = fs.createWriteStream(outputFile, ['utf8']);

	/**
	 * Append a parsed line to the output
	 * @param line {String} line to parse
	 * @return none
	 */
	this.parseLine = function( line ){
		// Escape some caracters
		line = line.replace(/\\/g, '\\\\');
		line = line.replace(/\'/g, '\\\'');

		// Save the comments ( licence... )
		if( line.trim()[0] == '#' && this.firstblock ){
			line = line.replace(/#/, '');
			if (this.firstcomment){
				this.output.write( '/* '+line.trim()+'\n' );
				this.firstcomment = false;
			} else {
				this.output.write( ' * '+line.trim()+'\n' );
			}
		} else if (line.trim() != '' && line.trim()[0] != '#'){
			// First block exception
			if ( this.firstblock && line[0] != '\t' ){
				this.output.write(' *\n */\n\nvar list = exports.list = {');
				this.output.write( '\n\t\'' + line + '\' : {');
				this.firstblock = false;
			// Other block
			} else if( line[0] != '\t' ){
				// Append the `info` buffer
				if ( this.openinfo && this.infobuff != '' ){
					this.output.write( ',\n\t\tinfo:\'' + this.infobuff.trim() + '\'' );
					this.infobuff = '';
				}
				this.openinfo = false;
				this.output.write( '\n\t},\n\t\'' + line.trim() + '\':{');
			// Name property associated with ATR
			} else if(!this.openinfo) {
				this.output.write( '\n\t\tname:\'' + line.trim() + '\'' );
				this.openinfo = true;
			// Comment has been started
			} else if(this.infobuff) {
				this.infobuff+= '\t\\\n\t\t' + line;
			// Start collecting `info`
			} else {
				this.infobuff+=line;
			}
		}
	}

	/**
	 * Set the last bytes and close
	 * @return none
	 */
	this.closeFile = function(){
		this.output.end('\n\t}\n};');
	}
}
795939
def write_to_buffer
      emit_comments_before if buffer.fresh_line?
      dispatch
      comments.consume(node)
      emit_eof_comments if parent.is_a?(Root)
      self
    end
1278791
def comment(string, options = {})
      options = {
        :style => :css,
        :per_line => true
      }.update(options)
      
      commenters = {
        :html => Proc.new{|s| "<!-- #{s} -->" },
        :css => Proc.new{|s| "/*! #{s} */" },
        :js => Proc.new{|s| "/*! #{s} */" }                
      }
      
      commenter = commenters[options[:style]] || commenters[:js]
      
      if options[:per_line]
        string = string.split(/\r?\n/)
        string.map{|s| commenter.call(s) }.join("\n")
      else
        commenter.call(s)
      end
    end
513242
def save_as outfile
      _t = "(all rows)"
      if @selected_indices.size > 0
        _t = "(selected rows)"
      end
      unless outfile
        outfile = get_string "Enter file name to save #{_t} as "
        return unless outfile
      end

      # if there is a selection, then write only selected rows
      l = nil
      if @selected_indices.size > 0
        l = []
        @list.each_with_index { |v,i| l << v if @selected_indices.include? i }
      else
        l = @list
      end

      File.open(outfile, 'w') {|f|
        l.each {|r|
          line = r.join "\t"
          f.puts line
        }
      }
    end
741759
def send_comment(results)
      dir = "#{Dir.pwd}/"
      results['messages'].each do |r|
        filename = results['filePath'].gsub(dir, '')
        method = r['severity'] > 1 ? 'fail' : 'warn'
        send(method, r['message'], file: filename, line: r['line'])
      end
    end
168451
def restore_yaml_comments(data, default_data):
    
    comment_map = dict()
    default_lines = iter(default_data.splitlines())
    for line in default_lines:
        if not line:
            comment = "\n"
        elif line.startswith("#"):
            comment = "{0}\n".format(line)
        else:
            continue
        while True:
            line = next(default_lines)
            if line and not line.startswith("#"):
                break
            comment += "{0}\n".format(line)
        key = line.split(':')[0].strip()
        comment_map[key] = comment
    out_lines = iter(data.splitlines())
    out_data = ""
    for line in out_lines:
        key = line.split(':')[0].strip()
        if key in comment_map:
            out_data += comment_map[key]
        out_data += "{0}\n".format(line)
    return out_data
210196
def write_last_update(last_update_at)
      # Check for the presence of the tmp directory.
      if(! File::directory?("tmp")) then
        Dir.mkdir("tmp")
      end

      f = File.new("tmp/chronuscop.tmp","w")
      f.printf("%d",last_update_at.to_i)
      f.close()
    end
1358461
def write str
      self.class.stream.tap do |stream|
        stream.write str
        stream.flush
      end ; nil
    end
1167376
def long_out io , level
      indent = " " * level
      @children.each_with_index do |child , i|
        io.write "\n#{indent}" unless i == 0
        io.write "- "
        child.out(io , level + 1)
      end
    end
879913
def load
      @comments = self.build
      max_size = @comments.size
      
      written = false
      load_comments(Rails.root.join('app', 'models').to_s, max_size) do |file, line|
        if !written and line.lstrip.starts_with?('class') and !file.trailing?(@comments)
          file.write(@comments.join)
          written = true
        end
        file.write(line)
      end
    end
241199
function end() {
		var err
		var args = Array.prototype.slice.call(arguments)
		var cb = typeof args[args.length - 1] === 'function' ? args.pop() : null
		if (self.writable && args.length) write.apply(this, args.concat(afterWrite))
		else afterWrite()

		function afterWrite(e) {
			if (e) err = e
			destroy(afterDestroy)
		}

		function afterDestroy(e) {
			if (e && !err) err = e
			if (cb) {
				var cbArgs = []
				if (err) cbArgs.push(err)
				cb.apply(this, cbArgs)
			}
		}
	}