From 447f7454e5f3e07580db50e5cc772bcfb81b021c Mon Sep 17 00:00:00 2001 From: Marcelo Matus Date: Mon, 2 Jan 2006 04:36:56 +0000 Subject: [PATCH] add insensitive kws git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8174 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Lib/php4/php4kw.swg | 47 ++++++++++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/Lib/php4/php4kw.swg b/Lib/php4/php4kw.swg index 075e349b4..888572ca7 100644 --- a/Lib/php4/php4kw.swg +++ b/Lib/php4/php4kw.swg @@ -3,8 +3,16 @@ // when used as class methods. // -#define PHPKW(x) %namewarn("314:" `x` " is a php keyword",rename="_%s") "::" `x` -#define PHPBN(x) %namewarn("321:" `x` " conflicts with a built-in name in php") "::" `x` +#define PHPKW(x) %namewarn("314:" `x` " is a php keyword, renamed as c_"`x`,sourcefmt="%(lower)s", rename="c_%s") `x` + +%define PHPCN(x) +%namewarn("314:" `x` " is a php reserved class name, class renamed as c_"`x`,match="class",rename="c_%s") `x`; +%namewarn("314:" `x` " is a php reserved class name, constructor renamed as c_"`x`,match="constructor",rename="c_%s") `x`; +%enddef + +#define PHPBN1(x) %namewarn("321:" `x` " conflicts with a built-in name in php",sourcefmt="%(lower)s") "::" `x` +#define PHPBN2(x) %namewarn("321:" `x` " conflicts with a built-in name in php") "::" `x` + /* From @@ -61,17 +69,30 @@ PHPKW(var); PHPKW(while); PHPKW(xor); -/* we catalog these as built-in names since they conflicts, but PHP still runs */ -PHPBN(E_ALL); -PHPBN(E_ERROR); -PHPBN(E_PARSE); -PHPBN(E_WARNING); -PHPBN(FALSE); -PHPBN(PHP_OS); -PHPBN(PHP_VERSION); -PHPBN(TRUE); -PHPBN(__sleep); -PHPBN(__wakeup); +/* we catalog these as built-in names since they conflict, but PHP still runs */ + +/* Type 1: case insensitive */ +PHPBN1(__sleep); +PHPBN1(__wakeup); +PHPBN1(not); +PHPBN1(virtual); +PHPBN1(TRUE); +PHPBN1(FALSE); +PHPBN1(__FILE__); +PHPBN1(__LINE__); + +/* Type 2: case sensitive */ +PHPBN2(E_ALL); +PHPBN2(E_ERROR); +PHPBN2(E_PARSE); +PHPBN2(E_WARNING); +PHPBN2(PHP_OS); +PHPBN2(PHP_VERSION); +PHPBN2(NULL); + +/* Class names not allowed */ +PHPCN(stdClass); + #undef PHPKW #undef PHPBN