Override of \Twig_Lexer::lexComment().

Extract the comment into the token stream, then pass control back to the
default lexer.
546702
protected function lexComment()
    {
        if (preg_match($this->regexes['lex_comment'], $this->code, $match, PREG_OFFSET_CAPTURE, $this->cursor)) {
            $comment = substr($this->code, $this->cursor, $match[0][1] - $this->cursor);
            $this->pushToken(\Twig_Token::BLOCK_START_TYPE);
            $this->pushToken(\Twig_Token::NAME_TYPE, 'comment');
            $this->pushToken(\Twig_Token::TEXT_TYPE, $comment);
            $this->pushToken(\Twig_Token::BLOCK_END_TYPE);
        }

        // Pass back to the normal lexer to skip past the comment.
        return parent::lexComment();
    }
1374950
public function extractDoctrineTypeFromComment($comment, $currentType)
    {
        if ($comment !== null && preg_match('(\(DC2Type:(((?!\)).)+)\))', $comment, $match)) {
            return $match[1];
        }

        return $currentType;
    }
257740
def transform_comments(separator, &block)
      if @comments.empty?
        nil
      else
        block ||= lambda { |c| c }
        @comments.map(&block).join(separator)
      end
    end
1054471
function readComment()
    {
        $str    = substr($this->source, $this->index);
        $result = preg_match('/^(.*?)(?:\r\n|\n|$)/', $str, $matches);

        $this->index += ($result) ? strlen($matches[0]) : 0;

        return substr($matches[1], 1); // ignore # character and EOL
    }
1004640
private void processNestedComment() {
        int nestedCommentsAmount = 1; // Starting with just the initial comment.
        while (templateReader.hasNextCharacter()) {
            final char commentCharacter = templateReader.nextCharacter();
            if (isCommentClosingMarker(commentCharacter) && templateReader.hasNextCharacter()
                    && templateReader.peekCharacter() == syntax.getTagClosing()) {
                // Character was a comment closing sign and the next tag closed the comment.
                templateReader.nextCharacter(); // Polling tag closing.
                if (--nestedCommentsAmount == 0) {
                    // All comments ended. Returning.
                    break;
                }
            }
            if (commentCharacter == syntax.getTagOpening() && templateReader.hasNextCharacter()
                    && isCommentOpeningMarker(templateReader.peekCharacter())) {
                // Another comment was opened inside the currently parsed one.
                templateReader.nextCharacter(); // Polling comment opening marker.
                nestedCommentsAmount++;
            }
        }
    }
1039395
def _parse_comment(self):
        """"""
        self._head += 4
        reset = self._head - 1
        self._push()
        while True:
            this = self._read()
            if this == self.END:
                self._pop()
                self._head = reset
                self._emit_text("<!--")
                return
            if this == self._read(1) == "-" and self._read(2) == ">":
                self._emit_first(tokens.CommentStart())
                self._emit(tokens.CommentEnd())
                self._emit_all(self._pop())
                self._head += 2
                if self._context & contexts.FAIL_NEXT:
                    # _verify_safe() sets this flag while parsing a template
                    # or link when it encounters what might be a comment -- we
                    # must unset it to let _verify_safe() know it was correct:
                    self._context ^= contexts.FAIL_NEXT
                return
            self._emit_text(this)
            self._head += 1
330616
public function removeComment()
    {
        $id = isset($_POST['id']) ? (int) $_POST['id'] : 0;

        if (!$comment = get_comment($id)) {
            wp_send_json_error('Comment is missing');
        }

        if (!current_user_can('edit_comment', $comment->comment_ID) && !($comment->user_id == get_current_user_id())) {
            wp_send_json_error('Missing authorization');
        }

        // Validate nonce
        if (!check_ajax_referer("delete-comment_$id", 'nonce', false)) {
            wp_send_json_error('Nonce failed');
        }

        $trashed = wp_trash_comment($comment);
        if ($trashed) {
            wp_send_json_success('Deletion was successful');
        }

        wp_send_json();
    }
