RE: [PHP-DEV] Patch: Nested comments

2001-11-29 Thread Zeev Suraski

At 03:43 29/11/2001, John Donagher wrote:
>On Wed, 28 Nov 2001, Robinson, Mike wrote:
>
> > BC may not be of grave concern to Python developers.
> > Perhaps thats why it hasn't hit the radar screens.
> > You don't get to 6.5 million domains and a million ip
> > addresses chomping big 'BC' pieces off of developers
> > butts.
> >
>
>Two completely different user domains; you can't measure Python usage by
>mod_python installs. Just like you can't measure Perl usage by mod_perl
>installs.

How do you measure Python's success?  I think that many people will argue 
that PHP's space is much more difficult than that of Python's, and would be 
much less open to such changes.

In my opinion, it's quite clear that breaking compatibility is a bad idea, 
and breaking more things is always worse than breaking less things (hence 
the 'hey, we're breaking compatibility in a couple of things, so it means 
we can break many more things' approach is bogus).  Every single thing that 
we break means one more thing for people to watch for when they upgrade, 
and more broken things means more time for migration, or, in reality, it 
means that people won't migrate at all.

Typically, you start a revolution if things go really bad, beyond your 
ability to handle them.  We came the closest, IMHO, with the 
register_globals issue - and there too, we're deprecating this feature very 
gradually, and still give people the option of saying 'I don't care, I want 
it to stay on'.  This is clearly not the case with PHP, which is growing 
and growing through its regular evolution.  It may be the case with your 
particular project, and some other projects, but it still doesn't mean that 
we can afford to break PHP in order to make it more hospitable to such 
projects.

Zeev


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DEV] Patch: Nested comments

2001-11-28 Thread John Donagher

On Wed, 28 Nov 2001, Robinson, Mike wrote:

> BC may not be of grave concern to Python developers.
> Perhaps thats why it hasn't hit the radar screens.
> You don't get to 6.5 million domains and a million ip
> addresses chomping big 'BC' pieces off of developers
> butts.
> 

Two completely different user domains; you can't measure Python usage by
mod_python installs. Just like you can't measure Perl usage by mod_perl
installs. 

> Tthere is nothing wrong with evolution, nor revolution,
> provided it's carefully thought out, and executed for a
> reasonable purpose.
> 
> Nested comments isn't it.
> 

Oh, agreed, my comment was directed towards the general attitude as opposed to
the validity of this one particular patch.

John

-- 

John Donagher
Application Engineer, Intacct Corp.

Public key available off http://www.keyserver.net
Key fingerprint = 4024 DF50 56EE 19A3 258A  D628 22DE AD56 EEBE 8DDD


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DEV] Patch: Nested comments

2001-11-28 Thread Robinson, Mike
Title: RE: [PHP-DEV] Patch: Nested comments





John Donagher writes:


> Sometimes you need a revolution before you can have 
> evolution. PHP is a good language for a lot of applications, but I'm not sure I would 
> pick it for my next big project anymore. This isn't intended as a slight, 
> just some feedback; but the language doesn't appear to be evolving to encourage 
> quality development the way that Python has. Following this list for a long time 
> leads me to believe that the ideal of maintaining backwards compatibility 
> is one of the big reasons why (concern about execution speed being the other big reason,
> something I've always been impressed with with the PHP developers).



Off the tree, an apple will never be an orange.


BC may not be of grave concern to Python developers.
Perhaps thats why it hasn't hit the radar screens.
You don't get to 6.5 million domains and a million ip
addresses chomping big 'BC' pieces off of developers
butts.


Tthere is nothing wrong with evolution, nor revolution,
provided it's carefully thought out, and executed for a
reasonable purpose.


Nested comments isn't it.


 Mike Robinson
 IT / Developer - Toronto Star TV
 Phone: 416.945.8786
 Fax: 416.869.4566
 Email: [EMAIL PROTECTED]




http://www.torontostartv.com - Webcasting & Production
http://www.tmgtv.ca - Hometown Television
http://www.thestar.com - Canada’s largest daily newspaper, The Toronto Star, online



-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


Re: [PHP-DEV] Patch: Nested comments

2001-11-28 Thread Markus Fischer

Just for the record: I was talking about ZE2 and, er ..
correct me if I'm wrong, ZE2 definitely won't be in 4.2.x?

- Markus

On Wed, Nov 28, 2001 at 11:31:42AM -0800, Vlad Krupin wrote : 
> Hartmut Holzgraefe wrote:
> 
> >Markus Fischer wrote:
> >
> >>Although my vote doesn't count much here :-) I'm for it...
> >>
> >>... but it would be a problem for 4.x I guess because this
> >>horribly breaks BC when/if there's a new 4.x release and
> >>people start using it.
> >
> >
> >should be no problem to introduce it with 4.2 as we are
> >breaking BC in lots of places anyway ...
> 
> I do not have much against this particular proposal,
> but I have observed the tendency here (on this mailing list)
> to be something like that: "Since we are breaking one thing,
> we might just as well let the hell break loose and break
> everything else, be it necessary or not." Often times the
> "break early, break hard" principle will not work all that well
> just because we are not breaking early anymore, and
> breaking things just to make a cute feature or two work
> might not be such a good idea.
> 
> This is just an observation, don't flame me, but this attitude
> is starting to worry me a bit. I can see 4.2 being so different
> from 4.0.6 that we might not be able to call it 'php' anymore.
> 
> Just something to watch out for, so we don't go overboard...
> 
> Now, have a good day, everyone
> 
> Vlad
> 
> 
> 
> 
> -- 
> PHP Development Mailing List 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
Please always Cc to me when replying to me on the lists.

-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] Patch: Nested comments

