Re: ext/phpdoc commited
| From: | Olivier Courtin | Date: | Fri, 14 Dec 2001 02:48:50 +0000 |
| Subject: | Re: ext/phpdoc commited | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-3473@lists.php.net to get a copy of this message | ||
On Wed, 12 Dec 2001 10:48:52 +0100
jan@kneschke.de wrote:
Hello,
> Ok, I have commited the phpdoc extension to the php4 tree.
Well, i've played a little with macro and script debug tools... :)
And for all php files located in pear tree, the PECL/phpdoc xml output
is well formed. (351 on 353 due to 2 php parse error...)
So here the diff -u (old_phpdoc.c is the current cvs version one) I've
removed default value support from my previous post who seems not work
enough for the moment and add cvs Id tag (good things ?)
And i've still remove CG(lang scanner) calls, any reaction on this point ? :)
HTH :)
--
Olivier
--- old_phpdoc.c Fri Dec 14 03:16:23 2001
+++ phpdoc.c Fri Dec 14 03:16:23 2001
@@ -16,7 +16,8 @@
| Jan Kneschke <jan.kneschke@phpdoc.de> |
+----------------------------------------------------------------------+
*/
-
+// $Id$
+
#include "php.h"
#include "php_ini.h"
#include "php_phpdoc.h"
@@ -218,6 +219,7 @@
for (; i >= 0; i--) {
zend_printf("[%d]",stack[i]);
}
+ zend_printf("\n");
#endif
return (stack_pos > 0) ? stack[stack_pos-1] : -1;
}
@@ -266,10 +268,10 @@
}
-#define T_FUNCTION_PARAM INT_MAX-1
-#define T_FUNCTION_PARAM_DEFAULT INT_MAX-2
+#define T_FUNCTION_PARAM INT_MAX-1
+#define T_FUNCTION_PARAM_DEFAULT INT_MAX-2
#define T_FUNCTION_PARAM_LIST INT_MAX-3
-#define T_BLOCK INT_MAX-4
+#define T_BLOCK INT_MAX-4
typedef struct {
int *stack;
@@ -307,7 +309,7 @@
st.stack[0] = -1;
token.type = 0;
- while ((token_type=CG(lang_scanner).lex_scan(&token CLS_CC))) {
+ while ((token_type=lex_scan(&token CLS_CC))) {
if (debug)
zend_printf("// %s(%d)\n",zendtext, token_type);
@@ -343,13 +345,21 @@
case T_GLOBAL:
st.stack[st.pos++] = token_type;
break;
+ case T_STATIC:
+ st.stack[st.pos++] = token_type;
+ break;
case T_ML_COMMENT:
case T_COMMENT:
- PHPDOC_STRCAT(new_string, "<comment>");
-
- sprint_xml(new_string, zendtext);
-
- PHPDOC_STRCAT(new_string, "</comment>\n");
+ /* Don't know if it's the best way to do it ? */
+ if(!strncmp(zendtext, "/**", 3)){
+ PHPDOC_STRCAT(new_string, "<phpdoc>");
+ sprint_xml(new_string, zendtext);
+ PHPDOC_STRCAT(new_string, "</phpdoc>\n");
+ } else {
+ PHPDOC_STRCAT(new_string, "<comment>");
+ sprint_xml(new_string, zendtext);
+ PHPDOC_STRCAT(new_string, "</comment>\n");
+ }
break;
case T_EXTENDS:
switch(find_something(st.stack, st.pos)) {
@@ -379,6 +389,10 @@
zend_sprintf(buffer, "<global name=\"%s\"/>",zendtext);
PHPDOC_STRCAT(new_string, buffer);
break;
+ case T_STATIC:
+ zend_sprintf(buffer, "<static name=\"%s\"/>",zendtext);
+ PHPDOC_STRCAT(new_string, buffer);
+ break;
default:
break;
}
@@ -403,19 +417,16 @@
case T_REQUIRE_ONCE:
PHPDOC_STRCAT(new_string, zendtext);
break;
- }
- break;
- case T_DNUMBER:
- switch(find_something(st.stack, st.pos)) {
- case T_FUNCTION_PARAM_DEFAULT:
+ case T_FUNCTION_PARAM_DEFAULT:
PHPDOC_STRCAT(new_string, zendtext);
PHPDOC_STRCAT(new_string, "\"");
st.pos--;
break;
- default:
- break;
}
break;
+ case T_FILE:
+ case T_LINE:
+ case T_DNUMBER:
case T_LNUMBER:
switch(find_something(st.stack, st.pos)) {
case T_FUNCTION_PARAM_DEFAULT:
@@ -483,8 +494,8 @@
case ')':
switch (find_something(st.stack, st.pos)) {
case T_FUNCTION_PARAM:
- /* remove the param-list from the st.stack */
PHPDOC_STRCAT(new_string, "/>");
+ /* remove the param-list from the st.stack */
st.pos--;
break;
case T_INCLUDE:
@@ -495,6 +506,9 @@
PHPDOC_STRCAT(new_string, buffer);
st.pos--;
break;
+ case T_VARIABLE:
+ st.pos--;
+ break;
}
break;
case '=':
@@ -523,6 +537,7 @@
st.pos--;
break;
case T_GLOBAL:
+ case T_STATIC:
case T_VARIABLE:
st.pos--;
break;
@@ -540,6 +555,7 @@
case T_ARRAY:
switch (find_something(st.stack, st.pos)) {
case T_FUNCTION_PARAM:
+ case T_VAR:
zend_sprintf(buffer, "/>");
PHPDOC_STRCAT(new_string, buffer);
st.pos--;
@@ -627,7 +643,7 @@
convert_to_string_ex(arg);
- CG(lang_scanner).save_lexical_state(&original_lex_state CLS_CC);
+ save_lexical_state(&original_lex_state CLS_CC);
#ifndef ZTS
if (prepare_string_for_scanning(*arg, "dummy.php")==FAILURE) {
@@ -642,7 +658,7 @@
MAKE_STD_ZVAL(return_value);
ZVAL_EMPTY_STRING(return_value);
#endif
- CG(lang_scanner).restore_lexical_state(&original_lex_state CLS_CC);
+ restore_lexical_state(&original_lex_state CLS_CC);
#ifdef ZTS
delete input_stream;
#endif