Re: Doc Comments cause parser errors

From: Date: Wed, 02 Apr 2003 15:48:20 +0000
Subject: Re: Doc Comments cause parser errors
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-608@lists.php.net to get a copy of this message
At 10:41 AM 4/2/2003 -0500, Andrei Zmievski wrote:
On Wed, 02 Apr 2003, Andi Gutmans wrote: Oh, I didn't think of that. You are completely right. This is definitely a problem. Andrei's patch returns a token for /** */ on the parser level so only places which are allowed to have this work. This sounds like a serious flaw because any place which has such comments will fail. I guess we'll need to revert his patch and try to think of a completely different way of doing it (unless someone has a good idea of how to solve this problem). No, it won't fail. Look: statement:
        unticked_statement { zend_do_ticks(TSRMLS_C); }
    |   doc_comment { zend_do_free(&$1 TSRMLS_CC); } unticked_statement { zend_do_ticks(TSRMLS_C); }
; This allows doc comments before any non-declarative statement. The only remaining problem is having doc comments before class vars and constants. If you think it's better to go with the approach that Alan outlined, I can live with that too, but it seems easier to handle this in the parser rather than in zend_do_* functions and also having to reset the doc comment for each statement.
How about: if ($a /** $a is great variable */
        || $b) {
} I'm sure I can find other more realistic examples which would break. I don't know why I didn't think of it before but I think having this in the parser is impossible. We need to find a smarter way of doing it. Andi
-Andrei                                       http://www.gravitonic.com/
The Feynman problem solving algorithm: 1) Write down the problem. 2) Think real hard. 3) Write down the answer.


« previous php.internals (#608) next »