2001-11-28 Thread John Donagher

On Wed, 28 Nov 2001, Andi Gutmans wrote:

> 
> I agree. We should fix problems but people have to remember that no matter 
> what there are lots and lots of users out there and the less we break 
> things, even between major versions, the easier & possible the transition 
> will be for the users.

Sometimes you need a revolution before you can have evolution. PHP is a good
language for a lot of applications, but I'm not sure I would pick it for my
next big project anymore. This isn't intended as a slight, just some feedback;
but the language doesn't appear to be evolving to encourage quality development
the way that Python has. Following this list for a long time leads me to
believe that the ideal of maintaining backwards compatibility is one of the big
reasons why (concern about execution speed being the other big reason,
something I've always been impressed with with the PHP developers).

John

-- 

John Donagher
Application Engineer, Intacct Corp.

Public key available off http://www.keyserver.net
Key fingerprint = 4024 DF50 56EE 19A3 258A  D628 22DE AD56 EEBE 8DDD


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] Patch: Nested comments

2001-11-28 Thread Andi Gutmans

At 11:31 AM 11/28/2001 -0800, Vlad Krupin wrote:
>Hartmut Holzgraefe wrote:
>
>>Markus Fischer wrote:
>>
>>> Although my vote doesn't count much here :-) I'm for it...
>>>
>>> ... but it would be a problem for 4.x I guess because this
>>> horribly breaks BC when/if there's a new 4.x release and
>>> people start using it.
>>
>>
>>should be no problem to introduce it with 4.2 as we are
>>breaking BC in lots of places anyway ...
>
>I do not have much against this particular proposal,
>but I have observed the tendency here (on this mailing list)
>to be something like that: "Since we are breaking one thing,
>we might just as well let the hell break loose and break
>everything else, be it necessary or not." Often times the
>"break early, break hard" principle will not work all that well
>just because we are not breaking early anymore, and
>breaking things just to make a cute feature or two work
>might not be such a good idea.
>
>This is just an observation, don't flame me, but this attitude
>is starting to worry me a bit. I can see 4.2 being so different
>from 4.0.6 that we might not be able to call it 'php' anymore.
>
>Just something to watch out for, so we don't go overboard...
>
>Now, have a good day, everyone

I agree. We should fix problems but people have to remember that no matter 
what there are lots and lots of users out there and the less we break 
things, even between major versions, the easier & possible the transition 
will be for the users.
Most PHP users out there aren't php-dev techies who like fixing their old 
code to work with new versions :) They prefer their old stuff to work.
So sometimes we need to break stuff but it should always be done only if it 
really makes good sense and gives enough benefit.
Andi


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] Patch: Nested comments

2001-11-28 Thread Vlad Krupin

Hartmut Holzgraefe wrote:

> Markus Fischer wrote:
>
>> Although my vote doesn't count much here :-) I'm for it...
>>
>> ... but it would be a problem for 4.x I guess because this
>> horribly breaks BC when/if there's a new 4.x release and
>> people start using it.
>
>
> should be no problem to introduce it with 4.2 as we are
> breaking BC in lots of places anyway ...

I do not have much against this particular proposal,
but I have observed the tendency here (on this mailing list)
to be something like that: "Since we are breaking one thing,
we might just as well let the hell break loose and break
everything else, be it necessary or not." Often times the
"break early, break hard" principle will not work all that well
just because we are not breaking early anymore, and
breaking things just to make a cute feature or two work
might not be such a good idea.

This is just an observation, don't flame me, but this attitude
is starting to worry me a bit. I can see 4.2 being so different
from 4.0.6 that we might not be able to call it 'php' anymore.

Just something to watch out for, so we don't go overboard...

Now, have a good day, everyone

Vlad




-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] Patch: Nested comments

2001-11-27 Thread Andi Gutmans

At 10:17 PM 11/27/2001 +0100, Anders Johannsen wrote:
>On Tue, 2001-11-27 at 21:49, Stig Venaas wrote:
> > On Tue, Nov 27, 2001 at 09:41:46PM +0100, Anders Johannsen wrote:
> > > The submitted patch does not break any existing code
>
>Perhaps I should have added: ... unless you have a really silly
>commenting style.
>
> > Okay, it is a bit weird, but people do things like this. Wouldn't
> > those scripts break?
>
>They would break, warning the user about an unterminated comment.
>However, I suspect that it will affect only very few people.

I believe there are many "silly" (I don't consider it silly because it 
happens to the best of us) people out there and I believe that it will 
affect enough people for it not to be worth breaking it.

Andi


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] Patch: Nested comments

2001-11-27 Thread Anders Johannsen

On Tue, 2001-11-27 at 21:49, Stig Venaas wrote:
> On Tue, Nov 27, 2001 at 09:41:46PM +0100, Anders Johannsen wrote:
> > The submitted patch does not break any existing code

Perhaps I should have added: ... unless you have a really silly
commenting style.

> Okay, it is a bit weird, but people do things like this. Wouldn't
> those scripts break?

They would break, warning the user about an unterminated comment.
However, I suspect that it will affect only very few people.

/A


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] Patch: Nested comments

2001-11-27 Thread Stig Venaas

On Tue, Nov 27, 2001 at 09:41:46PM +0100, Anders Johannsen wrote:
> The submitted patch does not break any existing code (the same way one
> would expect ZE2 to run all ZE1 code, but not necessarily the other way
> around)

Are you sure? Being used to code not being nested, it's not uncommon
for people to do things like:

/*  $a = 1 /* This is a comment */

Okay, it is a bit weird, but people do things like this. Wouldn't
those scripts break?

