You are here

function _potx_find_end_of_function in Translation template extractor 6.3

Same name and namespace in other branches
  1. 8 potx.inc \_potx_find_end_of_function()
  2. 5.2 potx.inc \_potx_find_end_of_function()
  3. 5 potx.inc \_potx_find_end_of_function()
  4. 6 potx.inc \_potx_find_end_of_function()
  5. 6.2 potx.inc \_potx_find_end_of_function()
  6. 7.3 potx.inc \_potx_find_end_of_function()
  7. 7 potx.inc \_potx_find_end_of_function()
  8. 7.2 potx.inc \_potx_find_end_of_function()

Helper function to look up the token closing the current function.

Parameters

$here: The token at the function name

2 calls to _potx_find_end_of_function()
_potx_find_language_names in ./potx.inc
Get languages names from Drupal's locale.inc.
_potx_find_menu_hooks in ./potx.inc
List of menu item titles. Only from Drupal 6.

File

./potx.inc, line 1203
Extraction API used by the web and command line interface.

Code

function _potx_find_end_of_function($here) {
  global $_potx_tokens;

  // Seek to open brace.
  while (is_array($_potx_tokens[$here]) || $_potx_tokens[$here] != '{') {
    $here++;
  }
  $nesting = 1;
  while ($nesting > 0) {
    $here++;
    if (!is_array($_potx_tokens[$here])) {
      if ($_potx_tokens[$here] == '}') {
        $nesting--;
      }
      if ($_potx_tokens[$here] == '{') {
        $nesting++;
      }
    }
  }
  return $here;
}