Re: Doc Comments cause parser errors

From: Date: Wed, 02 Apr 2003 15:41:24 +0000
Subject: Re: Doc Comments cause parser errors
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-606@lists.php.net to get a copy of this message
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. -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 (#606) next »