Stig

-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] Patch: Nested comments

2001-11-27 Thread Stig Venaas

On Tue, Nov 27, 2001 at 10:16:15PM +0200, Andi Gutmans wrote:
> It's not like I don't want to keep BC as much as possible for ZE2 too. Sure 
> that for important stuff BC is less important but I don't see nested 
> comments being very important to ppl. This is one of the only times it has 
> come up in the past few years so it must not be such a big deal to ppl.
> If everyone *really* wants nested comments we could think of a solution. I 
> would still prefer a non-BC breaking alternative way.

Agree, it's not that important. It would not be BC and also a bit
confusing. If really necessary I would prefer a new type of comments
for this, actually I would prefer adding simple #define and #ifdef.
But I think I'm against it.

Stig

-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] Patch: Nested comments

2001-11-27 Thread Anders Johannsen

On Tue, 2001-11-27 at 21:16, Andi Gutmans wrote:

> It's not like I don't want to keep BC as much as possible for ZE2 too. 

I'm not sure how "as much as possible" differs from "not at all" in this
context? If code developed for ZE2 cannot run on ZE1, it should not
matter *how much* it is incompatible.

The submitted patch does not break any existing code (the same way one
would expect ZE2 to run all ZE1 code, but not necessarily the other way
around)

/A


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] Patch: Nested comments

2001-11-27 Thread Andi Gutmans

At 07:56 PM 11/27/2001 +0100, Markus Fischer wrote:
>On Tue, Nov 27, 2001 at 05:59:44PM -, James Moore wrote :
> > if(0) {
> >
> >
> >
> > }
>
> Doesn't prevent the code from between being parsed.
>
> Andi, for ZE2 this is also no option? ZE2 definitely breaks
> BC and neested comments are very useful. In C you have it
> easy with #if 0 but .. hm?

It's not like I don't want to keep BC as much as possible for ZE2 too. Sure 
that for important stuff BC is less important but I don't see nested 
comments being very important to ppl. This is one of the only times it has 
come up in the past few years so it must not be such a big deal to ppl.
If everyone *really* wants nested comments we could think of a solution. I 
would still prefer a non-BC breaking alternative way.

Andi


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DEV] Patch: Nested comments

2001-11-27 Thread Robinson, Mike
Title: RE: [PHP-DEV] Patch: Nested comments






 Andi Gutmans writes:
> I don't think this should be changed and we should stick to 
> the way it is in C. (It is also not BC and even if I thought it's a good 
> idea, which I don't, I don't think it's worth it).


FWIW, I agree.
The BC issue would be enough for me to kill the idea,
but it really isn't worth it otherwise.


 Mike Robinson
 IT / Developer - Toronto Star TV
 Phone: 416.945.8786
 Fax: 416.869.4566
 Email: [EMAIL PROTECTED]




http://www.torontostartv.com - Webcasting & Production
http://www.tmgtv.ca - Hometown Television
http://www.thestar.com - Canada’s largest daily newspaper, The Toronto Star, online



-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


Re: [PHP-DEV] Patch: Nested comments

2001-11-27 Thread Markus Fischer

On Tue, Nov 27, 2001 at 05:59:44PM -, James Moore wrote : 
> if(0) {
> 
> 
> 
> }

Doesn't prevent the code from between being parsed.

Andi, for ZE2 this is also no option? ZE2 definitely breaks
BC and neested comments are very useful. In C you have it
easy with #if 0 but .. hm?

- Markus

-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] Patch: Nested comments

2001-11-27 Thread James Moore




> But in C, you can #if 0 whole blocks out regardless. I'm in favour of a
> change like this (if not this specific one) in 4.2.

if(0) {



}

- James


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] Patch: Nested comments

2001-11-27 Thread Jani Taskinen


PHP != C

--Jani


On Tue, 27 Nov 2001, Adam Wright wrote:

