Scans for //-? comments yielding a <comment>
token if found as well as a stack of text-block tokens.

@return \Generator
166357
protected function scanComment()
    {

        if (!$this->match("\\/\\/(-)?[\t ]*"))
            return;

        $this->consumeMatch();

        $token = $this->createToken('comment');
        $token['rendered'] = $this->getMatch(1) ? false : true;

        yield $token;

        foreach ($this->scanTextBlock() as $token)
            yield $token;
    }
589637
protected function scanNewLine()
    {

        foreach ($this->scanToken('newLine', "\n") as $token) {

            $this->line++;
            $this->offset = 0;
            yield $token;
        }
    }
1155567
public static function get_comments() {
        global $DB, $USER;

        $comments = array();
        $records = $DB->get_records('assignfeedback_editpdf_quick', array('userid'=>$USER->id));

        return $records;
    }
1142539
function getCommentLineNumbers(comments) {
            const lines = new Set();

            comments.forEach(comment => {
                for (let i = comment.loc.start.line; i <= comment.loc.end.line; i++) {
                    lines.add(i);
                }
            });

            return lines;
        }
38519
public static function create($comment) {
    $block_comment = new LineCommentBlockNode();
    $comment = trim($comment);
    $lines = array_map('rtrim', explode("\n", $comment));
    foreach ($lines as $line) {
      $comment_node = new CommentNode(T_COMMENT, '// ' . $line . "\n");
      $block_comment->addChild($comment_node);
    }
    return $block_comment;
  }
509942
public function getIterator(): Generator
    {
        foreach ($this->packageRoots as $root) {
            $rootPaths = [];
            $packages = [];

            // Search each namespace we've been provided.
            foreach ($this->namespaces as $namespace) {

                // Try to find the root within this namespace.
                // If we find it, aggregate the paths to scan for packages later.
                $package = $namespace->findNamespace($root);
                if ($package) {
                    $rootPaths = array_merge($rootPaths, $package->getPaths());
                }

                // If the namespace itself is actually a package within the root we're searching for,
                // aggregate it's path to scan as a package for later.
                if ($namespace->getParentId() === $root) {
                    if (!array_key_exists($namespace->getId(), $packages)) {
                        $packages[$namespace->getId()] = [];
                    }
                    $packages[$namespace->getId()] = array_merge(
                        $packages[$namespace->getId()],
                        $namespace->getPaths()
                    );
                }
            }

            // If we found any root paths, scan them for packages.
            if ($rootPaths) {
                $namespace = new Psr4Namespace($root, ...$rootPaths);
                yield from $this->scanRoot($namespace);
            }

            // If we found any package paths, scan them.
            foreach ($packages as $id => $paths) {
                $namespace = new Psr4Namespace($id, ...$paths);
                yield from $this->loadPackage($namespace);
            }
        }
    }
1261284
public function getLeadingCommentAndWhitespaceText() : string {
        // TODO re-tokenize comments and whitespace
        $fileContents = $this->getFileContents();
        foreach ($this->getDescendantTokens() as $token) {
            return $token->getLeadingCommentsAndWhitespaceText($fileContents);
        }
    }
326579
public function getIterator()
    {
        //Run the query
        $resp = $this->query->execute();

        //Return the documents as an ArrayIterator to satisfy the requirements
        //of the getIterator function.
        foreach ($resp->data as $document)
        {
            yield $document;
        }

        while ($resp->cursors->next) {
            //send a new request, resetting $resp
            $resp = $this->query->execute($resp->cursors->next);

            foreach ($resp->data as $document)
            {
                yield $document;
            }
        }
    }
505776
protected function getModifiersComment()
    {
        $modifiersComment = null;

        foreach ($this->getCommentSections() as $commentSection) {
            // Assume that the modifiers section starts with either a class or a
            // pseudo class
            if (preg_match('/^\s*(?:\.|:)/', $commentSection)) {
                $modifiersComment = $commentSection;
                break;
            }
        }

        return $modifiersComment;
    }
118080
protected function getComment() {
		$comment_body = elgg_view('output/longtext', array(
			'value' => $this->comment->description,
		));
//		if (elgg_view_exists('output/linkify')) {
//			$comment_body = elgg_view('output/linkify', array(
//				'value' => $comment_body
//			));
//		}
		$comment_body .= elgg_view('output/attached', array(
			'entity' => $this->comment,
		));

		$attachments = $this->comment->getAttachments(array('limit' => 0));
		if ($attachments && count($attachments)) {
			$attachments = array_map(__NAMESPACE__ . '\\get_linked_entity_name', $attachments);
			$attachments_text = implode(', ', array_filter($attachments));
			if ($attachments_text) {
				$comment_body .= elgg_echo('interactions:attachments:labelled', array($attachments_text));
			}
		}

		return strip_tags($comment_body, '<p><strong><em><span><ul><li><ol><blockquote><img><a>');
	}
