Comments can be anywhere. So break apart the Dockerfile into significant
        lines and any comments that precede them. And if a line is a carryover
        from the previous via an escaped-newline, bring the directive with it.
501805
def preparse_iter(self):
        
        to_yield = {}
        last_directive = None
        lines_processed = 0
        for line in self.lines_iter():
            if not line:
                continue
            if line.startswith(u'#'):
                comment = line.lstrip('#').strip()
                # Directives have to precede any instructions
                if lines_processed == 1:
                    if comment.startswith(u'escape='):
                        self.escape_char = comment.split(u'=', 1)[1]
                        continue
                to_yield.setdefault('comments', []).append(comment)
            else:
                # last_directive being set means the previous line ended with a
                # newline escape
                if last_directive:
                    directive, payload = last_directive, line
                else:
                    directive, payload = line.split(u' ', 1)
                if line.endswith(self.escape_char):
                    payload = payload.rstrip(self.escape_char)
                    last_directive = directive
                else:
                    last_directive = None
                to_yield['directive'] = directive
                to_yield['payload'] = payload.strip()
                yield to_yield
                to_yield = {}
357926
public boolean nextLineExceptComments() throws IOException {
    while(nextLine()) {
      if(comment == null || !comment.reset(buf).matches()) {
        tokenizer.initialize(buf, 0, buf.length());
        return true;
      }
    }
    return false;
  }
192164
def _expose(self, line):
        '''

        '''
        ports = self._setup('EXPOSE', line)
        if len(ports) > 0:
            self.ports += ports
        return self._comment("# %s" %line)
92937
def mkcomments(commentfile)
      unless commentfile.nil?
        comms = Comments.new()
        File.open(@destination + '/xl/'+commentfile.gsub('../', ''), 'r') do |f|
          Ox.sax_parse(comms, f)
        end
        return comms.commarray
      end
    end
715375
def find_comments text
      return "" unless text
      lines = text.split("\n")
      lines.reverse! if COMMENTS_ARE_UPPER
      comment_block = Array.new
      lines.each do |line|
        break if line =~ /^\s*?\w/ || line =~ /^\s*?$/
        if COMMENTS_ARE_UPPER
          comment_block.unshift line.sub(/^\s*?!\s?/,"")
        else
          comment_block.push line.sub(/^\s*?!\s?/,"")
        end
      end
      nice_lines = comment_block.join("\n").split "\n\s*?\n"
      nice_lines[0] ||= ""
      nice_lines.shift
    end
80995
protected function consumeMultipleLineComment()
    {
        $this->get();
        $comment = '';
        for(;;) {
            $get = $this->get();
            if ($get === '*') {
                if ($this->peek() === '/') { // end of comment reached
                    $this->get();
                    if (0 === strpos($comment, '!')) {
                        // preserved by YUI Compressor
                        if (!$this->keptComment) {
                            // don't prepend a newline if two comments right after one another
                            $this->keptComment = "\n";
                        }
                        $this->keptComment .= "/*!" . substr($comment, 1) . "*/\n";
                    } else if (preg_match('/^@(?:cc_on|if|elif|else|end)\\b/', $comment)) {
                        // IE conditional
                        $this->keptComment .= "/*{$comment}*/";
                    }
                    return;
                }
            } elseif ($get === null) {
                throw new UnterminatedCommentException(
                    "JSMin: Unterminated comment at byte {$this->inputIndex}: /*{$comment}");
            }
            $comment .= $get;
        }
    }
1273832
function(line, isInComment) {
  while (true || line.length > 0) {
    var startIndex = line.indexOf('{-');
    var endIndex = line.indexOf('-}');
    var singleLineComment = line.indexOf('--');

    // when we have a single line comment
    if (singleLineComment > -1 && !isInComment) {
      line = line.substr(0, singleLineComment);
      continue;
    }

    // when there's no comment chars
    if (startIndex === -1 && endIndex === -1) {
      return {
        line: isInComment ? '' : line,
        isInComment: isInComment,
      };
    }

    // when there's a start and end
    if (startIndex > -1 && endIndex > -1) {
      line = line.substr(0, startIndex) + line.substr(endIndex + 2);
      continue;
    }

    // when there's a start, but no end
    if (startIndex > -1)
      return { line: line.substr(0, startIndex), isInComment: true };

    // when there's an end, but no start
    if (endIndex > -1 && isInComment)
      return { line: line.substr(endIndex + 2), isInComment: false };
  }

  return { line: '', isInComment: isInComment };
}
1015948
function onComment(block, text, start, stop, startLoc, endLoc) {
      var match;
      commentsByEndLine[endLoc.line] = {
        text: text,
        block: block
      };
      match = text.match(/@module (\w+)/);
      if (match) {
        moduleName = match[1];
        modules.push({
          name: moduleName,
          comment: '/*' + text + '*/\n'
        });
      }
      // Both @module and @namespace may be defined in the same comment block.
      match = text.match(/@(namespace|module) \w+/g);
      if (match) {
        if (text.match(/@method/)) {
          // Don't allow temporary namespace renamings
          // in method block.
          return;
        }
        var namespace = match[match.length - 1].match(/@(namespace|module) (\w+)/)[2];
        namespaceBoundary(namespace, endLoc.line);
      }
    }