>But in C, you can #if 0 whole blocks out regardless. I'm in favour of a
>change like this (if not this specific one) in 4.2.
>
>adamw
>
>- Original Message -
>From: "Andi Gutmans" <[EMAIL PROTECTED]>
>To: "Anders Johannsen" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
>Sent: Tuesday, November 27, 2001 5:21 PM
>Subject: Re: [PHP-DEV] Patch: Nested comments
>
>
>> I don't think this should be changed and we should stick to the way it is
>> in C. (It is also not BC and even if I thought it's a good idea, which I
>> don't, I don't think it's worth it).
>>
>> Andi
>>
>> At 11:48 AM 11/27/2001 +0100, Anders Johannsen wrote:
>> >This patch allows for nested 'C-style' comments, which can be useful
>> >especially while debugging.
>> >
>> > > > /* comments
>> > /* now /* nest */ */
>> >
>> > /*/*/*/*
>> > */*/*/*/
>> > */
>> > ?>
>> >
>> >Since comments are handled purely lexical, there should be virtually no
>> >performance hit.
>> >
>> >The following two examples show how errors are handled:
>> >
>> >1)
>> > > > /*
>> > */
>> > */
>> > ?>
>> >
>> >2)
>> > > > /*
>> > /*
>> > */
>> > ?>
>> >
>> >Ad 1) This will yield a zend_error(E_COMPILE_ERROR,"Invalid nesting of
>> >comments") on the
>> >last line. Unpatched, a parse error is the most likely result.
>> >
>> >Ad 2) A zend_error(E_COMPILE_WARNING, "unterminated comment starting line
>> >%d", CG(comment_start_line)) is raised.
>> >
>> >The attached patch is against latest CVS
>> >
>> >Best regards,
>> >Anders Johannsen
>> >--
>> >[EMAIL PROTECTED]
>> >
>> >Index: zend_globals.h
>> >===
>> >RCS file: /repository/Zend/zend_globals.h,v
>> >retrieving revision 1.80
>> >diff -u -r1.80 zend_globals.h
>> >--- zend_globals.h  2001/10/23 01:19:16 1.80
>> >+++ zend_globals.h  2001/11/27 10:08:06
>> >@@ -82,6 +82,7 @@
>> > int comment_start_line;
>> > char *heredoc;
>> > int heredoc_len;
>> >+unsigned int comment_nest_level;
>> >
>> > zend_op_array *active_op_array;
>> >
>> >Index: zend_language_scanner.l
>> >===
>> >RCS file: /repository/Zend/zend_language_scanner.l,v
>> >retrieving revision 1.40
>> >diff -u -r1.40 zend_language_scanner.l
>> >--- zend_language_scanner.l 2001/09/22 00:06:27 1.40
>> >+++ zend_language_scanner.l 2001/11/27 10:08:07
>> >@@ -1,5 +1,4 @@
>> >  %{
>> >-
>> >  /*
>> >
>> >+--+
>> > | Zend
>> >Engine  |
>> >@@ -125,6 +124,7 @@
>> >  {
>> > CG(heredoc) = NULL;
>> > CG(heredoc_len)=0;
>> >+   CG(comment_nest_level)=0;
>> >  }
>> >
>> >
>> >@@ -1057,24 +1057,39 @@
>> > }
>> >  }
>> >
>> >+"*/" {
>> >+   zend_error(E_COMPILE_ERROR,"Invalid nesting of comments");
>> >+}
>> >+
>> >  "/*" {
>> > CG(comment_start_line) = CG(zend_lineno);
>> > BEGIN(ST_COMMENT);
>> >+CG(comment_nest_level) = 1;
>> > yymore();
>> >  }
>> >
>> >-
>> >-[^*]+ {
>> >+[^/*]+ {
>> > yymore();
>> >  }
>> >
>> >+"/*" {
>> >+CG(comment_nest_level)++;
>> >+yymore();
>> >+}
>> >+
>> >  "*/" {
>> >-   HANDLE_NEWLINES(yytext, yyleng);
>> >-   BEGIN(ST_IN_SCRIPTING);
>> >-   return T_COMMENT;
>> >+CG(comment_nest_level)--;
>> >+
>> >+if (CG(comment_nest_level) == 0) {
>> >+HANDLE_NEWLINES(yytext, yyleng);
>> >+   BEGIN(ST_IN_SCRIPTING);
>> >+   return T_COMMENT;
>> >+} else {
>> >+ yymore();
>> >+}
>> >  }
>> >
>> >-"*" {
>> >+"*"|"/" {
>> > yymore();
>> >  }
>> >
>> >
>> >
>> >
>> >
>> >--
>> >PHP Development Mailing List <http://www.php.net/>
>> >To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >For additional commands, e-mail: [EMAIL PROTECTED]
>> >To contact the list administrators, e-mail: [EMAIL PROTECTED]
>>
>>
>> --
>> PHP Development Mailing List <http://www.php.net/>
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>>
>>
>
>
>


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] Patch: Nested comments

2001-11-27 Thread John Donagher


Sorry, why can't you do that in php?

On Tue, 27 Nov 2001, Adam Wright wrote:

> But in C, you can #if 0 whole blocks out regardless. I'm in favour of a
> change like this (if not this specific one) in 4.2.
> 
> adamw
> 
> - Original Message -
> From: "Andi Gutmans" <[EMAIL PROTECTED]>
> To: "Anders Johannsen" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Tuesday, November 27, 2001 5:21 PM
> Subject: Re: [PHP-DEV] Patch: Nested comments
> 
> 
> > I don't think this should be changed and we should stick to the way it is
> > in C. (It is also not BC and even if I thought it's a good idea, which I
> > don't, I don't think it's worth it).
> >
> > Andi
> >
> > At 11:48 AM 11/27/2001 +0100, Anders Johannsen wrote:
> > >This patch allows for nested 'C-style' comments, which can be useful
> > >especially while debugging.
> > >
> > >  > > /* comments
> > > /* now /* nest */ */
> > >
> > > /*/*/*/*
> > > */*/*/*/
> > > */
> > > ?>
> > >
> > >Since comments are handled purely lexical, there should be virtually no
> > >performance hit.
> > >
> > >The following two examples show how errors are handled:
> > >
> > >1)
> > >  > > /*
> > > */
> > > */
> > > ?>
> > >
> > >2)
> > >  > > /*
> > > /*
> > > */
> > > ?>
> > >
> > >Ad 1) This will yield a zend_error(E_COMPILE_ERROR,"Invalid nesting of
> > >comments") on the
> > >last line. Unpatched, a parse error is the most likely result.
> > >
> > >Ad 2) A zend_error(E_COMPILE_WARNING, "unterminated comment starting line
> > >%d", CG(comment_start_line)) is raised.
> > >
> > >The attached patch is against latest CVS
> > >
> > >Best regards,
> > >Anders Johannsen
> > >--
> > >[EMAIL PROTECTED]
> > >
> > >Index: zend_globals.h
> > >===
> > >RCS file: /repository/Zend/zend_globals.h,v
> > >retrieving revision 1.80
> > >diff -u -r1.80 zend_globals.h
> > >--- zend_globals.h  2001/10/23 01:19:16 1.80
> > >+++ zend_globals.h  2001/11/27 10:08:06
> > >@@ -82,6 +82,7 @@
> > > int comment_start_line;
> > > char *heredoc;
> > > int heredoc_len;
> > >+unsigned int comment_nest_level;
> > >
> > > zend_op_array *active_op_array;
> > >
> > >Index: zend_language_scanner.l
> > >===
> > >RCS file: /repository/Zend/zend_language_scanner.l,v
> > >retrieving revision 1.40
> > >diff -u -r1.40 zend_language_scanner.l
> > >--- zend_language_scanner.l 2001/09/22 00:06:27 1.40
> > >+++ zend_language_scanner.l 2001/11/27 10:08:07
> > >@@ -1,5 +1,4 @@
> > >  %{
> > >-
> > >  /*
> > >
> > >+--+
> > > | Zend
> > >Engine  |
> > >@@ -125,6 +124,7 @@
> > >  {
> > > CG(heredoc) = NULL;
> > > CG(heredoc_len)=0;
> > >+   CG(comment_nest_level)=0;
> > >  }
> > >
> > >
> > >@@ -1057,24 +1057,39 @@
> > > }
> > >  }
> > >
> > >+"*/" {
> > >+   zend_error(E_COMPILE_ERROR,"Invalid nesting of comments");
> > >+}
> > >+
> > >  "/*" {
> > > CG(comment_start_line) = CG(zend_lineno);
> > > BEGIN(ST_COMMENT);
> > >+CG(comment_nest_level) = 1;
> > > yymore();
> > >  }
> > >
> > >-
> > >-[^*]+ {
> > >+[^/*]+ {
> > > yymore();
> > >  }
> > >
> > >+"/*" {
> > >+CG(comment_nest_level)++;
> > >+yymore();
> > >+}
> > >+
> > >  "*/" {
> > >-   HANDLE_NEWLINES(yytext, yyleng);
> > >-   BEGIN(ST_IN_SCRIPTING);
> > >-   return T_COMMENT;
> > >+  

Re: [PHP-DEV] Patch: Nested comments

2001-11-27 Thread Adam Wright

But in C, you can #if 0 whole blocks out regardless. I'm in favour of a
change like this (if not this specific one) in 4.2.

adamw

- Original Message -
From: "Andi Gutmans" <[EMAIL PROTECTED]>
To: "Anders Johannsen" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, November 27, 2001 5:21 PM
Subject: Re: [PHP-DEV] Patch: Nested comments


> I don't think this should be changed and we should stick to the way it is
> in C. (It is also not BC and even if I thought it's a good idea, which I
> don't, I don't think it's worth it).
>
> Andi
>
> At 11:48 AM 11/27/2001 +0100, Anders Johannsen wrote:
> >This patch allows for nested 'C-style' comments, which can be useful
> >especially while debugging.
> >
> >  > /* comments
> > /* now /* nest */ */
> >
> > /*/*/*/*
> > */*/*/*/
> > */
> > ?>
> >
> >Since comments are handled purely lexical, there should be virtually no
> >performance hit.
> >
> >The following two examples show how errors are handled:
> >
> >1)
> >  > /*
> > */
> > */
> > ?>
> >
> >2)
> >  > /*
> > /*
> > */
> > ?>
> >
> >Ad 1) This will yield a zend_error(E_COMPILE_ERROR,"Invalid nesting of
> >comments") on the
> >last line. Unpatched, a parse error is the most likely result.
> >
> >Ad 2) A zend_error(E_COMPILE_WARNING, "unterminated comment starting line
> >%d", CG(comment_start_line)) is raised.
> >
> >The attached patch is against latest CVS
> >
> >Best regards,
> >Anders Johannsen
> >--
> >[EMAIL PROTECTED]
> >
> >Index: zend_globals.h
> >===
> >RCS file: /repository/Zend/zend_globals.h,v
> >retrieving revision 1.80
> >diff -u -r1.80 zend_globals.h
> >--- zend_globals.h  2001/10/23 01:19:16 1.80
> >+++ zend_globals.h  2001/11/27 10:08:06
> >@@ -82,6 +82,7 @@
> > int comment_start_line;
> > char *heredoc;
> > int heredoc_len;
> >+unsigned int comment_nest_level;
> >
> > zend_op_array *active_op_array;
> >
> >Index: zend_language_scanner.l
> >===
> >RCS file: /repository/Zend/zend_language_scanner.l,v
> >retrieving revision 1.40
> >diff -u -r1.40 zend_language_scanner.l
> >--- zend_language_scanner.l 2001/09/22 00:06:27 1.40
> >+++ zend_language_scanner.l 2001/11/27 10:08:07
> >@@ -1,5 +1,4 @@
> >  %{
> >-
> >  /*
> >
> >+--+
> > | Zend
> >Engine  |
> >@@ -125,6 +124,7 @@
> >  {
> > CG(heredoc) = NULL;
> > CG(heredoc_len)=0;
> >+   CG(comment_nest_level)=0;
> >  }
> >
> >
> >@@ -1057,24 +1057,39 @@
> > }
> >  }
> >
> >+"*/" {
> >+   zend_error(E_COMPILE_ERROR,"Invalid nesting of comments");
> >+}
> >+
> >  "/*" {
> > CG(comment_start_line) = CG(zend_lineno);
> > BEGIN(ST_COMMENT);
> >+CG(comment_nest_level) = 1;
> > yymore();
> >  }
> >
> >-
> >-[^*]+ {
> >+[^/*]+ {
> > yymore();
> >  }
> >
> >+"/*" {
> >+CG(comment_nest_level)++;
> >+yymore();
> >+}
> >+
> >  "*/" {
> >-   HANDLE_NEWLINES(yytext, yyleng);
> >-   BEGIN(ST_IN_SCRIPTING);
> >-   return T_COMMENT;
> >+CG(comment_nest_level)--;
> >+
> >+if (CG(comment_nest_level) == 0) {
> >+HANDLE_NEWLINES(yytext, yyleng);
> >+   BEGIN(ST_IN_SCRIPTING);
> >+   return T_COMMENT;
> >+} else {
> >+ yymore();
> >+}
> >  }
> >
> >-"*" {
> >+"*"|"/" {
> > yymore();
> >  }
> >
> >
> >
> >
> >
> >--
> >PHP Development Mailing List <http://www.php.net/>
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] Patch: Nested comments

2001-11-27 Thread Andi Gutmans

I don't think this should be changed and we should stick to the way it is 
in C. (It is also not BC and even if I thought it's a good idea, which I 
don't, I don't think it's worth it).

Andi

At 11:48 AM 11/27/2001 +0100, Anders Johannsen wrote:
>This patch allows for nested 'C-style' comments, which can be useful
>especially while debugging.
>
>  /* comments
> /* now /* nest */ */
>
> /*/*/*/*
> */*/*/*/
> */
> ?>
>
>Since comments are handled purely lexical, there should be virtually no
>performance hit.
>
>The following two examples show how errors are handled:
>
>1)
>  /*
> */
> */
> ?>
>
>2)
>  /*
> /*
> */
> ?>
>
>Ad 1) This will yield a zend_error(E_COMPILE_ERROR,"Invalid nesting of
>comments") on the
>last line. Unpatched, a parse error is the most likely result.
>
>Ad 2) A zend_error(E_COMPILE_WARNING, "unterminated comment starting line
>%d", CG(comment_start_line)) is raised.
>
>The attached patch is against latest CVS
>
>Best regards,
>Anders Johannsen
>--
>[EMAIL PROTECTED]
>
>Index: zend_globals.h
>===
>RCS file: /repository/Zend/zend_globals.h,v
>retrieving revision 1.80
>diff -u -r1.80 zend_globals.h
>--- zend_globals.h  2001/10/23 01:19:16 1.80
>+++ zend_globals.h  2001/11/27 10:08:06
>@@ -82,6 +82,7 @@
> int comment_start_line;
> char *heredoc;
> int heredoc_len;
>+unsigned int comment_nest_level;
>
> zend_op_array *active_op_array;
>
>Index: zend_language_scanner.l
>===
>RCS file: /repository/Zend/zend_language_scanner.l,v
>retrieving revision 1.40
>diff -u -r1.40 zend_language_scanner.l
>--- zend_language_scanner.l 2001/09/22 00:06:27 1.40
>+++ zend_language_scanner.l 2001/11/27 10:08:07
>@@ -1,5 +1,4 @@
>  %{
>-
>  /*
>
>+--+
> | Zend
>Engine  |
>@@ -125,6 +124,7 @@
>  {
> CG(heredoc) = NULL;
> CG(heredoc_len)=0;
>+   CG(comment_nest_level)=0;
>  }
>
>
>@@ -1057,24 +1057,39 @@
> }
>  }
>
>+"*/" {
>+   zend_error(E_COMPILE_ERROR,"Invalid nesting of comments");
>+}
>+
>  "/*" {
> CG(comment_start_line) = CG(zend_lineno);
> BEGIN(ST_COMMENT);
>+CG(comment_nest_level) = 1;
> yymore();
>  }
>
>-
>-[^*]+ {
>+[^/*]+ {
> yymore();
>  }
>
>+"/*" {
>+CG(comment_nest_level)++;
>+yymore();
>+}
>+
>  "*/" {
>-   HANDLE_NEWLINES(yytext, yyleng);
>-   BEGIN(ST_IN_SCRIPTING);
>-   return T_COMMENT;
>+CG(comment_nest_level)--;
>+
>+if (CG(comment_nest_level) == 0) {
>+HANDLE_NEWLINES(yytext, yyleng);
>+   BEGIN(ST_IN_SCRIPTING);
>+   return T_COMMENT;
>+} else {
>+ yymore();
>+}
>  }
>
>-"*" {
>+"*"|"/" {
> yymore();
>  }
>
>
>
>
>
>--
>PHP Development Mailing List 
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] Patch: Nested comments

2001-11-27 Thread Lars Torben Wilson

Hartmut Holzgraefe writes:
> James Moore wrote:
> 
> > ... could we make some
> > other changes to how comments are handeled too?
> > 
> > // ?>
> > 
> > would not switch out of PHP mode,
> > 
> > /*
> > 
> > ?>
> > Html code
> >  > 
> > */
> > 
> > Would comment out the html code too..
> > 
> > I dont know if this is a good or bad idea..
> 
> 
> IMHO it is a very bad idea to mask XML processing
> instruction tags by a comment-semantic only
> available *within* these processing instructions
> 
> both variants have a WTF factor of their own,
> but at least the current one is consistent

?

This is what I get:

script.php:


Will you see this?



Output:

4.1.0RC3




-- 
 Torben Wilson <[EMAIL PROTECTED]>
 http://www.thebuttlesschaps.com
 http://www.hybrid17.com
 http://www.inflatableeye.com
 +1.604.709.0506


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] Patch: Nested comments

2001-11-27 Thread Markus Fischer

On Tue, Nov 27, 2001 at 01:01:17PM +0100, Hartmut Holzgraefe wrote : 
> Markus Fischer wrote:
> 
> >Although my vote doesn't count much here :-) I'm for it...
> >
> >... but it would be a problem for 4.x I guess because this
> >horribly breaks BC when/if there's a new 4.x release and
> >people start using it.
> 
> should be no problem to introduce it with 4.2 as we are
> breaking BC in lots of places anyway ...
> 
> ... and it will most likely only bite new code on old
> versions and not vice versa ...

But don't forget ... it's BC in a way you can programmaticalyl
work it around most of the times. You can't do that with
comments (that was my inital thought).

- Markus

-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] Patch: Nested comments

2001-11-27 Thread Anders Johannsen

> /*
>
> ?>
> Html code
> 
> */
>
> Would comment out the html code too..

I believe the "Html code" is ignored.

Best regards,
Anders Johannsen
--
[EMAIL PROTECTED]



-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] Patch: Nested comments

