Create a comment token object and make sure it has all the data JSHint needs to work with special comments.
351775
function commentToken(label, body, opt) {
      var special = ["jshint", "jslint", "members", "member", "globals", "global", "exported"];
      var isSpecial = false;
      var value = label + body;
      var commentType = "plain";
      opt = opt || {};

      if (opt.isMultiline) {
        value += "*/";
      }

      special.forEach(function (str) {
        if (isSpecial) {
          return;
        }

        // Don't recognize any special comments other than jshint for single-line
        // comments. This introduced many problems with legit comments.
        if (label === "//" && str !== "jshint") {
          return;
        }

        if (body.substr(0, str.length) === str) {
          isSpecial = true;
          label = label + str;
          body = body.substr(str.length);
        }

        if (!isSpecial && body.charAt(0) === " " && body.substr(1, str.length) === str) {
          isSpecial = true;
          label = label + " " + str;
          body = body.substr(str.length + 1);
        }

        if (!isSpecial) {
          return;
        }

        switch (str) {
        case "member":
          commentType = "members";
          break;
        case "global":
          commentType = "globals";
          break;
        default:
          commentType = str;
        }
      });

      return {
        type: Token.Comment,
        commentType: commentType,
        value: value,
        body: body,
        isSpecial: isSpecial,
        isMultiline: opt.isMultiline || false,
        isMalformed: opt.isMalformed || false
      };
    }
1336933
function createToken(options) {
    const newToken = chevrotain.createToken(options)
    allTokens.push(newToken)
    return newToken
}
943874
private void init() {
        jsFactory = new JsonFactory();
        jsFactory.configure(JsonParser.Feature.ALLOW_COMMENTS, true);
        jsFactory.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true);
        jsFactory.configure(JsonParser.Feature.ALLOW_NON_NUMERIC_NUMBERS, true);
    }
1081180
def commit_comment(self, comment_id):
        
        url = self._build_url('comments', str(comment_id), base_url=self._api)
        json = self._json(self._get(url), 200)
        return RepoComment(json, self) if json else None
234020
def commentToJson(comment):
    
    obj = {
        'id': comment.id,
        'comment': comment.comment,
        'user': userToJson(comment.user),
        'date': comment.submit_date.isoformat(),
    }

    return obj
386788
def consume_comments
      if @s.peek(2) == '/*'
        @s.consume
        @s.consume

        if text = @s.scan_until(RE_COMMENT_CLOSE)
          text.slice!(-2, 2)
        else
          # Parse error.
          text = @s.consume_rest
        end

        return create_token(:comment, :value => text)
      end

      nil
    end
1056923
def process_token(self, tok):
        """"""
        if(tok[0].__str__() in ('Token.Comment.Multiline', 'Token.Comment',
                'Token.Literal.String.Doc')):
            self.comments += tok[1].count('\n')+1
        elif(tok[0].__str__() in ('Token.Comment.Single')):
            self.comments += 1
        elif(self.contains_code and tok[0].__str__().startswith('Token.Text')
                and tok[1].count(u'\n')):
            # start new line
            self.contains_code = False
            self.sloc += 1
        # for c style includes
        elif(tok[0].__str__() == 'Token.Comment.Preproc' and
                tok[1].count(u'\n')):
            # start new line
            self.contains_code = False
            self.sloc += 1
        elif(tok[0][0] in token_types):
            self.contains_code = True
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
12000
function addComment(start, end, type, value) {
        assert(typeof start === 'number', 'Comment must have valid position');

        // Because the way the actual token is scanned, often the comments
        // (if any) are skipped twice during the lexical analysis.
        // Thus, we need to skip adding a comment if the comment array already
        // handled it.
        if (extra.comments.length > 0) {
            if (extra.comments[extra.comments.length - 1].range[1] > start) {
                return;
            }
        }

        extra.comments.push({
            range: [start, end],
            type: type,
            value: value
        });
    }
1042549
def emit_comments(comments)
      max = comments.size - 1
      comments.each_with_index do |comment, index|
        if comment.type.equal?(:document)
          buffer.append_without_prefix(comment.text.chomp)
        else
          write(comment.text)
        end
        buffer.nl if index < max
      end
    end
668486
def create_comment(self, body):
        
        json = None
        if body:
            url = self._build_url('comments', base_url=self._api)
            json = self._json(self._post(url, data={'body': body}),
                              201)
        return IssueComment(json, self) if json else None
781422
def create_comment(ticket_id, input, options = {})
      make_request("tickets/#{ticket_id}", ({:update => Zendesk::Main.to_xml('comment', input)}), options)
    end
544992
def post(request):
    """"""
    data = request.POST or json.loads(request.body)['body']
    guid = data.get('guid', None)
    res = Result()

    if guid:
        obj = getObjectsFromGuids([guid,])[0]
        comment = Comment()
        comment.comment = data.get('comment', 'No comment')
        comment.user = request.user
        comment.user_name = request.user.get_full_name()
        comment.user_email = request.user.email
        comment.content_object = obj
        # For our purposes, we never have more than one site
        comment.site_id = 1
        comment.save()

        obj.comment_count += 1
        obj.save()

        emailComment(comment, obj, request)

        res.append(commentToJson(comment))

    return JsonResponse(res.asDict())
1043923
function comment() {
        whitespace();

        if (css[0] !== '/' || css[1] !== '*') {
            return;
        }

        let i = 2;

        while (css[i] && (css[i] !== '*' || css[i + 1] !== '/')) {
            i++;
        }

        if (!css[i]) {
            return error('end of comment is missing');
        }

        const str = css.slice(2, i);

        css = css.slice(i + 2);

        return {
            type   : 'comment',
            comment: str
        };
    }
432017
function commentconfig() {
  var proto = this.Parser && this.Parser.prototype
  var Compiler = this.Compiler
  var block = proto && proto.blockTokenizers
  var inline = proto && proto.inlineTokenizers
  var compiler = Compiler && Compiler.prototype && Compiler.prototype.visitors

  if (block && block.html) {
    block.html = factory(block.html)
  }

  if (inline && inline.html) {
    inline.html = factory(inline.html)
  }

  if (compiler && compiler.html) {
    compiler.html = factory(compiler.html)
  }
}
743945
def oauth_token_create(self, data, **kwargs):
        ""
        api_path = "/api/v2/oauth/tokens.json"
        return self.call(api_path, method="POST", data=data, **kwargs)
376696
def create_comment(comment)
      post_params = {
        :body => comment.post_json,
        :headers => Logan::Client.headers.merge({'Content-Type' => 'application/json'})
      }

      response = Logan::Client.post "/projects/#{@project_id}/todos/#{@id}/comments.json", post_params
      Logan::Comment.new response
    end