diff options
author | Bram Moolenaar <Bram@vim.org> | 2006-03-11 21:38:31 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2006-03-11 21:38:31 +0000 |
commit | e48ec1fa6bf564f210131ae14767af4f9419ec66 (patch) | |
tree | 10dd74de4d8e4aa56b633c157cfc60b32370d130 /runtime/autoload/phpcomplete.vim | |
parent | a5b6ad13efe36a94adccbc5c844903bf74dc3f05 (diff) |
updated for version 7.0221v7.0221
Diffstat (limited to 'runtime/autoload/phpcomplete.vim')
-rw-r--r-- | runtime/autoload/phpcomplete.vim | 3325 |
1 files changed, 2302 insertions, 1023 deletions
diff --git a/runtime/autoload/phpcomplete.vim b/runtime/autoload/phpcomplete.vim index 4c6811c2b7..2ba7a4d80a 100644 --- a/runtime/autoload/phpcomplete.vim +++ b/runtime/autoload/phpcomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: PHP " Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl ) -" Last Change: 2006 Mar 5 +" Last Change: 2006 Mar 9 " " " - outside of <?php?> getting parent tag may cause problems. Heh, even in @@ -15,8 +15,8 @@ function! phpcomplete#CompletePHP(findstart, base) unlet! b:php_menu " Check if we are inside of PHP markup let pos = getpos('.') - let phpbegin = searchpairpos('<?', '', '?>', 'bWn','synIDattr(synID(line("."), col("."), 0), "name") =~? "string"') - let phpend = searchpairpos('<?', '', '?>', 'Wn','synIDattr(synID(line("."), col("."), 0), "name") =~? "string"') + let phpbegin = searchpairpos('<?', '', '?>', 'bWn','synIDattr(synID(line("."), col("."), 0), "name") =~? "string\|comment"') + let phpend = searchpairpos('<?', '', '?>', 'Wn','synIDattr(synID(line("."), col("."), 0), "name") =~? "string\|comment"') " TODO: deal with opened <? but without closing ?> if phpbegin == [0,0] && phpend == [0,0] @@ -26,9 +26,7 @@ function! phpcomplete#CompletePHP(findstart, base) let base = getline('.')[htmlbegin : cursor_col] let b:php_menu = htmlcomplete#CompleteTags(0, base) return htmlbegin - "elseif phpbegin[0] < pos[1] || phpbegin[0] == pos[1] && phpbegin[1] < pos[2] else - " locate the start of the word let line = getline('.') let start = col('.') - 1 @@ -41,7 +39,7 @@ function! phpcomplete#CompletePHP(findstart, base) return start " We can be also inside of phpString with HTML tags. Deal with - " it later. + " it later (time, not lines). endif else " If exists b:php_menu it means completion was already constructed we @@ -58,19 +56,192 @@ function! phpcomplete#CompletePHP(findstart, base) unlet! b:compl_context endif + let scontext = substitute(context, '\$\?[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*$', '', '') + + if scontext =~ 'new\s*$' + " Complete class name + " Internal solution for finding classes in current file. + let file = getline(1, '$') + call filter(file, 'v:val =~ "class\\s\\+[a-zA-Z_\\x7f-\\xff][a-zA-Z_0-9\\x7f-\\xff]*\\s*("') + let fnames = join(map(tagfiles(), 'escape(v:val, " \\")')) + let jfile = join(file, ' ') + let int_values = split(jfile, 'class\s\+') + let int_classes = {} + for i in int_values + let c_name = matchstr(i, '^[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*') + let int_classes[c_name] = '' + endfor + + " Prepare list of functions from tags file + let ext_classes = {} + let fnames = join(map(tagfiles(), 'escape(v:val, " \\")')) + if fnames != '' + exe 'silent! vimgrep /^'.a:base.'.*\tc\(\t\|$\)/j '.fnames + let qflist = getqflist() + for field in qflist + let item = matchstr(field['text'], '^[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*') + " Don't show name - in PHP classes usually are in their + " own files, showing names will only add clutter + " let fname = matchstr(field['text'], + " \ '^[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\s\+\zs\f\+\ze') + let ext_classes[item] = '' + endfor + endif + + call extend(int_classes, ext_classes) + + for m in sort(keys(int_classes)) + if m =~ '^'.a:base + call add(res, m) + elseif m =~ a:base + call add(res2, m) + endif + endfor + + let int_list = res + res2 + + let final_menu = [] + for i in int_list + let final_menu += [{'word':i, 'menu':int_classes[i]}, 'kind':'c'] + endfor + + return final_menu + + elseif scontext =~ '\(->\|::\)$' + " Complete user functions and variables + " Internal solution for current file. + " That seems as unnecessary repeating of functions but there are + " few not so subtle differences as not appeding of $ and addition + " of 'kind' tag (not necessary in regular completion) + let file = getline(1, '$') + let jfile = join(file, ' ') + let int_vals = split(jfile, '\$') + "call map(int_values, 'matchstr(v:val, "^[a-zA-Z_\\x7f-\\xff][a-zA-Z_0-9\\x7f-\\xff]*")') + let int_values = [] + for i in int_vals + if i =~ '^\$[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\s*=\s*new' + let val = matchstr(i, '^\$[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*').'->' + else + let val = matchstr(i, '^\$[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*') + endif + let int_values += [val] + endfor + + let int_vars = {} + for i in int_values + if i != '' + let int_vars[i] = '' + endif + endfor + + " ctags has good support for PHP, use tags file for external + " variables + let fnames = join(map(tagfiles(), 'escape(v:val, " \\")')) + let ext_vars = {} + if fnames != '' + let sbase = substitute(a:base, '^\$', '', '') + exe 'silent! vimgrep /^'.sbase.'.*\tv\(\t\|$\)/j '.fnames + let qflist = getqflist() + for field in qflist + " Add space to make more space between 'word' and 'menu' + let item = matchstr(field['text'], '^\zs[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\ze') + " Filename is unnecessary - and even darkens situation + " let fname = ' '.matchstr(field['text'], '^[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\s\+\zs\f\+\ze') + " Add -> if it is possible object declaration + if field['text'] =~ item.'\s*=\s*new\s*' + let item = item.'->' + let classname = matchstr(field['text'], + \ '=\s*new\s*\zs[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\ze') + endif + let ext_vars[item] = classname + endfor + endif + + " Now we have all variables in int_vars dictionary + call extend(int_vars, ext_vars) + + " Internal solution for finding functions in current file. + let file = getline(1, '$') + call filter(file, 'v:val =~ "function\\s\\+&\\?[a-zA-Z_\\x7f-\\xff][a-zA-Z_0-9\\x7f-\\xff]*\\s*("') + let fnames = join(map(tagfiles(), 'escape(v:val, " \\")')) + let jfile = join(file, ' ') + let int_values = split(jfile, 'function\s\+') + let int_functions = {} + for i in int_values + let f_name = matchstr(i, '^&\?\zs[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\ze') + let f_args = matchstr(i, '^&\?[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\s*(\zs.\{-}\ze)') + let int_functions[f_name.'('] = f_args + endfor + + " Prepare list of functions from tags file + let ext_functions = {} + if fnames != '' + exe 'silent! vimgrep /^'.a:base.'.*\tf\(\t\|$\)/j '.fnames + let qflist = getqflist() + let ext_functions = {} + for field in qflist + " File name + let item = matchstr(field['text'], '^[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*') + let fname = matchstr(field['text'], '^[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\s\+\zs\f\+\ze') + let prototype = matchstr(field['text'], 'function\s\+[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\s*(\zs.\{-}\ze)') + if prototype == '' + let prototype = '()' + endif + let ext_functions[item.'('] = prototype.' - '.fname + endfor + endif + + let all_values = {} + call extend(all_values, int_functions) + call extend(all_values, ext_functions) + call extend(all_values, int_vars) + + for m in sort(keys(all_values)) + if m =~ '^'.a:base + call add(res, m) + elseif m =~ a:base + call add(res2, m) + endif + endfor + + let start_list = res + res2 + + let final_list = [] + for i in start_list + if has_key(int_vars, i) + let final_list += [{'word':i, 'menu':all_values[i], 'kind':'v'}] + else + let final_list += [{'word':i, 'menu':all_values[i], 'kind':'f'}] + endif + endfor + + return final_list + endif + if a:base =~ '^\$' " Complete variables let b:php_builtin_vars = ['$GLOBALS', '$_SERVER', '$_GET', '$_POST', '$_COOKIE', \ '$_FILES', '$_ENV', '$_REQUEST', '$_SESSION', '$HTTP_SERVER_VARS', \ '$HTTP_ENV_VARS', '$HTTP_COOKIE_VARS', '$HTTP_GET_VARS', '$HTTP_POST_VARS', - \ '$HTTP_POST_FILES', '$HTTP_SESSION_VARS', '$php_errormsg' + \ '$HTTP_POST_FILES', '$HTTP_SESSION_VARS', '$php_errormsg', '$this', \ ] " Internal solution for current file. let file = getline(1, '$') let jfile = join(file, ' ') - let int_values = split(jfile, '\ze\$') - call map(int_values, 'matchstr(v:val, "^\\$[a-zA-Z_\\x7f-\\xff][a-zA-Z_0-9\\x7f-\\xff]*")') + let int_vals = split(jfile, '\ze\$') + " call map(int_values, 'matchstr(v:val, "^\\$[a-zA-Z_\\x7f-\\xff][a-zA-Z_0-9\\x7f-\\xff]*")') + let int_values = [] + for i in int_vals + if i =~ '^\$[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\s*=\s*new' + let val = matchstr(i, '^\$[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*').'->' + else + let val = matchstr(i, '^\$[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*') + endif + let int_values += [val] + endfor + + "call map(int_values, '"$".v:val') " let int_values += b:php_builtin_vars @@ -88,7 +259,7 @@ function! phpcomplete#CompletePHP(findstart, base) let int_dict = [] for i in int_list - let int_dict += [{'word':i}] + let int_dict += [{'word':i, 'kind':'v'}] endfor " ctags has good support for PHP, use tags file for external @@ -100,11 +271,21 @@ function! phpcomplete#CompletePHP(findstart, base) let qflist = getqflist() let ext_dict = [] for field in qflist - " Add space to make more space between 'word' and 'menu' - let m_menu = ' '.matchstr(field['text'], '^[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\s\+\zs\f\+\ze') - let item = '$'.matchstr(field['text'], '^\zs[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\ze') + " Filename is unnecessary - and even darkens situation + " let m_menu = matchstr(field['text'], + " \ '^[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\s\+\zs\f\+\ze') + let m_menu = '' + let item = '$'.matchstr(field['text'], + \ '^\zs[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\ze') + " Add -> if it is possible object declaration + if field['text'] =~ item.'\s*=\s*new\s*' + let item = item.'->' + let classname = matchstr(field['text'], + \ '=\s*new\s*\zs[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\ze') + let m_menu = classname + endif - let ext_dict += [{'word':item, 'menu':m_menu}] + let ext_dict += [{'word':item, 'menu':m_menu, 'kind':'v'}] endfor else let ext_dict = [] @@ -112,19 +293,24 @@ function! phpcomplete#CompletePHP(findstart, base) let b:php_menu = int_dict + ext_dict + return b:php_menu + else " Complete everything else - " + functions, DONE " + keywords of language DONE - " - classes (after new), - " - defines (constant definitions), + " + defines (constant definitions), DONE + " + extend keywords for predefined constants, DONE + " + classes (after new), DONE + " - limit choice after -> and :: to funcs and vars if !exists('b:php_builtin_functions') call phpcomplete#LoadData() endif - " Internal solution for current file. + " Internal solution for finding functions in current file. let file = getline(1, '$') - call filter(file, 'v:val =~ "function [a-zA-Z_\\x7f-\\xff][a-zA-Z_0-9\\x7f-\\xff]*\\s*("') + call filter(file, 'v:val =~ "function\\s\\+&\\?[a-zA-Z_\\x7f-\\xff][a-zA-Z_0-9\\x7f-\\xff]*\\s*("') + let fnames = join(map(tagfiles(), 'escape(v:val, " \\")')) let jfile = join(file, ' ') let int_values = split(jfile, 'function\s\+') let int_functions = {} @@ -134,125 +320,75 @@ function! phpcomplete#CompletePHP(findstart, base) let int_functions[f_name.'('] = f_args endfor - " Prepare list from tags file - let fnames = join(map(tagfiles(), 'escape(v:val, " \\")')) - if fnames != '' + " Prepare list of functions from tags file + let ext_functions = {} + if fnames != '' exe 'silent! vimgrep /^'.a:base.'.*\tf\(\t\|$\)/j '.fnames let qflist = getqflist() - let ext_funcs = {} for field in qflist " File name let item = matchstr(field['text'], '^[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*') let fname = matchstr(field['text'], '^[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\s\+\zs\f\+\ze') let prototype = matchstr(field['text'], 'function\s\+[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\s*(\zs.\{-}\ze)') - let ext_funcs[item.'('] = prototype.' - '.fname + if prototype == '' + let prototype = '()' + endif + let ext_functions[item.'('] = prototype.' - '.fname endfor - else - let ext_funcs = {} endif - " Keywords/reserved words, all other special things {{{ - " Later it is possible to add some help to values - let keywords = { - \ 'PHP_SELF':'', - \ 'argv':'', - \ 'argc':'', - \ 'GATEWAY_INTERFACE':'', - \ 'SERVER_ADDR':'', - \ 'SERVER_NAME':'', - \ 'SERVER_SOFTWARE':'', - \ 'SERVER_PROTOCOL':'', - \ 'REQUEST_METHOD':'', - \ 'REQUEST_TIME':'', - \ 'QUERY_STRING':'', - \ 'DOCUMENT_ROOT':'', - \ 'HTTP_ACCEPT':'', - \ 'HTTP_ACCEPT_CHARSET':'', - \ 'HTTP_ACCEPT_ENCODING':'', - \ 'HTTP_ACCEPT_LANGUAGE':'', - \ 'HTTP_CONNECTION':'', - \ 'HTTP_POST':'', - \ 'HTTP_REFERER':'', - \ 'HTTP_USER_AGENT':'', - \ 'HTTPS':'', - \ 'REMOTE_ADDR':'', - \ 'REMOTE_HOST':'', - \ 'REMOTE_PORT':'', - \ 'SCRIPT_FILENAME':'', - \ 'SERVER_ADMIN':'', - \ 'SERVER_PORT':'', - \ 'SERVER_SIGNATURE':'', - \ 'PATH_TRANSLATED':'', - \ 'SCRIPT_NAME':'', - \ 'REQUEST_URI':'', - \ 'PHP_AUTH_DIGEST':'', - \ 'PHP_AUTH_USER':'', - \ 'PHP_AUTH_PW':'', - \ 'AUTH_TYPE':'', - \ 'and':'', - \ 'or':'', - \ 'xor':'', - \ '__FILE__':'', - \ 'exception':'', - \ '__LINE__':'', - \ 'as':'', - \ 'break':'', - \ 'case':'', - \ 'class':'', - \ 'const':'', - \ 'continue':'', - \ 'declare':'', - \ 'default':'', - \ 'do':'', - \ 'else':'', - \ 'elseif':'', - \ 'enddeclare':'', - \ 'endfor':'', - \ 'endforeach':'', - \ 'endif':'', - \ 'endswitch':'', - \ 'endwhile':'', - \ 'extends':'', - \ 'for':'', - \ 'foreach':'', - \ 'function':'', - \ 'global':'', - \ 'if':'', - \ 'new':'', - \ 'static':'', - \ 'switch':'', - \ 'use':'', - \ 'var':'', - \ 'while':'', - \ '__FUNCTION__':'', - \ '__CLASS__':'', - \ '__METHOD__':'', - \ 'final':'', - \ 'php_user_filter':'', - \ 'interface':'', - \ 'implements':'', - \ 'public':'', - \ 'private':'', - \ 'protected':'', - \ 'abstract':'', - \ 'clone':'', - \ 'try':'', - \ 'catch':'', - \ 'throw':'', - \ 'cfunction':'', - \ 'old_function':'', - \ 'this':'' - \ } - " }}} - - - " One big dictionary + " All functions + call extend(int_functions, ext_functions) call extend(int_functions, b:php_builtin_functions) - call extend(int_functions, ext_funcs) - call extend(int_functions, keywords) - let g:fi = copy(int_functions) - for m in sort(keys(int_functions)) + " Internal solution for finding constants in current file + let file = getline(1, '$') + call filter(file, 'v:val =~ "define\\s*("') + let jfile = join(file, ' ') + let int_values = split(jfile, 'define\s*(\s*') + let int_constants = {} + for i in int_values + let c_name = matchstr(i, '\(["'']\)\zs[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\ze\1') + " let c_value = matchstr(i, + " \ '\(["'']\)[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\1\s*,\s*\zs.\{-}\ze\s*)') + let int_constants[c_name] = '' " c_value + endfor + + " Prepare list of constants from tags file + let fnames = join(map(tagfiles(), 'escape(v:val, " \\")')) + let ext_constants = {} + if fnames != '' + exe 'silent! vimgrep /^'.a:base.'.*\td\(\t\|$\)/j '.fnames + let qflist = getqflist() + let ext_constants = {} + for field in qflist + " File name + let item = matchstr(field['text'], '^[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*') + " Origin of definition and value only are only darkening + " image - drop it but leave regexps. They may be needed in + " future. + " let fname = matchstr(field['text'], + " \ '^[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\s\+\zs\f\+\ze') + " let cvalue = matchstr(field['text'], + " \ 'define\s*(\s*\(["'']\)[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\1\s*,\s*\zs.\{-}\ze\s*)') + let ext_constants[item] = '' + endfor + endif + + " All constants + call extend(int_constants, ext_constants) + " Treat keywords as constants + call extend(int_constants, b:php_keywords) + + let all_values = {} + + " One big dictionary of functions + call extend(all_values, int_functions) + + " Add constants + call extend(all_values, int_constants) + + for m in sort(keys(all_values)) if m =~ '^'.a:base call add(res, m) elseif m =~ a:base @@ -262,35 +398,379 @@ function! phpcomplete#CompletePHP(findstart, base) let int_list = res + res2 - let other_list = [] + let final_list = [] for i in int_list - let other_list += [{'word':i, 'menu':int_functions[i]}] + if has_key(int_functions, i) + let final_list += [{'word':i, 'menu':int_functions[i], 'kind':'f'}] + elseif has_key(int_constants, i) + let final_list += [{'word':i, 'menu':int_constants[i], 'kind':'d'}] + else + let final_list += [{'word':i}] + endif endfor - let b:php_menu = other_list + return final_list endif - " Real completion - return b:php_menu endif endfunction function! phpcomplete#LoadData() " {{{ -let b:php_builtin_functions = -\ {'abs(': 'mixed number | number', -\ 'acos(': 'float arg | float', +" Keywords/reserved words, all other special things {{{ +" Later it is possible to add some help to values, or type of +" defined variable +let b:php_keywords = { +\ 'PHP_SELF':'', +\ 'argv':'', +\ 'argc':'', +\ 'GATEWAY_INTERFACE':'', +\ 'SERVER_ADDR':'', +\ 'SERVER_NAME':'', +\ 'SERVER_SOFTWARE':'', +\ 'SERVER_PROTOCOL':'', +\ 'REQUEST_METHOD':'', +\ 'REQUEST_TIME':'', +\ 'QUERY_STRING':'', +\ 'DOCUMENT_ROOT':'', +\ 'HTTP_ACCEPT':'', +\ 'HTTP_ACCEPT_CHARSET':'', +\ 'HTTP_ACCEPT_ENCODING':'', +\ 'HTTP_ACCEPT_LANGUAGE':'', +\ 'HTTP_CONNECTION':'', +\ 'HTTP_POST':'', +\ 'HTTP_REFERER':'', +\ 'HTTP_USER_AGENT':'', +\ 'HTTPS':'', +\ 'REMOTE_ADDR':'', +\ 'REMOTE_HOST':'', +\ 'REMOTE_PORT':'', +\ 'SCRIPT_FILENAME':'', +\ 'SERVER_ADMIN':'', +\ 'SERVER_PORT':'', +\ 'SERVER_SIGNATURE':'', +\ 'PATH_TRANSLATED':'', +\ 'SCRIPT_NAME':'', +\ 'REQUEST_URI':'', +\ 'PHP_AUTH_DIGEST':'', +\ 'PHP_AUTH_USER':'', +\ 'PHP_AUTH_PW':'', +\ 'AUTH_TYPE':'', +\ 'and':'', +\ 'or':'', +\ 'xor':'', +\ '__FILE__':'', +\ 'exception':'', +\ '__LINE__':'', +\ 'as':'', +\ 'break':'', +\ 'case':'', +\ 'class':'', +\ 'const':'', +\ 'continue':'', +\ 'declare':'', +\ 'default':'', +\ 'do':'', +\ 'echo':'', +\ 'else':'', +\ 'elseif':'', +\ 'enddeclare':'', +\ 'endfor':'', +\ 'endforeach':'', +\ 'endif':'', +\ 'endswitch':'', +\ 'endwhile':'', +\ 'extends':'', +\ 'for':'', +\ 'foreach':'', +\ 'function':'', +\ 'global':'', +\ 'if':'', +\ 'new':'', +\ 'static':'', +\ 'switch':'', +\ 'use':'', +\ 'var':'', +\ 'while':'', +\ '__FUNCTION__':'', +\ '__CLASS__':'', +\ '__METHOD__':'', +\ 'final':'', +\ 'php_user_filter':'', +\ 'interface':'', +\ 'implements':'', +\ 'public':'', +\ 'private':'', +\ 'protected':'', +\ 'abstract':'', +\ 'clone':'', +\ 'try':'', +\ 'catch':'', +\ 'throw':'', +\ 'cfunction':'', +\ 'old_function':'', +\ 'this':'', +\ 'PHP_VERSION': '', +\ 'PHP_OS': '', +\ 'PHP_SAPI': '', +\ 'PHP_EOL': '', +\ 'PHP_INT_MAX': '', +\ 'PHP_INT_SIZE': '', +\ 'DEFAULT_INCLUDE_PATH': '', +\ 'PEAR_INSTALL_DIR': '', +\ 'PEAR_EXTENSION_DIR': '', +\ 'PHP_EXTENSION_DIR': '', +\ 'PHP_PREFIX': '', +\ 'PHP_BINDIR': '', +\ 'PHP_LIBDIR': '', +\ 'PHP_DATADIR': '', +\ 'PHP_SYSCONFDIR': '', +\ 'PHP_LOCALSTATEDIR': '', +\ 'PHP_CONFIG_FILE_PATH': '', +\ 'PHP_CONFIG_FILE_SCAN_DIR': '', +\ 'PHP_SHLIB_SUFFIX': '', +\ 'PHP_OUTPUT_HANDLER_START': '', +\ 'PHP_OUTPUT_HANDLER_CONT': '', +\ 'PHP_OUTPUT_HANDLER_END': '', +\ 'E_ERROR': '', +\ 'E_WARNING': '', +\ 'E_PARSE': '', +\ 'E_NOTICE': '', +\ 'E_CORE_ERROR': '', +\ 'E_CORE_WARNING': '', +\ 'E_COMPILE_ERROR': '', +\ 'E_COMPILE_WARNING': '', +\ 'E_USER_ERROR': '', +\ 'E_USER_WARNING': '', +\ 'E_USER_NOTICE': '', +\ 'E_ALL': '', +\ 'E_STRICT': '', +\ '__COMPILER_HALT_OFFSET__': '', +\ 'EXTR_OVERWRITE': '', +\ 'EXTR_SKIP': '', +\ 'EXTR_PREFIX_SAME': '', +\ 'EXTR_PREFIX_ALL': '', +\ 'EXTR_PREFIX_INVALID': '', +\ 'EXTR_PREFIX_IF_EXISTS': '', +\ 'EXTR_IF_EXISTS': '', +\ 'SORT_ASC': '', +\ 'SORT_DESC': '', +\ 'SORT_REGULAR': '', +\ 'SORT_NUMERIC': '', +\ 'SORT_STRING': '', +\ 'CASE_LOWER': '', +\ 'CASE_UPPER': '', +\ 'COUNT_NORMAL': '', +\ 'COUNT_RECURSIVE': '', +\ 'ASSERT_ACTIVE': '', +\ 'ASSERT_CALLBACK': '', +\ 'ASSERT_BAIL': '', +\ 'ASSERT_WARNING': '', +\ 'ASSERT_QUIET_EVAL': '', +\ 'CONNECTION_ABORTED': '', +\ 'CONNECTION_NORMAL': '', +\ 'CONNECTION_TIMEOUT': '', +\ 'INI_USER': '', +\ 'INI_PERDIR': '', +\ 'INI_SYSTEM': '', +\ 'INI_ALL': '', +\ 'M_E': '', +\ 'M_LOG2E': '', +\ 'M_LOG10E': '', +\ 'M_LN2': '', +\ 'M_LN10': '', +\ 'M_PI': '', +\ 'M_PI_2': '', +\ 'M_PI_4': '', +\ 'M_1_PI': '', +\ 'M_2_PI': '', +\ 'M_2_SQRTPI': '', +\ 'M_SQRT2': '', +\ 'M_SQRT1_2': '', +\ 'CRYPT_SALT_LENGTH': '', +\ 'CRYPT_STD_DES': '', +\ 'CRYPT_EXT_DES': '', +\ 'CRYPT_MD5': '', +\ 'CRYPT_BLOWFISH': '', +\ 'DIRECTORY_SEPARATOR': '', +\ 'SEEK_SET': '', +\ 'SEEK_CUR': '', +\ 'SEEK_END': '', +\ 'LOCK_SH': '', +\ 'LOCK_EX': '', +\ 'LOCK_UN': '', +\ 'LOCK_NB': '', +\ 'HTML_SPECIALCHARS': '', +\ 'HTML_ENTITIES': '', +\ 'ENT_COMPAT': '', +\ 'ENT_QUOTES': '', +\ 'ENT_NOQUOTES': '', +\ 'INFO_GENERAL': '', +\ 'INFO_CREDITS': '', +\ 'INFO_CONFIGURATION': '', +\ 'INFO_MODULES': '', +\ 'INFO_ENVIRONMENT': '', +\ 'INFO_VARIABLES': '', +\ 'INFO_LICENSE': '', +\ 'INFO_ALL': '', +\ 'CREDITS_GROUP': '', +\ 'CREDITS_GENERAL': '', +\ 'CREDITS_SAPI': '', +\ 'CREDITS_MODULES': '', +\ 'CREDITS_DOCS': '', +\ 'CREDITS_FULLPAGE': '', +\ 'CREDITS_QA': '', +\ 'CREDITS_ALL': '', +\ 'STR_PAD_LEFT': '', +\ 'STR_PAD_RIGHT': '', +\ 'STR_PAD_BOTH': '', +\ 'PATHINFO_DIRNAME': '', +\ 'PATHINFO_BASENAME': '', +\ 'PATHINFO_EXTENSION': '', +\ 'PATH_SEPARATOR': '', +\ 'CHAR_MAX': '', +\ 'LC_CTYPE': '', +\ 'LC_NUMERIC': '', +\ 'LC_TIME': '', +\ 'LC_COLLATE': '', +\ 'LC_MONETARY': '', +\ 'LC_ALL': '', +\ 'LC_MESSAGES': '', +\ 'ABDAY_1': '', +\ 'ABDAY_2': '', +\ 'ABDAY_3': '', +\ 'ABDAY_4': '', +\ 'ABDAY_5': '', +\ 'ABDAY_6': '', +\ 'ABDAY_7': '', +\ 'DAY_1': '', +\ 'DAY_2': '', +\ 'DAY_3': '', +\ 'DAY_4': '', +\ 'DAY_5': '', +\ 'DAY_6': '', +\ 'DAY_7': '', +\ 'ABMON_1': '', +\ 'ABMON_2': '', +\ 'ABMON_3': '', +\ 'ABMON_4': '', +\ 'ABMON_5': '', +\ 'ABMON_6': '', +\ 'ABMON_7': '', +\ 'ABMON_8': '', +\ 'ABMON_9': '', +\ 'ABMON_10': '', +\ 'ABMON_11': '', +\ 'ABMON_12': '', +\ 'MON_1': '', +\ 'MON_2': '', +\ 'MON_3': '', +\ 'MON_4': '', +\ 'MON_5': '', +\ 'MON_6': '', +\ 'MON_7': '', +\ 'MON_8': '', +\ 'MON_9': '', +\ 'MON_10': '', +\ 'MON_11': '', +\ 'MON_12': '', +\ 'AM_STR': '', +\ 'PM_STR': '', +\ 'D_T_FMT': '', +\ 'D_FMT': '', +\ 'T_FMT': '', +\ 'T_FMT_AMPM': '', +\ 'ERA': '', +\ 'ERA_YEAR': '', +\ 'ERA_D_T_FMT': '', +\ 'ERA_D_FMT': '', +\ 'ERA_T_FMT': '', +\ 'ALT_DIGITS': '', +\ 'INT_CURR_SYMBOL': '', +\ 'CURRENCY_SYMBOL': '', +\ 'CRNCYSTR': '', +\ 'MON_DECIMAL_POINT': '', +\ 'MON_THOUSANDS_SEP': '', +\ 'MON_GROUPING': '', +\ 'POSITIVE_SIGN': '', +\ 'NEGATIVE_SIGN': '', +\ 'INT_FRAC_DIGITS': '', +\ 'FRAC_DIGITS': '', +\ 'P_CS_PRECEDES': '', +\ 'P_SEP_BY_SPACE': '', +\ 'N_CS_PRECEDES': '', +\ 'N_SEP_BY_SPACE': '', +\ 'P_SIGN_POSN': '', +\ 'N_SIGN_POSN': '', +\ 'DECIMAL_POINT': '', +\ 'RADIXCHAR': '', +\ 'THOUSANDS_SEP': '', +\ 'THOUSEP': '', +\ 'GROUPING': '', +\ 'YESEXPR': '', +\ 'NOEXPR': '', +\ 'YESSTR': '', +\ 'NOSTR': '', +\ 'CODESET': '', +\ 'LOG_EMERG': '', +\ 'LOG_ALERT': '', +\ 'LOG_CRIT': '', +\ 'LOG_ERR': '', +\ 'LOG_WARNING': '', +\ 'LOG_NOTICE': '', +\ 'LOG_INFO': '', +\ 'LOG_DEBUG': '', +\ 'LOG_KERN': '', +\ 'LOG_USER': '', +\ 'LOG_MAIL': '', +\ 'LOG_DAEMON': '', +\ 'LOG_AUTH': '', +\ 'LOG_SYSLOG': '', +\ 'LOG_LPR': '', +\ 'LOG_NEWS': '', +\ 'LOG_UUCP': '', +\ 'LOG_CRON': '', +\ 'LOG_AUTHPRIV': '', +\ 'LOG_LOCAL0': '', +\ 'LOG_LOCAL1': '', +\ 'LOG_LOCAL2': '', +\ 'LOG_LOCAL3': '', +\ 'LOG_LOCAL4': '', +\ 'LOG_LOCAL5': '', +\ 'LOG_LOCAL6': '', +\ 'LOG_LOCAL7': '', +\ 'LOG_PID': '', +\ 'LOG_CONS': '', +\ 'LOG_ODELAY': '', +\ 'LOG_NDELAY': '', +\ 'LOG_NOWAIT': '', +\ 'LOG_PERROR': '', +\ } +" }}} +" PHP builtin functions {{{ +" To create from scratch list of functions: +" 1. Download multi html file PHP documentation +" 2. run for i in `ls | grep "^function\."`; do grep -A4 Description $i >> funcs; done +" 3. Open funcs in Vim and +" a) g/Description/normal! 5J +" b) remove all html tags (it will require few s/// and g//) +" c) :%s/^\([^[:space:]]\+\) \([^[:space:]]\+\) ( \(.*\))/\\ '\2(': '\3| \1', +" This will create Dictionary +" d) remove all /^[^\\] lines +let b:php_builtin_functions = { +\ 'abs(': 'mixed number | number', \ 'acosh(': 'float arg | float', +\ 'acos(': 'float arg | float', \ 'addcslashes(': 'string str, string charlist | string', \ 'addslashes(': 'string str | string', \ 'aggregate(': 'object object, string class_name | void', \ 'aggregate_info(': 'object object | array', -\ 'aggregate_methods(': 'object object, string class_name | void', \ 'aggregate_methods_by_list(': 'object object, string class_name, array methods_list [, bool exclude] | void', \ 'aggregate_methods_by_regexp(': 'object object, string class_name, string regexp [, bool exclude] | void', -\ 'aggregate_properties(': 'object object, string class_name | void', +\ 'aggregate_methods(': 'object object, string class_name | void', \ 'aggregate_properties_by_list(': 'object object, string class_name, array properties_list [, bool exclude] | void', \ 'aggregate_properties_by_regexp(': 'object object, string class_name, string regexp [, bool exclude] | void', +\ 'aggregate_properties(': 'object object, string class_name | void', \ 'apache_child_terminate(': 'void | bool', \ 'apache_getenv(': 'string variable [, bool walk_to_top] | string', \ 'apache_get_modules(': 'void | array', @@ -300,81 +780,104 @@ let b:php_builtin_functions = \ 'apache_request_headers(': 'void | array', \ 'apache_reset_timeout(': 'void | bool', \ 'apache_response_headers(': 'void | array', -\ 'apache_setenv(': 'string variable, string value [, bool walk_to_top] | int', -\ 'apd_breakpoint(': 'int debug_level | void', +\ 'apache_setenv(': 'string variable, string value [, bool walk_to_top] | bool', +\ 'apc_cache_info(': '[string cache_type] | array', +\ 'apc_clear_cache(': '[string cache_type] | bool', +\ 'apc_define_constants(': 'string key, array constants [, bool case_sensitive] | bool', +\ 'apc_delete(': 'string key | bool', +\ 'apc_fetch(': 'string key | mixed', +\ 'apc_load_constants(': 'string key [, bool case_sensitive] | bool', +\ 'apc_sma_info(': 'void | array', +\ 'apc_store(': 'string key, mixed var [, int ttl] | bool', +\ 'apd_breakpoint(': 'int debug_level | bool', \ 'apd_callstack(': 'void | array', \ 'apd_clunk(': 'string warning [, string delimiter] | void', -\ 'apd_continue(': 'int debug_level | void', +\ 'apd_continue(': 'int debug_level | bool', \ 'apd_croak(': 'string warning [, string delimiter] | void', \ 'apd_dump_function_table(': 'void | void', \ 'apd_dump_persistent_resources(': 'void | array', \ 'apd_dump_regular_resources(': 'void | array', -\ 'apd_echo(': 'string output | void', +\ 'apd_echo(': 'string output | bool', \ 'apd_get_active_symbols(': ' | array', \ 'apd_set_pprof_trace(': '[string dump_directory] | void', \ 'apd_set_session(': 'int debug_level | void', \ 'apd_set_session_trace(': 'int debug_level [, string dump_directory] | void', \ 'apd_set_socket_session_trace(': 'string ip_address_or_unix_socket_file, int socket_type, int port, int debug_level | bool', -\ 'array(': '[mixed ...] | array', \ 'array_change_key_case(': 'array input [, int case] | array', \ 'array_chunk(': 'array input, int size [, bool preserve_keys] | array', \ 'array_combine(': 'array keys, array values | array', \ 'array_count_values(': 'array input | array', -\ 'array_diff(': 'array array1, array array2 [, array ...] | array', \ 'array_diff_assoc(': 'array array1, array array2 [, array ...] | array', +\ 'array_diff(': 'array array1, array array2 [, array ...] | array', \ 'array_diff_key(': 'array array1, array array2 [, array ...] | array', \ 'array_diff_uassoc(': 'array array1, array array2 [, array ..., callback key_compare_func] | array', \ 'array_diff_ukey(': 'array array1, array array2 [, array ..., callback key_compare_func] | array', \ 'array_fill(': 'int start_index, int num, mixed value | array', \ 'array_filter(': 'array input [, callback callback] | array', \ 'array_flip(': 'array trans | array', -\ 'array_intersect(': 'array array1, array array2 [, array ...] | array', +\ 'array(': '[mixed ...] | array', \ 'array_intersect_assoc(': 'array array1, array array2 [, array ...] | array', +\ 'array_intersect(': 'array array1, array array2 [, array ...] | array', \ 'array_intersect_key(': 'array array1, array array2 [, array ...] | array', \ 'array_intersect_uassoc(': 'array array1, array array2 [, array ..., callback key_compare_func] | array', \ 'array_intersect_ukey(': 'array array1, array array2 [, array ..., callback key_compare_func] | array', +\ 'ArrayIterator::current(': 'void | mixed', +\ 'ArrayIterator::key(': 'void | mixed', +\ 'ArrayIterator::next(': 'void | void', +\ 'ArrayIterator::rewind(': 'void | void', +\ 'ArrayIterator::seek(': 'int position | void', +\ 'ArrayIterator::valid(': 'void | bool', \ 'array_key_exists(': 'mixed key, array search | bool', \ 'array_keys(': 'array input [, mixed search_value [, bool strict]] | array', \ 'array_map(': 'callback callback, array arr1 [, array ...] | array', \ 'array_merge(': 'array array1 [, array array2 [, array ...]] | array', -\ 'array_merge_recursive(': 'array array1, array array2 [, array ...] | array', +\ 'array_merge_recursive(': 'array array1 [, array ...] | array', \ 'array_multisort(': 'array ar1 [, mixed arg [, mixed ... [, array ...]]] | bool', +\ 'ArrayObject::append(': 'mixed newval | void', +\ 'ArrayObject::__construct(': 'mixed input | ArrayObject', +\ 'ArrayObject::count(': 'void | int', +\ 'ArrayObject::getIterator(': 'void | ArrayIterator', +\ 'ArrayObject::offsetExists(': 'mixed index | bool', +\ 'ArrayObject::offsetGet(': 'mixed index | bool', +\ 'ArrayObject::offsetSet(': 'mixed index, mixed newval | void', +\ 'ArrayObject::offsetUnset(': 'mixed index | void', \ 'array_pad(': 'array input, int pad_size, mixed pad_value | array', -\ 'array_pop(': 'array &array | mixed', -\ 'array_push(': 'array &array, mixed var [, mixed ...] | int', +\ 'array_pop(': 'array &array | mixed', +\ 'array_product(': 'array array | number', +\ 'array_push(': 'array &array, mixed var [, mixed ...] | int', \ 'array_rand(': 'array input [, int num_req] | mixed', \ 'array_reduce(': 'array input, callback function [, int initial] | mixed', \ 'array_reverse(': 'array array [, bool preserve_keys] | array', \ 'array_search(': 'mixed needle, array haystack [, bool strict] | mixed', -\ 'array_shift(': 'array &array | mixed', +\ 'array_shift(': 'array &array | mixed', \ 'array_slice(': 'array array, int offset [, int length [, bool preserve_keys]] | array', -\ 'array_splice(': 'array &input, int offset [, int length [, array replacement]] | array', +\ 'array_splice(': 'array &input, int offset [, int length [, array replacement]] | array', \ 'array_sum(': 'array array | number', -\ 'array_udiff(': 'array array1, array array2 [, array ..., callback data_compare_func] | array', \ 'array_udiff_assoc(': 'array array1, array array2 [, array ..., callback data_compare_func] | array', +\ 'array_udiff(': 'array array1, array array2 [, array ..., callback data_compare_func] | array', \ 'array_udiff_uassoc(': 'array array1, array array2 [, array ..., callback data_compare_func, callback key_compare_func] | array', -\ 'array_uintersect(': 'array array1, array array2 [, array ..., callback data_compare_func] | array', \ 'array_uintersect_assoc(': 'array array1, array array2 [, array ..., callback data_compare_func] | array', +\ 'array_uintersect(': 'array array1, array array2 [, array ..., callback data_compare_func] | array', \ 'array_uintersect_uassoc(': 'array array1, array array2 [, array ..., callback data_compare_func, callback key_compare_func] | array', \ 'array_unique(': 'array array | array', -\ 'array_unshift(': 'array &array, mixed var [, mixed ...] | int', +\ 'array_unshift(': 'array &array, mixed var [, mixed ...] | int', \ 'array_values(': 'array input | array', -\ 'array_walk(': 'array &array, callback funcname [, mixed userdata] | bool', -\ 'array_walk_recursive(': 'array &input, callback funcname [, mixed userdata] | bool', -\ 'arsort(': 'array &array [, int sort_flags] | bool', +\ 'array_walk(': 'array &array, callback funcname [, mixed userdata] | bool', +\ 'array_walk_recursive(': 'array &input, callback funcname [, mixed userdata] | bool', +\ 'arsort(': 'array &array [, int sort_flags] | bool', \ 'ascii2ebcdic(': 'string ascii_str | int', -\ 'asin(': 'float arg | float', \ 'asinh(': 'float arg | float', -\ 'asort(': 'array &array [, int sort_flags] | bool', +\ 'asin(': 'float arg | float', +\ 'asort(': 'array &array [, int sort_flags] | bool', \ 'aspell_check(': 'int dictionary_link, string word | bool', \ 'aspell_check_raw(': 'int dictionary_link, string word | bool', \ 'aspell_new(': 'string master [, string personal] | int', \ 'aspell_suggest(': 'int dictionary_link, string word | array', -\ 'assert(': 'mixed assertion | int', +\ 'assert(': 'mixed assertion | bool', \ 'assert_options(': 'int what [, mixed value] | mixed', -\ 'atan(': 'float arg | float', \ 'atan2(': 'float y, float x | float', \ 'atanh(': 'float arg | float', +\ 'atan(': 'float arg | float', \ 'base64_decode(': 'string encoded_data | string', \ 'base64_encode(': 'string data | string', \ 'base_convert(': 'string number, int frombase, int tobase | string', @@ -384,8 +887,8 @@ let b:php_builtin_functions = \ 'bcdiv(': 'string left_operand, string right_operand [, int scale] | string', \ 'bcmod(': 'string left_operand, string modulus | string', \ 'bcmul(': 'string left_operand, string right_operand [, int scale] | string', -\ 'bcompiler_load(': 'string filename | bool', \ 'bcompiler_load_exe(': 'string filename | bool', +\ 'bcompiler_load(': 'string filename | bool', \ 'bcompiler_parse_class(': 'string class, string callback | bool', \ 'bcompiler_read(': 'resource filehandle | bool', \ 'bcompiler_write_class(': 'resource filehandle, string className [, string extends] | bool', @@ -403,11 +906,11 @@ let b:php_builtin_functions = \ 'bcsub(': 'string left_operand, string right_operand [, int scale] | string', \ 'bin2hex(': 'string str | string', \ 'bindec(': 'string binary_string | number', -\ 'bindtextdomain(': 'string domain, string directory | string', \ 'bind_textdomain_codeset(': 'string domain, string codeset | string', +\ 'bindtextdomain(': 'string domain, string directory | string', \ 'bzclose(': 'resource bz | int', -\ 'bzcompress(': 'string source [, int blocksize [, int workfactor]] | string', -\ 'bzdecompress(': 'string source [, int small] | string', +\ 'bzcompress(': 'string |