1023976
def look_for_directives_in(context, comment)

      preprocess = SM::PreProcess.new(@input_file_name,
                                      @options.rdoc_include)

      preprocess.handle(comment) do |directive, param|
        case directive
        when "stopdoc"
          context.stop_doc
          ""
        when "startdoc"
          context.start_doc
          context.force_documentation = true
          ""

        when "enddoc"
          #context.done_documenting = true
          #""
          throw :enddoc

        when "main"
          options = Options.instance
          options.main_page = param
	  ""

        when "title"
          options = Options.instance
          options.title = param
          ""

        when "section"
          context.set_current_section(param, comment)
          comment.replace("") # 1.8 doesn't support #clear
          break 
        else
          warn "Unrecognized directive '#{directive}'"
          break
        end
      end

      remove_private_comments(comment)
    end
992519
def parse_comments_for_file(filename):
    
    return [parse_comment(strip_stars(comment), next_line)
            for comment, next_line in get_doc_comments(read_file(filename))]
783868
function isConsecutiveComment(comment) {
            const previousTokenOrComment = sourceCode.getTokenBefore(comment, { includeComments: true });

            return Boolean(
                previousTokenOrComment &&
                ["Block", "Line"].indexOf(previousTokenOrComment.type) !== -1
            );
        }
774041
function getLastCommentLineOfBlock(commentStartLine) {
            const currentCommentEnd = commentEndLine[commentStartLine];

            return commentEndLine[currentCommentEnd + 1] ? getLastCommentLineOfBlock(currentCommentEnd + 1) : currentCommentEnd;
        }
601695
function addComment( text, multiline ) {

          if ( options.extractComments ) {

              const loc = location();

              comments[ loc.start.offset ] = {
                  text: text,
                  multiline: multiline,
                  location: loc,
              };

          }

          return text;

      }
733798
private void _comment() throws
      IOException,
      CssException
  {
    if (debug)
    {
      checkState(reader.curChar == '/' && reader.peek() == '*');
    }
    /*
       * badcomment1 \/\*[^*]*\*+([^/*][^*]*\*+)* badcomment2
       * \/\*[^*]*(\*+[^/*][^*]*)* comment \/\*[^*]*\*+([^/*][^*]*\*+)*\/
       *
       *
       * "comments can not nest" just close at first occurrence of comment
       * close and let the grammar level handle reporting
       */

    builder.type = Type.COMMENT;

    reader.next(); // '*'

    while (true)
    {
      Mark mark = reader.mark();
      int ch = reader.next();
      if (ch == -1)
      {
        builder.error(SCANNER_PREMATURE_EOF, reader);
        reader.unread(ch, mark);
        break;
      }
      else if (ch == '*' && reader.peek() == '/')
      {
        reader.next();
        break;
      }
      else
      {
        builder.append(ch);
      }
    }

    if (debug && builder.errors.size() < 1)
    {
      checkState('/' == reader.curChar && '*' == reader.prevChar);
    }

  }
1208389
function processLine (context, comment) {
  const parsed = parse(COMMENT_DIRECTIVE_L, comment.value)
  if (parsed != null && comment.loc.start.line === comment.loc.end.line) {
    const line = comment.loc.start.line + (parsed.type === 'eslint-disable-line' ? 0 : 1)
    const column = -1
    disable(context, { line, column }, 'line', parsed.rules)
    enable(context, { line: line + 1, column }, 'line', parsed.rules)
  }
}
622896
function isCommentLine (line) {
  var isCmnt = commentRE.test(line);
  if (isCmnt) {
    debug('removing comment: %s', line);
  }
  return !isCmnt;
}
934690
function isInCommentHelper(sourceFile, position, predicate) {
        var token = getTokenAtPosition(sourceFile, position);
        if (token && position <= token.getStart(sourceFile)) {
            var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos);
            // The end marker of a single-line comment does not include the newline character.
            // In the following case, we are inside a comment (^ denotes the cursor position):
            //
            //    // asdf   ^\n
            //
            // But for multi-line comments, we don't want to be inside the comment in the following case:
            //
            //    /* asdf */^
            //
            // Internally, we represent the end of the comment at the newline and closing '/', respectively.
            return predicate ?
                ts.forEach(commentRanges, function (c) { return c.pos < position &&
                    (c.kind == 2 /* SingleLineCommentTrivia */ ? position <= c.end : position < c.end) &&
                    predicate(c); }) :
                ts.forEach(commentRanges, function (c) { return c.pos < position &&
                    (c.kind == 2 /* SingleLineCommentTrivia */ ? position <= c.end : position < c.end); });
        }
        return false;
    }