Pursuant to the introspection portion of TODO-PHP5, here is a small
patch that:
- Keeps track of starting/ending line numbers for user functions.
- Removes extraneous T_ML_COMMENT token.
- Stores the last seen doc comment (JavaDoc style) in the compiler
globals for future access by the introspection features and introduces
the newT_DOC_COMMENTtoken. The doc comment is defined as a multiline
comment starting with "/** \n" and ending with "*/". So, in the
following example:
/**
- @name foo
- @param blah string
*/
function foo($blah)
{
}
The CG(doc_comment) will contain:
- @name foo
- @param blah string
What is left to do here is adding the T_DOC_COMMENT to parser rules and
storing it in the appropriate structures (zend_op_array for functions,
zend_class_entry for classes, etc).
If no one objects, I will commit it shortly.
-Andrei http://www.gravitonic.com/
The Feynman problem solving algorithm:
- Write down the problem.
- Think real hard.
- Write down the answer.
I will remember to attach the patch...
I will remember to attach the patch...
I will remember to attach the patch...
I will..
Pursuant to the introspection portion of TODO-PHP5, here is a small
patch that:
-Andrei http://www.gravitonic.com/
"When a man sits with a pretty girl for an hour, it seems like a minute.
But let him sit on a hot stove for a minute, and it's longer than any hour.
That's relativity."
-- Einstein, on relativity
At 21:51 13.03.2003, Andrei Zmievski wrote:
Pursuant to the introspection portion of TODO-PHP5, here is a small
patch that:
- Keeps track of starting/ending line numbers for user functions.
- Removes extraneous T_ML_COMMENT token.
- Stores the last seen doc comment (JavaDoc style) in the compiler
globals for future access by the introspection features and introduces
the newT_DOC_COMMENTtoken. The doc comment is defined as a multiline
comment starting with "/** \n" and ending with "*/". So, in the
following example:/**
- @name foo
- @param blah string
*/
function foo($blah)
{
}The CG(doc_comment) will contain:
- @name foo
- @param blah string
What is left to do here is adding the
T_DOC_COMMENTto parser rules and
storing it in the appropriate structures (zend_op_array for functions,
zend_class_entry for classes, etc).If no one objects, I will commit it shortly.
Great!
Some questions:
- Will you allow compatibility with doxygen by this:
+<ST_IN_SCRIPTING>"/** "{NEWLINE} {
-
CG(comment_start_line) = CG(zend_lineno); -
BEGIN(ST_DOC_COMMENT); -
yymore();
+}
changed to:
+<ST_IN_SCRIPTING>("/** "|"/*! "){NEWLINE} {
-
CG(comment_start_line) = CG(zend_lineno); -
BEGIN(ST_DOC_COMMENT); -
yymore();
+}
-
Why is it '/' '' '' and SPACE?
-
How about single line comments started by '//!'?
-
What about removing everything upto '*' if it is the first character
after a new line starts?
regards
marcus
Great!
Some questions:
- Will you allow compatibility with doxygen by this:
+<ST_IN_SCRIPTING>"/** "{NEWLINE} {
CG(comment_start_line) = CG(zend_lineno);BEGIN(ST_DOC_COMMENT);yymore();+}
changed to:
+<ST_IN_SCRIPTING>("/** "|"/*! "){NEWLINE} {
CG(comment_start_line) = CG(zend_lineno);BEGIN(ST_DOC_COMMENT);yymore();+}
When Stig and I discussed this feature, I was under the impression that
it would be used in PEAR mostly, and that PEAR would adhere to
JavaDoc-style comments. Is there enough demand for doxygen comments?
- Why is it '/' '' '' and SPACE?
That's what Stig told me to use. :) Stig?
- How about single line comments started by '//!'?
I think Doc comments should be multi-line.
- What about removing everything upto '*' if it is the first character
after a new line starts?
It's a possibility. You basically want to strip the example that I gave
down to this?:
@name foo
@param blah string
-Andrei http://www.gravitonic.com/
- Use the source, Luke. *
Hmm. I thought introspection is reflection. It seems I misunderstood.
Are you sure it's worth bloating the engine to hold this extra information?
Andi
At 03:51 PM 3/13/2003 -0500, Andrei Zmievski wrote:
Pursuant to the introspection portion of TODO-PHP5, here is a small
patch that:
- Keeps track of starting/ending line numbers for user functions.
- Removes extraneous T_ML_COMMENT token.
- Stores the last seen doc comment (JavaDoc style) in the compiler
globals for future access by the introspection features and introduces
the newT_DOC_COMMENTtoken. The doc comment is defined as a multiline
comment starting with "/** \n" and ending with "*/". So, in the
following example:/**
- @name foo
- @param blah string
*/
function foo($blah)
{
}The CG(doc_comment) will contain:
- @name foo
- @param blah string
What is left to do here is adding the
T_DOC_COMMENTto parser rules and
storing it in the appropriate structures (zend_op_array for functions,
zend_class_entry for classes, etc).If no one objects, I will commit it shortly.
-Andrei http://www.gravitonic.com/
The Feynman problem solving algorithm:
- Write down the problem.
- Think real hard.
- Write down the answer.
Hmm. I thought introspection is reflection. It seems I misunderstood.
I think that introspection is a superset of reflection.
Are you sure it's worth bloating the engine to hold this extra information?
It is possible that an extension or a PEAR class could parse through the
file and extract the doc comments, but since the engine is already doing
the scanning/parsing, I thought it might be very convenient to use it.
Yes, the structure will need to have extra fields, but how much bloat
are we talking about? And if the reflection is to be good, it will
need additional information from the engine, such as the function
parameter names, class type hints, etc - all this needs to be stored
somewhere and it can't be an extension since it can't hook into the
scanning/compilation process.
If you don't like this approach, I am open to ideas.
-Andrei http://www.gravitonic.com/
"The time from now until the completion
of the project tends to become constant." -- Douglas Hartree