Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_language_scanner.l
| From: | Sterling Hughes | Date: | Thu, 28 Nov 2002 18:05:47 +0000 |
| Subject: | Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_language_scanner.l | ||
| References: | 1 2 3 4 | Groups: | php.zend-engine.cvs |
| Request: | Send a blank email to php-zend-engine-cvs+get-666@lists.php.net to get a copy of this message | ||
> At 18:13 28.11.2002, Jon Parise wrote:
> >On Thu, Nov 28, 2002 at 06:08:19PM +0100, Derick Rethans wrote:
> >
> >> > It would be better to return T_PUBLIC instead of T_VAR and handle
> >> > T_PUBLIC in the parser since we want to have public,protected and
> >> > private member functions. See patch is below:
> >>
> >> Why? It's exactly the same. Introducing new tokens which don't add
> >> anything doesn't look right to me.
> >
> >I agree with Derick here. As I understood things, "public" is
> >basically just a convenience alias for "var".
> >
> >--
> >Jon Parise (jon@php.net) :: The PHP Project (http://www.php.net/)
>
>
> The point is that it seems we will have public, protected and private
> functionns. Using T_VAR as public token for methods is a little bit
> dirty.
>
I agree, however, I think we should rename the T_VAR to T_PUBLIC,
and just keep 'var' as an alias. Attached is a patch (i also have
one for tokenizer, so, it builds together, but I left it off for brevity)
that goes ahead and renames this.
-Sterling
? public.diff Index: zend_compile.c =================================================================== RCS file: /repository/ZendEngine2/zend_compile.c,v retrieving revision 1.327 diff -u -r1.327 zend_compile.c --- zend_compile.c 24 Nov 2002 20:32:49 -0000 1.327 +++ zend_compile.c 28 Nov 2002 18:03:25 -0000 @@ -2188,7 +2188,7 @@ efree(prot_name); break; } - case T_VAR: + case T_PUBLIC: zend_hash_update(&CG(active_class_entry)->default_properties, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len+1, &property, sizeof(zval *), NULL); break; case T_STATIC: Index: zend_language_parser.y =================================================================== RCS file: /repository/ZendEngine2/zend_language_parser.y,v retrieving revision 1.79 diff -u -r1.79 zend_language_parser.y --- zend_language_parser.y 24 Nov 2002 20:32:49 -0000 1.79 +++ zend_language_parser.y 28 Nov 2002 18:03:28 -0000 @@ -114,7 +114,7 @@ %token T_ABSTRACT %token T_PRIVATE %token T_PROTECTED -%token T_VAR +%token T_PUBLIC %token T_UNSET %token T_ISSET %token T_EMPTY @@ -464,7 +464,7 @@ ; class_declaration_type: - T_VAR { $$.op_type = T_VAR; } + T_PUBLIC { $$.op_type = T_PUBLIC; } | T_STATIC { $$.op_type = T_STATIC; } | T_PRIVATE { $$.op_type = T_PRIVATE; } | T_PROTECTED { $$.op_type = T_PROTECTED; } Index: zend_language_scanner.l =================================================================== RCS file: /repository/ZendEngine2/zend_language_scanner.l,v retrieving revision 1.66 diff -u -r1.66 zend_language_scanner.l --- zend_language_scanner.l 20 Nov 2002 18:00:23 -0000 1.66 +++ zend_language_scanner.l 28 Nov 2002 18:03:30 -0000 @@ -647,7 +647,7 @@ } <ST_IN_SCRIPTING>"var" { - return T_VAR; + return T_PUBLIC; } <ST_IN_SCRIPTING>"("{TABS_AND_SPACES}("int"|"integer"){TABS_AND_SPACES}")" { @@ -739,7 +739,7 @@ } <ST_IN_SCRIPTING>"public" { - return T_VAR; + return T_PUBLIC; } <ST_IN_SCRIPTING>"unset" {
? public.diff Index: zend_compile.c =================================================================== RCS file: /repository/ZendEngine2/zend_compile.c,v retrieving revision 1.327 diff -u -r1.327 zend_compile.c --- zend_compile.c 24 Nov 2002 20:32:49 -0000 1.327 +++ zend_compile.c 28 Nov 2002 18:03:25 -0000 @@ -2188,7 +2188,7 @@ efree(prot_name); break; } - case T_VAR: + case T_PUBLIC: zend_hash_update(&CG(active_class_entry)->default_properties, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len+1, &property, sizeof(zval *), NULL); break; case T_STATIC: Index: zend_language_parser.y =================================================================== RCS file: /repository/ZendEngine2/zend_language_parser.y,v retrieving revision 1.79 diff -u -r1.79 zend_language_parser.y --- zend_language_parser.y 24 Nov 2002 20:32:49 -0000 1.79 +++ zend_language_parser.y 28 Nov 2002 18:03:28 -0000 @@ -114,7 +114,7 @@ %token T_ABSTRACT %token T_PRIVATE %token T_PROTECTED -%token T_VAR +%token T_PUBLIC %token T_UNSET %token T_ISSET %token T_EMPTY @@ -464,7 +464,7 @@ ; class_declaration_type: - T_VAR { $$.op_type = T_VAR; } + T_PUBLIC { $$.op_type = T_PUBLIC; } | T_STATIC { $$.op_type = T_STATIC; } | T_PRIVATE { $$.op_type = T_PRIVATE; } | T_PROTECTED { $$.op_type = T_PROTECTED; } Index: zend_language_scanner.l =================================================================== RCS file: /repository/ZendEngine2/zend_language_scanner.l,v retrieving revision 1.66 diff -u -r1.66 zend_language_scanner.l --- zend_language_scanner.l 20 Nov 2002 18:00:23 -0000 1.66 +++ zend_language_scanner.l 28 Nov 2002 18:03:30 -0000 @@ -647,7 +647,7 @@ } <ST_IN_SCRIPTING>"var" { - return T_VAR; + return T_PUBLIC; } <ST_IN_SCRIPTING>"("{TABS_AND_SPACES}("int"|"integer"){TABS_AND_SPACES}")" { @@ -739,7 +739,7 @@ } <ST_IN_SCRIPTING>"public" { - return T_VAR; + return T_PUBLIC; } <ST_IN_SCRIPTING>"unset" {