2001-11-27 Thread Hartmut Holzgraefe

Markus Fischer wrote:

> Although my vote doesn't count much here :-) I'm for it...
> 
> ... but it would be a problem for 4.x I guess because this
> horribly breaks BC when/if there's a new 4.x release and
> people start using it.

should be no problem to introduce it with 4.2 as we are
breaking BC in lots of places anyway ...

... and it will most likely only bite new code on old
versions and not vice versa ...

-- 
Hartmut Holzgraefe  [EMAIL PROTECTED]  http://www.six.de  +49-711-99091-77




-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] Patch: Nested comments

2001-11-27 Thread Hartmut Holzgraefe

James Moore wrote:

> ... could we make some
> other changes to how comments are handeled too?
> 
> // ?>
> 
> would not switch out of PHP mode,
> 
> /*
> 
> ?>
> Html code
>  
> */
> 
> Would comment out the html code too..
> 
> I dont know if this is a good or bad idea..


IMHO it is a very bad idea to mask XML processing
instruction tags by a comment-semantic only
available *within* these processing instructions

both variants have a WTF factor of their own,
but at least the current one is consistent


-- 
Hartmut Holzgraefe  [EMAIL PROTECTED]  http://www.six.de  +49-711-99091-77




-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] Patch: Nested comments

