[PHP] Update the list of PHP keywords - "cfunction" is no longer a

keyword in PHP5 and PHP 5.3 added "goto", "namespace", "__DIR__",
and "__NAMESPACE__".


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11368 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Olly Betts 2009-07-05 05:40:50 +00:00
commit 949ea9b580
3 changed files with 53 additions and 39 deletions

View file

@ -1,6 +1,11 @@
Version 1.3.40 (in progress) Version 1.3.40 (in progress)
============================ ============================
2009-07-05: olly
[PHP] Update the list of PHP keywords - "cfunction" is no longer a
keyword in PHP5 and PHP 5.3 added "goto", "namespace", "__DIR__",
and "__NAMESPACE__".
2009-07-03: olly 2009-07-03: olly
[Tcl] To complement USE_TCL_STUBS, add support for USE_TK_STUBS [Tcl] To complement USE_TCL_STUBS, add support for USE_TK_STUBS
and SWIG_TCL_STUBS_VERSION. Document all three in the Tcl chapter and SWIG_TCL_STUBS_VERSION. Document all three in the Tcl chapter

View file

@ -8,6 +8,9 @@
%warnfilter(SWIGWARN_RUBY_WRONG_NAME) Namespace::enum1; %warnfilter(SWIGWARN_RUBY_WRONG_NAME) Namespace::enum1;
%warnfilter(SWIGWARN_RUBY_WRONG_NAME) Namespace::enum2; %warnfilter(SWIGWARN_RUBY_WRONG_NAME) Namespace::enum2;
#ifdef SWIGPHP
%warnfilter(SWIGWARN_PARSE_KEYWORD) Namespace;
#endif
// Tests SWIG's automatic exception mechanism // Tests SWIG's automatic exception mechanism

View file

