_registry_skip_body

  1. drupal
    1. drupal7
Versionen
drupal7 _registry_skip_body(&$tokens)

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.

Übergabeparameter

$tokens

Verwandte Themen

Code

includes/registry.inc, line 247

<?php
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))) {
    // PHP is really logical to have three different tokens for { with
    // inconsistent names and only one for a closing brace.
    if ($token == '{' || (is_array($token) && ($token[0] == T_DOLLAR_OPEN_CURLY_BRACES || $token[0] == T_CURLY_OPEN))) {
      ++$num_braces;
    }
    elseif ($token == '}') {
      --$num_braces;
    }
    // Consume strings manually as workaround for a bug in PHP < 5.2.3 (see
    // http://drupal.org/node/368116).
    elseif ($token == '"' || $token == '`' || (is_array($token) && $token[0] == T_START_HEREDOC)) {
      $stop = is_array($token) ? T_END_HEREDOC : $token;
      while (($token = next($tokens)) && (is_array($token) ? $token[0] : $token) != $stop) {
      }
    }
  }
}
?>

Kommentare

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen