Changeset View
Changeset View
Standalone View
Standalone View
scripts/symbols/generate_php_symbols.php
Show First 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | foreach ($scopes as $scope) { | ||||
$methods = $class->selectDescendantsOfType('n_METHOD_DECLARATION'); | $methods = $class->selectDescendantsOfType('n_METHOD_DECLARATION'); | ||||
foreach ($methods as $method) { | foreach ($methods as $method) { | ||||
$method_name = $method->getChildByIndex(2); | $method_name = $method->getChildByIndex(2); | ||||
print_symbol($file, 'method', $method_name, $class_name); | print_symbol($file, 'method', $method_name, $class_name); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
function print_symbol($file, $type, $token, $context=null) { | function print_symbol($file, $type, $token, $context = null) { | ||||
$parts = array( | $parts = array( | ||||
$context ? $context->getConcreteString() : '', | $context ? $context->getConcreteString() : '', | ||||
// variable tokens are `$name`, not just `name`, so strip the $ off of | // variable tokens are `$name`, not just `name`, so strip the $ off of | ||||
// class field names | // class field names | ||||
ltrim($token->getConcreteString(), '$'), | ltrim($token->getConcreteString(), '$'), | ||||
$type, | $type, | ||||
'php', | 'php', | ||||
$token->getLineNumber(), | $token->getLineNumber(), | ||||
'/'.ltrim($file, './'), | '/'.ltrim($file, './'), | ||||
); | ); | ||||
echo implode(' ', $parts)."\n"; | echo implode(' ', $parts)."\n"; | ||||
} | } |