_registry_skip_body

Definition

_registry_skip_body(&$tokens)
drupal/includes/registry.inc, line 240

Description

Skip the body of a code block, as defined by { and }.

This function assumes that the body starts at the next instance of { from the current position.

Parameters

$tokens

Related topics

Namesort iconDescription
Code registryThe code registry engine.

Code

function _registry_skip_body(&$tokens) {
  $num_braces = 1;

  $token = '';
  // Get to the first open brace.
  while ($token != '{' && ($token = next($tokens)));

  // Scan through the rest of the tokens until we reach the matching
  // end brace.
  while ($num_braces && ($token = next($tokens))) {
    if ($token == '{') {
      ++$num_braces;
    }
    elseif ($token == '}') {
      --$num_braces;
    }
  }
}