Re: [PHP-DEV] Single-line comment problem

2010-07-08 Thread jvlad
Parsing ends with ? regardless if its a comment or not but its not context sensitive. It can't understand that its within a string. - S Not exactly, it's only // comment style does not comment the tag while /* */ does. The following script outputs its 'afafa': ?php if(true){ /* echo

Re: [PHP-DEV] Single-line comment problem

2010-07-08 Thread Scott MacVicar
Yeah because /* */ has a clear end where // and # doesn't. - S On 8 Jul 2010, at 12:50, jvlad d...@yandex.ru wrote: Parsing ends with ? regardless if its a comment or not but its not context sensitive. It can't understand that its within a string. - S Not exactly, it's only // comment

Re: [PHP-DEV] Single-line comment problem

2010-07-08 Thread jvlad
Scott MacVicar wrote: Yeah because /* */ has a clear end where // and # doesn't. - S Shouldn't the end of the line be always considered as a true end of the one-line comment? In other words, I think it always has a clear end too. Similarly, lexer always regognizes the strings - their start and

Re: [PHP-DEV] Single-line comment problem

2010-07-08 Thread Johannes Schlüter
On Fri, 2010-07-09 at 00:49 +0400, jvlad wrote: Scott MacVicar wrote: Yeah because /* */ has a clear end where // and # doesn't. - S Shouldn't the end of the line be always considered as a true end of the one-line comment? In other words, I think it always has a clear end too.

[PHP-DEV] Single-line comment problem

2010-07-07 Thread Shijiang
Hi I'm not sure whether it's really a bug. The following sample code will emit a parse error. ?php if(true){ //echo '?php date('Y-m-d H:i:s'); ?'; echo 'afafa'; } ? The parser treate the PHP tag within the commented line as a normal tag . -- PHP Internals - PHP

Re: [PHP-DEV] Single-line comment problem

2010-07-07 Thread Scott MacVicar
The scanner is looking for \r \n % if ASP tags are enabled or ? before it marks the end of the comment. Take the following ?php echo 'PHP'; // echo $moo; ? I am HTML, hear me roar! Parsing ends with ? regardless if its a comment or not but its not context sensitive. It can't understand that