@ -8,21 +8,22 @@
* when used as class methods. * when used as class methods.
* ----------------------------------------------------------------------------- */ * ----------------------------------------------------------------------------- */
#define PHPKW(x) %keywordwarn("'" `x` "' is a php keyword, renamed as 'c_" `x` "'",sourcefmt="%(lower)s", rename="c_%s",fullname=1) `x` #define PHPKW(x) %keywordwarn("'" `x` "' is a PHP keyword, renamed as 'c_" `x` "'",sourcefmt="%(lower)s", rename="c_%s",fullname=1) `x`
%define PHPCN(x) %define PHPCN(x)
%keywordwarn("'" `x` "' is a php reserved class name, class renamed as 'c_" `x` "'",%$isclass,rename="c_%s") `x`; %keywordwarn("'" `x` "' is a PHP reserved class name, class renamed as 'c_" `x` "'",%$isclass,rename="c_%s") `x`;
%keywordwarn("'" `x` "' is a php reserved class name, constructor renamed as 'c_" `x` "'",%$isconstructor,rename="c_%s") `x`; %keywordwarn("'" `x` "' is a PHP reserved class name, constructor renamed as 'c_" `x` "'",%$isconstructor,rename="c_%s") `x`;
%enddef %enddef
#define PHPBN1(x) %builtinwarn("'" `x` "' conflicts with a built-in name in php",sourcefmt="%(lower)s",fullname=1) `x` #define PHPBN1(x) %builtinwarn("'" `x` "' conflicts with a built-in name in PHP",sourcefmt="%(lower)s",fullname=1) `x`
#define PHPBN2(x) %builtinwarn("'" `x` "' conflicts with a built-in name in php") "::" `x` #define PHPBN2(x) %builtinwarn("'" `x` "' conflicts with a built-in name in PHP") "::" `x`
/* /*
From From
http://aspn.activestate.com/ASPN/docs/PHP/reserved.html http://aspn.activestate.com/ASPN/docs/PHP/reserved.html
http://php.net/manual/en/reserved.keywords.php
and reviewed by Olly Betts. and reviewed by Olly Betts.
@ -30,76 +31,81 @@
*/ */
/* We classify these as kw since PHP will not run if used globally. */ /* We classify these as kw since PHP will not run if used globally. */
/* "You cannot use any of the following words as constants, class names,
* function or method names. Using them as variable names is generally OK, but
* could lead to confusion."
*/
/* case insensitive */ /* case insensitive */
PHPKW(__halt_compiler);
PHPKW(abstract);
PHPKW(and); PHPKW(and);
PHPKW(array); PHPKW(array);
PHPKW(as); PHPKW(as);
PHPKW(break); PHPKW(break);
PHPKW(case); PHPKW(case);
PHPKW(cfunction); /* No longer reserved in PHP5 */ PHPKW(catch);
PHPKW(class); PHPKW(class);
PHPKW(clone);
PHPKW(const); PHPKW(const);
PHPKW(continue); PHPKW(continue);
PHPKW(declare); PHPKW(declare);
PHPKW(default); PHPKW(default);
PHPKW(die); PHPKW(die); // "Language construct"
PHPKW(do); PHPKW(do);
PHPKW(echo); PHPKW(echo); // "Language construct"
PHPKW(else); PHPKW(else);
PHPKW(elseif); PHPKW(elseif);
PHPKW(empty); PHPKW(empty); // "Language construct"
PHPKW(enddeclare); PHPKW(enddeclare);
PHPKW(endfor); PHPKW(endfor);
PHPKW(endforeach); PHPKW(endforeach);
PHPKW(endif); PHPKW(endif);
PHPKW(endswitch); PHPKW(endswitch);
PHPKW(endwhile); PHPKW(endwhile);
PHPKW(eval); PHPKW(eval); // "Language construct"
PHPKW(exit); PHPKW(exit); // "Language construct"
PHPKW(extends); PHPKW(extends);
PHPKW(final);
PHPKW(for); PHPKW(for);
PHPKW(foreach); PHPKW(foreach);
PHPKW(function); PHPKW(function);
PHPKW(global); PHPKW(global);
PHPKW(goto); // As of PHP5.3
PHPKW(if); PHPKW(if);
PHPKW(include); PHPKW(implements);
PHPKW(include_once); PHPKW(include); // "Language construct"
PHPKW(isset); PHPKW(include_once); // "Language construct"
PHPKW(list); PHPKW(instanceof);
PHPKW(interface);
PHPKW(isset); // "Language construct"
PHPKW(list); // "Language construct"
PHPKW(namespace); // As of PHP5.3
PHPKW(new); PHPKW(new);
// PHPKW(old_function); /* No longer reserved in PHP5 */
PHPKW(or); PHPKW(or);
PHPKW(print); PHPKW(print); // "Language construct"
PHPKW(require); PHPKW(private);
PHPKW(require_once); PHPKW(protected);
PHPKW(return); PHPKW(public);
PHPKW(require); // "Language construct"
PHPKW(require_once); // "Language construct"
PHPKW(return); // "Language construct"
PHPKW(static); PHPKW(static);
PHPKW(switch); PHPKW(switch);
PHPKW(unset); PHPKW(throw);
PHPKW(try);
PHPKW(unset); // "Language construct"
PHPKW(use); PHPKW(use);
PHPKW(var); PHPKW(var);
PHPKW(while); PHPKW(while);
PHPKW(xor); PHPKW(xor);
PHPKW(__FILE__); // Compile-time constants
PHPKW(__LINE__);
PHPKW(__FUNCTION__);
PHPKW(__CLASS__); PHPKW(__CLASS__);
PHPKW(__DIR__); // As of PHP5.3
/* Added in PHP5 */ PHPKW(__FILE__);
PHPKW(__halt_compiler); PHPKW(__FUNCTION__);
PHPKW(abstract);
PHPKW(catch);
PHPKW(clone);
PHPKW(final);
PHPKW(implements);
PHPKW(instanceof);
PHPKW(interface);
PHPKW(private);
PHPKW(protected);
PHPKW(public);
PHPKW(throw);
PHPKW(try);
PHPKW(__METHOD__); PHPKW(__METHOD__);
PHPKW(__NAMESPACE__); // As of PHP5.3
PHPKW(__LINE__);
/* We classify these as built-in names since they conflict, but PHP still runs */ /* We classify these as built-in names since they conflict, but PHP still runs */