2001-11-27 Thread Andrey Hristov

Better introduce new type of comments so one type can include the other type :
Example from pascal :
{
a comment
(* another nested *)
}

Andrey

- Original Message - 
From: "Martin Jansen" <[EMAIL PROTECTED]>
To: "Markus Fischer" <[EMAIL PROTECTED]>
Cc: "Anders Johannsen" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, November 27, 2001 1:33 PM
Subject: Re: [PHP-DEV] Patch: Nested comments


> On Tue, 27 Nov 2001 12:15:39 +0100, Markus Fischer wrote:
> 
> >Although my vote doesn't count much here :-) I'm for it...
> >
> >... but it would be a problem for 4.x I guess because this
> >horribly breaks BC when/if there's a new 4.x release and
> >people start using it.
> >
> >But it would be nice to have it in ZE2.
> 
> +1
> 
> - Martin
> 
> 
> 
> -- 
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] Patch: Nested comments

2001-11-27 Thread Martin Jansen

On Tue, 27 Nov 2001 12:15:39 +0100, Markus Fischer wrote:

>Although my vote doesn't count much here :-) I'm for it...
>
>... but it would be a problem for 4.x I guess because this
>horribly breaks BC when/if there's a new 4.x release and
>people start using it.
>
>But it would be nice to have it in ZE2.

