Changeset View
Changeset View
Standalone View
Standalone View
scripts/symbols/generate_ctags_symbols.php
Context not available. | |||||
$data = array(); | $data = array(); | ||||
$futures = array(); | $futures = array(); | ||||
foreach (explode("\n", trim($input)) as $file) { | foreach (@explode("\n", trim($input)) as $file) { | ||||
if (!strlen($file)) { | if (!@strlen($file)) { | ||||
continue; | continue; | ||||
} | } | ||||
Context not available. | |||||
$futures = new FutureIterator($futures); | $futures = new FutureIterator($futures); | ||||
foreach ($futures->limit(8) as $file => $future) { | foreach ($futures->limit(8) as $file => $future) { | ||||
$tags = $future->resolve(); | $tags = $future->resolve(); | ||||
$tags = explode("\n", $tags[1]); | $tags = @explode("\n", $tags[1]); | ||||
foreach ($tags as $tag) { | foreach ($tags as $tag) { | ||||
$parts = explode(';', $tag); | $parts = @explode(';', $tag); | ||||
// Skip lines that we can not parse. | // Skip lines that we can not parse. | ||||
if (count($parts) < 2) { | if (count($parts) < 2) { | ||||
Context not available. | |||||
} | } | ||||
// Split ctags information. | // Split ctags information. | ||||
$tag_info = explode("\t", $parts[0]); | $tag_info = @explode("\t", $parts[0]); | ||||
// Split exuberant ctags "extension fields" (additional information). | // Split exuberant ctags "extension fields" (additional information). | ||||
$parts[1] = trim($parts[1], "\t \""); | $parts[1] = trim($parts[1], "\t \""); | ||||
$extension_fields = explode("\t", $parts[1]); | $extension_fields = @explode("\t", $parts[1]); | ||||
// Skip lines that we can not parse. | // Skip lines that we can not parse. | ||||
if (count($tag_info) < 3 || count($extension_fields) < 2) { | if (count($tag_info) < 3 || count($extension_fields) < 2) { | ||||
Context not available. | |||||
list($type, $language, $context) = $extension_fields; | list($type, $language, $context) = $extension_fields; | ||||
// Skip lines with tokens containing a space. | // Skip lines with tokens containing a space. | ||||
if (strpos($token, ' ') !== false) { | if (@strpos($token, ' ') !== false) { | ||||
continue; | continue; | ||||
} | } | ||||
// Strip "language:" | // Strip "language:" | ||||
$language = substr($language, 9); | $language = @substr($language, 9); | ||||
// To keep consistent with "Separate with commas, for example: php, py" | // To keep consistent with "Separate with commas, for example: php, py" | ||||
// in Arcanist Project edit form. | // in Arcanist Project edit form. | ||||
Context not available. | |||||
$language = str_ireplace('c#', 'cs', $language); | $language = str_ireplace('c#', 'cs', $language); | ||||
// Ruby has "singleton method", for example. | // Ruby has "singleton method", for example. | ||||
$type = substr(str_replace(' ', '_', $type), 0, 12); | $type = @substr(str_replace(' ', '_', $type), 0, 12); | ||||
// class:foo, struct:foo, union:foo, enum:foo, ... | // class:foo, struct:foo, union:foo, enum:foo, ... | ||||
$context = last(explode(':', $context, 2)); | $context = last(@explode(':', $context, 2)); | ||||
$ignore = array( | $ignore = array( | ||||
'variable' => true, | 'variable' => true, | ||||
Context not available. | |||||
function print_symbol($file, $line_num, $type, $token, $context, $language) { | function print_symbol($file, $line_num, $type, $token, $context, $language) { | ||||
// Get rid of relative path. | // Get rid of relative path. | ||||
$file = explode('/', $file); | $file = @explode('/', $file); | ||||
if ($file[0] == '.' || $file[0] == '..') { | if ($file[0] == '.' || $file[0] == '..') { | ||||
array_shift($file); | array_shift($file); | ||||
} | } | ||||
Context not available. | |||||
$context, | $context, | ||||
$token, | $token, | ||||
$type, | $type, | ||||
strtolower($language), | @strtolower($language), | ||||
$line_num, | $line_num, | ||||
$file, | $file, | ||||
); | ); | ||||
Context not available. |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0