Created
November 30, 2013 10:18
-
-
Save henry0312/7717364 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Make php.dict for neosnippet.vim | |
* | |
* Require: | |
* PHP 5.4 or later | |
* | |
* Usage: | |
* php make_php_dict.php > php.dict | |
* | |
* @see http://us.php.net/manual/en/reserved.keywords.php | |
* @see http://us.php.net/manual/en/function.get-defined-functions.php | |
* @see http://us.php.net/manual/en/function.get-defined-constants.php | |
* @see http://us.php.net/manual/en/function.get-declared-classes.php | |
* @see http://us.php.net/manual/en/function.get-declared-interfaces.php | |
* @see http://us.php.net/manual/en/function.get-declared-traits.php | |
*/ | |
$keywords = [ | |
'__halt_compiler', 'abstract', 'and', 'array', 'as', | |
'break', 'callable', 'case', 'catch', 'class', | |
'clone', 'const', 'continue', 'declare', 'default', | |
'die', 'do', 'echo', 'else', 'elseif', | |
'empty', 'enddeclare', 'endfor', 'endforeach', 'endif', | |
'endswitch', 'endwhile', 'eval', 'exit', 'extends', | |
'final', 'for', 'foreach', 'function', 'global', | |
'goto', 'if', 'implements', 'include', 'include_once', | |
'instanceof', 'insteadof', 'interface', 'isset', 'list', | |
'namespace', 'new', 'or', 'print', 'private', | |
'protected', 'public', 'require', 'require_once', 'return', | |
'static', 'switch', 'throw', 'trait', 'try', | |
'unset', 'use', 'var', 'while', 'xor', | |
'yield', | |
]; | |
$compile_time_constants = [ | |
'__CLASS__', '__DIR__', '__FILE__', '__FUNCTION__', '__LINE__', '__METHOD__', | |
'__NAMESPACE__', '__TRAIT__', | |
]; | |
$functions = get_defined_functions()['internal']; | |
$constants = array_keys( get_defined_constants() ); | |
$classes = get_declared_classes(); | |
$interfaces = get_declared_interfaces(); | |
$traits = get_declared_traits(); | |
$dict = array_merge( | |
$keywords, | |
$compile_time_constants, | |
$functions, | |
$constants, | |
$classes, | |
$interfaces, | |
$traits | |
); | |
sort($dict); | |
echo implode("\n", array_unique($dict)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment