On Wed, 29 May 2002, Jonathan Rosenberg wrote:

> -----Original Message-----
> > From: Thalis A. Kalfigopoulos [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, May 29, 2002 10:27 AM
> > Subject: Re: [PHP] comment followed by ?> fails to parse
> > On Wed, 29 May 2002, Jason Wong wrote:
> > > Yes this hightlights another shortcoming of PHP in
> > > that it cannot have nested multi-line comments.
> > This is not a shortcoming. This is an issue of the
> > scanner of the compiler. It is not possible to
> > remember the nesting level of the comments because of
> > the nature of regular expressions: they lack memory.
> You need to brush up on your parsing theory.  If the PHP parser
> can balance parentheses, it can balance comments, also.

>From what I remember from my compilers theory, "regexpr" is one thing, but "grammar" 
>is another. The parsing phase uses a grammar which is more powerful (every regexpr 
>has equivalent grammar but not the other way around). But the comments are usually 
>detected and dropped thereof in the scanning phase (prior to parsing). Of course you 
>could keep comments around and do the "balanced parenthesis matching" in the parsing 
>phase. Any fallacies in my memory recollection? 


PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to