[PHP] Add new PHP 8.1 keyword
Add PHP keyword 'readonly' (added in 8.1) to the list SWIG knows to automatically rename. This keyword is special in that PHP allows it to be used as a function (or method) name.
This commit is contained in:
parent
6f016f3a38
commit
7d75e3eb7e
3 changed files with 28 additions and 0 deletions
|
|
@ -5,6 +5,9 @@
|
|||
/* Keyword (case insensitive) */
|
||||
#define PHPKW(x) %keywordwarn("'" `x` "' is a PHP keyword, renaming to 'c_" `x` "'",sourcefmt="%(lower)s",rename="c_%s") `x`
|
||||
|
||||
/* Keyword, except ok as a function */
|
||||
#define PHPKW_ok_as_function(x) %keywordwarn("'" `x` "' is a PHP keyword, renaming to 'c_" `x` "'",%$not %$isfunction,sourcefmt="%(lower)s",rename="c_%s") `x`
|
||||
|
||||
/* Class (case insensitive) */
|
||||
#define PHPCN(x) %keywordwarn("'" `x` "' is a PHP reserved class name, renaming to 'c_" `x` "'",%$isclass,sourcefmt="%(lower)s",rename="c_%s") `x`
|
||||
|
||||
|
|
@ -84,6 +87,11 @@ PHPKW(while);
|
|||
PHPKW(xor);
|
||||
PHPKW(yield);
|
||||
|
||||
/* PHP 8.1 made `readonly` a keyword, but (unlike any other keyword it seems)
|
||||
* it may still be used as a function name.
|
||||
*/
|
||||
PHPKW_ok_as_function(readonly);
|
||||
|
||||
// Compile-time "magic" constants
|
||||
// From: http://php.net/manual/en/reserved.keywords.php
|
||||
// also at: http://php.net/manual/en/language.constants.predefined.php
|
||||
|
|
@ -869,6 +877,7 @@ PHPFN(unset); // "Language construct"
|
|||
PHPFN(usort);
|
||||
|
||||
#undef PHPKW
|
||||
#undef PHPKW_ok_as_function
|
||||
#undef PHPBN1a
|
||||
#undef PHPBN1b
|
||||
#undef PHPBN1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue