Enabling more modules

I don't see the need in selectively including syntax for modules when I can
just install the modules and include them all. Expanded to include all of the
modules I could that were in the list already and updated. Going to look into
getting a more up to date module list for PHP 5.5+ and expanding further.
This commit is contained in:
Joshua Sherman 2014-01-13 23:32:12 -05:00
parent 9de06afeb4
commit 4d3a14f74b
3 changed files with 185 additions and 63 deletions

View file

@ -15,6 +15,9 @@
" Contributor: Joshua Sherman <josh@gravityblvd.com> " Contributor: Joshua Sherman <josh@gravityblvd.com>
" URL: https://github.com/joshtronic/php.vim " URL: https://github.com/joshtronic/php.vim
" "
" Contributor: Kristijan Husak
" URL: https://github.com/kris89/php.vim
"
" Former Maintainer: Peter Hodge <toomuchphp-vim@yahoo.com> " Former Maintainer: Peter Hodge <toomuchphp-vim@yahoo.com>
" Former URL: http://www.vim.org/scripts/script.php?script_id=1571 " Former URL: http://www.vim.org/scripts/script.php?script_id=1571
" "

File diff suppressed because one or more lines are too long

View file

@ -1,123 +1,129 @@
<?php <?php
/** /**
* Script to gather up all native functions, classes, and interfaces from any release of * Script to gather up all native functions, classes, and interfaces from any
* PHP for the purposes of updating the VIM syntax file. * release of PHP for the purposes of updating the VIM syntax file.
* *
* @author Paul Garvin <paul@paulgarvin.net> * @author Paul Garvin <paul@paulgarvin.net>
* @copyright Copyright 2009 Paul Garvin * @copyright Copyright 2009 Paul Garvin
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license http://www.opensource.org/licenses/mit-license.php MIT License
* *
* @author Stan Angeloff <stanimir@angeloff.name> * @author Stan Angeloff <stanimir@angeloff.name>
* @author Joshua Sherman <josh@gravityblvd.com>
*/ */
/** /**
* This script works by loading up PHP extensions and using reflection to pull * This script works by loading up PHP extensions and using reflection to pull
* the functions, classes, and constants out of those extesions. The list of extensions * the functions, classes, and constants out of those extesions. The list of
* below are ones included with PHP 5.3 source code. The ones commented out depend on * extensions below are ones included with PHP 5.3 source code. The ones
* an external library being installed, are Unix specific, or just not commonly used. * commented out depend on an external library being installed, are Unix
* specific, or just not commonly used.
* *
* Add, comment, or uncomment to fit your needs or particular PHP installation. * Add, comment, or uncomment to fit your needs or particular PHP installation.
* Remember that some of these extensions are likely shared extensions and must be * Remember that some of these extensions are likely shared extensions and must
* enabled in your php.ini file. * be enabled in your php.ini file.
* *
* NOTE: mysqlnd is not included because it exposes no functions, classes, or constants. * NOTE: mysqlnd is not included because it exposes no functions, classes, or
* The pdo_* extensions are not included in the list because they do not expose any * constants. The pdo_* extensions are not included in the list because they do
* functions, classes, or constants themselves. The constants and methods specific * not expose any functions, classes, or constants themselves. The constants
* to that driver are exposed though the PDO extension itself. The pdo_* extensions * and methods specific to that driver are exposed though the PDO extension
* must still be enabled (compiled in or loaded as shared) for these constants to show up. * itself. The pdo_* extensions must still be enabled (compiled in or loaded as
* shared) for these constants to show up.
*/ */
$allowed_extensions = array( $allowed_extensions = [
# 'calendar',
# 'com_dotnet',
# 'ctype',
# 'dba',
# 'enchant',
# 'exif',
# 'fileinfo',
# 'filter',
# 'ftp',
# 'gmp',
# 'imap',
# 'interbase',
# 'intl',
# 'ldap',
# 'mssql',
# 'oci8',
# 'oci8_11g',
# 'odbc',
# 'pcntl',
# 'posix',
# 'pspell',
# 'readline',
# 'recode',
# 'shmop',
# 'snmp',
# 'sqlite',
# 'sybase_ct',
# 'sysvmsg',
# 'sysvsem',
# 'sysvshm',
# 'tidy',
# 'xmlrpc',
# 'xsl',
'bcmath', 'bcmath',
'bz2', 'bz2',
'calendar',
// 'com_dotnet',
'core', 'core',
'ctype',
'curl', 'curl',
'date', 'date',
'dba',
'dom', 'dom',
// 'enchant',
'ereg', 'ereg',
'exif',
'fileinfo',
'filter',
'ftp',
'gd', 'gd',
'gettext', 'gettext',
// 'gmp',
'hash', 'hash',
'iconv', 'iconv',
// 'imap',
// 'interbase',
'intl',
'json', 'json',
'ldap',
'libxml', 'libxml',
'mbstring', 'mbstring',
'mcrypt', 'mcrypt',
'memcache', 'memcache',
'memcached', 'memcached',
'mhash', 'mhash',
// 'mssql',
'mysql', 'mysql',
'mysqli', 'mysqli',
// 'oci8',
// 'oci8_11g',
'odbc',
'openssl', 'openssl',
'pcre', 'pcre',
'pdo', 'pdo',
'pgsql', 'pgsql',
'phar', 'phar',
'pcntl',
'posix',
'pspell',
'readline',
// 'recode',
'redis', 'redis',
'reflection', 'reflection',
'session', 'session',
'shmop',
'simplexml', 'simplexml',
'snmp',
'soap', 'soap',
'sockets', 'sockets',
'spl', 'spl',
// 'sqlite',
'sqlite3', 'sqlite3',
'standard', 'standard',
// 'sybase_ct',
'sysvmsg',
'sysvsem',
'sysvshm',
// 'tidy',
'tokenizer', 'tokenizer',
'test_helpers', 'test_helpers',
'wddx', 'wddx',
'xdebug', 'xdebug',
'xml', 'xml',
'xmlreader', 'xmlreader',
'xmlrpc',
'xmlwriter', 'xmlwriter',
'xsl',
'zip', 'zip',
'zlib', 'zlib',
); ];
$processed = array(); $processed = [];
foreach ($allowed_extensions as $extension) { foreach ($allowed_extensions as $extension)
{
try { try
$details = array(); {
$details = [];
$options = new ReflectionExtension($extension); $options = new ReflectionExtension($extension);
$classes = array(); $classes = [];
$functions = array_keys($options->getFunctions()); $functions = array_keys($options->getFunctions());
$constants = array_keys($options->getConstants()); $constants = array_keys($options->getConstants());
foreach ($options->getClasses() as $class) { foreach ($options->getClasses() as $class)
{
$classes[] = $class->getName(); $classes[] = $class->getName();
$constants = array_merge($constants, array_keys($class->getConstants())); $constants = array_merge($constants, array_keys($class->getConstants()));
} }
@ -126,26 +132,35 @@ foreach ($allowed_extensions as $extension) {
$details['name'] = $options->getName(); $details['name'] = $options->getName();
if (sizeof ($functions)) { if (sizeof ($functions))
{
$details['functions'] = implode(' ', $functions); $details['functions'] = implode(' ', $functions);
} }
if (sizeof ($constants)) {
if (sizeof ($constants))
{
$details['constants'] = implode(' ', $constants); $details['constants'] = implode(' ', $constants);
} }
if (sizeof ($classes)) {
if (sizeof ($classes))
{
$details['classes'] = implode(' ', $classes); $details['classes'] = implode(' ', $classes);
} }
$processed[$extension] = $details; $processed[$extension] = $details;
} catch (Exception $e) { }
catch (Exception $e)
{
print "ERROR: '{$extension}' -- " . $e->getMessage() . "\n"; print "ERROR: '{$extension}' -- " . $e->getMessage() . "\n";
} }
} }
$code = "syn case match\n\n"; $code = "syn case match\n\n";
foreach ($processed as $extension) { foreach ($processed as $extension)
if (isset ($extension['constants'])) { {
if (isset ($extension['constants']))
{
$code = $code . '" ' . $extension['name'] . "\n"; $code = $code . '" ' . $extension['name'] . "\n";
$code = $code . 'syn keyword phpConstants ' . $extension['constants'] . " contained\n\n"; $code = $code . 'syn keyword phpConstants ' . $extension['constants'] . " contained\n\n";
} }
@ -153,12 +168,17 @@ foreach ($processed as $extension) {
$code = $code . "syn case ignore\n\n"; $code = $code . "syn case ignore\n\n";
foreach ($processed as $extension) { foreach ($processed as $extension)
{
$code = $code . '" ' . $extension['name'] . "\n"; $code = $code . '" ' . $extension['name'] . "\n";
if (isset ($extension['functions'])) {
if (isset ($extension['functions']))
{
$code = $code . 'syn keyword phpFunctions ' . $extension['functions'] . " contained\n"; $code = $code . 'syn keyword phpFunctions ' . $extension['functions'] . " contained\n";
} }
if (isset ($extension['classes'])) {
if (isset ($extension['classes']))
{
$code = $code . 'syn keyword phpClasses ' . $extension['classes'] . " contained\n\n"; $code = $code . 'syn keyword phpClasses ' . $extension['classes'] . " contained\n\n";
} }
} }
@ -168,3 +188,5 @@ file_put_contents(
str_replace('${code}', $code, file_get_contents(__DIR__ . '/syntax/php.template')), str_replace('${code}', $code, file_get_contents(__DIR__ . '/syntax/php.template')),
LOCK_EX LOCK_EX
); );
?>