1368176
public function getIterator(): \Generator
    {
        foreach ( $this->storage as $object ) {
            yield $object => $this->storage[$object]['fallback'];
        }
    }
1110976
public function getIterator()
    {

        $this->bindAndRun($this->bindings);

        while ($row = $this->statement->fetch()) {
            yield $row;
        }
    }
109871
private function generateSnippets()
    {
        if ($this->snippetsGenerated) {
            return null;
        }

        $snippetsSet = array();
        foreach ($this->undefinedSteps as $i => $undefinedStep) {
            $snippet = $this->generateSnippet($undefinedStep->getEnvironment(), $undefinedStep->getStep());

            if (!$snippet) {
                continue;
            }

            if (!isset($snippetsSet[$snippet->getHash()])) {
                $snippetsSet[$snippet->getHash()] = array();
            }

            $snippetsSet[$snippet->getHash()][] = $snippet;
            unset($this->undefinedSteps[$i]);
        }

        $this->snippets = array_values(
            array_map(
                function (array $snippets) {
                    return new AggregateSnippet($snippets);
                },
                $snippetsSet
            )
        );
        $this->undefinedSteps = array_values($this->undefinedSteps);
        $this->snippetsGenerated = true;
    }
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
202622
private function _processComment($token) {
		// Count the lines of comment
		if ($token->id === T_COMMENT) {
			$this->_ncssTotalSingleComment ++;
			$this->_ncssFileSingleComment ++;
		} else if ($token->id === T_ML_COMMENT) {
			$this->_ncssTotalMultiComment ++;
			$this->_ncssFileMultiComment ++;
		} else if ($token->id === T_DOC_COMMENT) {
			$this->_ncssTotalPhpdoc ++;
			$this->_ncssFilePhpdoc ++;
			$this->_ncssTotalLinesPhpdoc ++;
			$this->_ncssFileLinesPhpdoc ++;
			if ($this->_isFileDocComment()) {
				$this->_processAnnotation(T_FILE, $token->text);
			}
		}

		// Count the @params, @returns and @throw
		if (stripos($token->text, '/**') !== false) {
			// Reset the count of elements if it's a new docblock
			$this->statementStack->getCurrentStackItem()->docblocNbParams = 0;
			$this->statementStack->getCurrentStackItem()->docblocNbReturns = 0;
			$this->statementStack->getCurrentStackItem()->docblocNbThrows = 0;
		}
		if (stripos($token->text, '@param') !== false) {
			$this->statementStack->getCurrentStackItem()->docblocNbParams ++;
		}
		if (stripos($token->text, '@return') !== false) {
			$this->statementStack->getCurrentStackItem()->docblocNbReturns ++;
		}
		if (stripos($token->text, '@throw') !== false) {
			$this->statementStack->getCurrentStackItem()->docblocNbThrows ++;
		}
		if (stripos($token->text, '@inheritdoc') !== false) {
			$this->statementStack->getCurrentStackItem()->docblocInheritDoc = true;
		}

		// Check if the comment starts with '#'
		if ($this->_isActive('noShellComments')) {
			$todoStr = strpos($token->text, '#');
			if ($todoStr === 0) {
				$this->_writeError('noShellComments', $this->_getMessage('NO_SHELL_COMMENTS'));
			}
		}

		// Check if the comment contains a TO DO
		$this->_processTODO($token);
	}
1090353
public function getTagTokens(): array
    {
        $iteratedPos = 0;
        $tagPositions = $this->getCommentStartToken()['comment_tags'];
        $tagTokens = [];

        /** @var int $tagPos */
        foreach ($tagPositions as $tagPos) {
            if ($tagPos >= $iteratedPos) {
                $tagTokens[$tagPos] = $this->tokens[$tagPos] + [
                    'contents' => $this->loadTagContentTokens($tagPos, $iteratedPos)
                ];
            }
        }

        return $tagTokens;
    }
676305
public function getIterator() : \Generator
    {
        for ($current = $this->startDate; $current->isBeforeOrEqualTo($this->endDate); $current = $current->plusDays(1)) {
            yield $current;
        }
    }