function CommentsRegistry::onNodeCompleted
Listener called every time a node is completed by the parser
Parameters
Node\Node $node Completed node:
Return value
void
File
-
vendor/
mck89/ peast/ lib/ Peast/ Syntax/ CommentsRegistry.php, line 161
Class
- CommentsRegistry
- Comments registry class. Internal class used to manage comments
Namespace
Peast\SyntaxCode
public function onNodeCompleted(Node\Node $node) {
//Every time a node is completed, register its start and end indices
//in the relative properties
$loc = $node->location;
foreach (array(
"Start",
"End",
) as $pos) {
$val = $loc->{"get{$pos}"}()
->getIndex();
$map =& $this->{"nodes{$pos}Map"};
if (!isset($map[$val])) {
$map[$val] = array();
}
$map[$val][] = $node;
}
}