+1

- Martin



-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] Patch: Nested comments

2001-11-27 Thread Markus Fischer

On Tue, Nov 27, 2001 at 11:23:19AM -, James Moore wrote : 
> > Although my vote doesn't count much here :-) I'm for it...
> >
> > ... but it would be a problem for 4.x I guess because this
> > horribly breaks BC when/if there's a new 4.x release and
> > people start using it.
> >
> > But it would be nice to have it in ZE2.
> >
> > my 2c - Markus
> 
> Its fairly standard not to allow these, but if we do could we make some
> other changes to how comments are handeled too?

I'm asking why .. it's really _very_ handy to comment out a
bug block of code without having to check if it contains
comments already or not ...


> // ?>
> 
> would not switch out of PHP mode,
> 
> /*
> 
> ?>
> Html code
>  
> */
> 
> Would comment out the html code too..
> 
> I dont know if this is a good or bad idea..

Mhmm .. no idea too :-)

- Markus

-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] Patch: Nested comments

2001-11-27 Thread James Moore





> Although my vote doesn't count much here :-) I'm for it...
>
> ... but it would be a problem for 4.x I guess because this
> horribly breaks BC when/if there's a new 4.x release and
> people start using it.
>
> But it would be nice to have it in ZE2.
>
> my 2c - Markus

Its fairly standard not to allow these, but if we do could we make some
other changes to how comments are handeled too?

// ?>

would not switch out of PHP mode,