776905
private function parseDocComment($comment)
    {
        $data = array();
        preg_match_all('/^\s*\*[*\s]*(@.+)$/m', $comment, $items);
        if ($items && isset($items[1])) {
            foreach ($items[1] as $item) {
                $parts = explode(' ', $item);
                $key = array_shift($parts);
                $data[$key][] = trim(implode(' ', $parts));
            }
        }

        return $data;
    }
227954
private void parseComment() throws Exception {
        boolean saved = expandPE;

        expandPE = false;
        parseUntil(endDelimComment);
        require('>');
        expandPE = saved;
        handler.comment(dataBuffer, 0, dataBufferPos);
        dataBufferPos = 0;
    }
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
285521
protected function singleLineComment()
    {
        $comment = '';
        while (true) {
            $get = $this->get();
            $comment .= $get;
            if (ord($get) <= self::ORD_LF) {
                if (preg_match('/^\\/@(?:cc_on|if|elif|else|end)\\b/', $comment)) {
                    return '/'.$comment;
                }
                return $get;
            }
        }
        return;
    }
551051
protected function _commentNode()
    {
        $this->_codeNode();
        $token = $this->_stream->current(true);
        $this->_states['body'] = $token[1];
        $node = new NodeDef($this->_states['body'], 'comment');
        return $this->_contextualize($node);
    }
791226
function tokenComment(stream, state) {
    var maybeEnd = false, maybeNested = false, nestedCount = 0, ch;
    while (ch = stream.next()) {
      if (ch == ")" && maybeEnd) {
        if(nestedCount > 0)
          nestedCount--;
        else {
          popStateStack(state);
          break;
        }
      }
      else if(ch == ":" && maybeNested) {
        nestedCount++;
      }
      maybeEnd = (ch == ":");
      maybeNested = (ch == "(");
    }
    
    return ret("comment", "comment");
  }
663867
public final void mDOCUMENT_COMMENT() throws RecognitionException {
        try {
            int _type = DOCUMENT_COMMENT;
            int _channel = DEFAULT_TOKEN_CHANNEL;
            // BELScript.g:253:17: ( '#' (~ ( '\\n' | '\\r' ) )* )
            // BELScript.g:254:5: '#' (~ ( '\\n' | '\\r' ) )*
            {
            match('#'); 
            // BELScript.g:254:9: (~ ( '\\n' | '\\r' ) )*
            loop1:
            do {
                int alt1=2;
                int LA1_0 = input.LA(1);

                if ( ((LA1_0>='\u0000' && LA1_0<='\t')||(LA1_0>='\u000B' && LA1_0<='\f')||(LA1_0>='\u000E' && LA1_0<='\uFFFF')) ) {
                    alt1=1;
                }


                switch (alt1) {
            	case 1 :
            	    // BELScript.g:254:9: ~ ( '\\n' | '\\r' )
            	    {
            	    if ( (input.LA(1)>='\u0000' && input.LA(1)<='\t')||(input.LA(1)>='\u000B' && input.LA(1)<='\f')||(input.LA(1)>='\u000E' && input.LA(1)<='\uFFFF') ) {
            	        input.consume();

            	    }
            	    else {
            	        MismatchedSetException mse = new MismatchedSetException(null,input);
            	        recover(mse);
            	        throw mse;}


            	    }
            	    break;

            	default :
            	    break loop1;
                }
            } while (true);

            _channel=HIDDEN;

            }

            state.type = _type;
            state.channel = _channel;
        }
        finally {
        }
    }
556591
function stripComments(token) {
  return strip

  /* Strip comments. */
  function strip(value) {
    var index = value.indexOf(token)

    if (index !== -1) {
      value = value.substr(0, index)
    }

    return value
  }
}
428359
function getCommentSL() {
  const type = NodeType.CommentSLType;
  const token = tokens[pos];
  const line = token.ln;
  const column = token.col;
  const content = tokens[pos++].value.substring(2);
  const end = !content ? [line, column + 1]
    : getLastPosition(content, line, column + 2);

  return newNode(type, content, line, column, 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;
        }
    }