/*

?>
Html code
http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] Patch: Nested comments

2001-11-27 Thread Markus Fischer

Although my vote doesn't count much here :-) I'm for it...

... but it would be a problem for 4.x I guess because this
horribly breaks BC when/if there's a new 4.x release and
people start using it.

But it would be nice to have it in ZE2.

my 2c - Markus

On Tue, Nov 27, 2001 at 11:48:51AM +0100, Anders Johannsen wrote : 
> This patch allows for nested 'C-style' comments, which can be useful
> especially while debugging.
> 
>  /* comments
> /* now /* nest */ */
> 
> /*/*/*/*
> */*/*/*/
> */
> ?>
> 
> Since comments are handled purely lexical, there should be virtually no
> performance hit.
> 
> The following two examples show how errors are handled:
> 
> 1)
>  /*
> */
> */
> ?>
> 
> 2)
>  /*
> /*
> */
> ?>
> 
> Ad 1) This will yield a zend_error(E_COMPILE_ERROR,"Invalid nesting of
> comments") on the
> last line. Unpatched, a parse error is the most likely result.
> 
> Ad 2) A zend_error(E_COMPILE_WARNING, "unterminated comment starting line
> %d", CG(comment_start_line)) is raised.
> 
> The attached patch is against latest CVS
> 
> Best regards,
> Anders Johannsen
> --
> [EMAIL PROTECTED]
> 
> Index: zend_globals.h
> ===
> RCS file: /repository/Zend/zend_globals.h,v
> retrieving revision 1.80
> diff -u -r1.80 zend_globals.h
> --- zend_globals.h  2001/10/23 01:19:16 1.80
> +++ zend_globals.h  2001/11/27 10:08:06
> @@ -82,6 +82,7 @@
> int comment_start_line;
> char *heredoc;
> int heredoc_len;
> +unsigned int comment_nest_level;
> 
> zend_op_array *active_op_array;
> 
> Index: zend_language_scanner.l
> ===
> RCS file: /repository/Zend/zend_language_scanner.l,v
> retrieving revision 1.40
> diff -u -r1.40 zend_language_scanner.l
> --- zend_language_scanner.l 2001/09/22 00:06:27 1.40
> +++ zend_language_scanner.l 2001/11/27 10:08:07
> @@ -1,5 +1,4 @@
>  %{
> -
>  /*
> 
> +--+
> | Zend
> Engine  |
> @@ -125,6 +124,7 @@
>  {
> CG(heredoc) = NULL;
> CG(heredoc_len)=0;
> +   CG(comment_nest_level)=0;
>  }
> 
> 
> @@ -1057,24 +1057,39 @@
> }
>  }
> 
> +"*/" {
> +   zend_error(E_COMPILE_ERROR,"Invalid nesting of comments");
> +}
> +
>  "/*" {
> CG(comment_start_line) = CG(zend_lineno);
> BEGIN(ST_COMMENT);
> +CG(comment_nest_level) = 1;
> yymore();
>  }
> 
> -
> -[^*]+ {
> +[^/*]+ {
> yymore();
>  }
> 
> +"/*" {
> +CG(comment_nest_level)++;
> +yymore();
> +}
> +
>  "*/" {
> -   HANDLE_NEWLINES(yytext, yyleng);
> -   BEGIN(ST_IN_SCRIPTING);
> -   return T_COMMENT;
> +CG(comment_nest_level)--;
> +
> +if (CG(comment_nest_level) == 0) {
> +HANDLE_NEWLINES(yytext, yyleng);
> +   BEGIN(ST_IN_SCRIPTING);
> +   return T_COMMENT;
> +} else {
> + yymore();
> +}
>  }
> 
> -"*" {
> +"*"|"/" {
> yymore();
>  }
> 
> 
> 
> 
> 
> -- 
> PHP Development Mailing List 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
Please always Cc to me when replying to me on the lists.

-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] Patch: Nested comments

2001-11-27 Thread Anders Johannsen

This patch allows for nested 'C-style' comments, which can be useful
especially while debugging.



Since comments are handled purely lexical, there should be virtually no
performance hit.

The following two examples show how errors are handled:

1)


2)


Ad 1) This will yield a zend_error(E_COMPILE_ERROR,"Invalid nesting of
comments") on the
last line. Unpatched, a parse error is the most likely result.

Ad 2) A zend_error(E_COMPILE_WARNING, "unterminated comment starting line
%d", CG(comment_start_line)) is raised.

The attached patch is against latest CVS

Best regards,
Anders Johannsen
--
[EMAIL PROTECTED]

Index: zend_globals.h
===
RCS file: /repository/Zend/zend_globals.h,v
retrieving revision 1.80
diff -u -r1.80 zend_globals.h
--- zend_globals.h  2001/10/23 01:19:16 1.80
+++ zend_globals.h  2001/11/27 10:08:06
@@ -82,6 +82,7 @@
int comment_start_line;
char *heredoc;
int heredoc_len;
+unsigned int comment_nest_level;

zend_op_array *active_op_array;

Index: zend_language_scanner.l
===
RCS file: /repository/Zend/zend_language_scanner.l,v
retrieving revision 1.40
diff -u -r1.40 zend_language_scanner.l
--- zend_language_scanner.l 2001/09/22 00:06:27 1.40
+++ zend_language_scanner.l 2001/11/27 10:08:07
@@ -1,5 +1,4 @@
 %{
-
 /*

+--+
| Zend
Engine  |
@@ -125,6 +124,7 @@
 {
CG(heredoc) = NULL;
CG(heredoc_len)=0;
+   CG(comment_nest_level)=0;
 }


@@ -1057,24 +1057,39 @@
}
 }

+"*/" {
+   zend_error(E_COMPILE_ERROR,"Invalid nesting of comments");
+}
+
 "/*" {
CG(comment_start_line) = CG(zend_lineno);
BEGIN(ST_COMMENT);
+CG(comment_nest_level) = 1;
yymore();
 }

-
-[^*]+ {
+[^/*]+ {
yymore();
 }

+"/*" {
+CG(comment_nest_level)++;
+yymore();
+}
+
 "*/" {
-   HANDLE_NEWLINES(yytext, yyleng);
-   BEGIN(ST_IN_SCRIPTING);
-   return T_COMMENT;
+CG(comment_nest_level)--;
+
+if (CG(comment_nest_level) == 0) {
+HANDLE_NEWLINES(yytext, yyleng);
+   BEGIN(ST_IN_SCRIPTING);
+   return T_COMMENT;
+} else {
+ yymore();
+}
 }

-"*" {
+"*"|"/" {
yymore();
 }





-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]