Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:32 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 93196 invoked from network); 13 Mar 2003 20:53:10 -0000 Received: from unknown (HELO hyperion.gravitonic.com) (65.198.110.5) by pb1.pair.com with SMTP; 13 Mar 2003 20:53:10 -0000 Received: (from andrei@localhost) by hyperion.gravitonic.com (8.11.6/8.11.6) id h2DKqf921783 for internals@lists.php.net; Thu, 13 Mar 2003 15:52:41 -0500 X-Authentication-Warning: hyperion.gravitonic.com: andrei set sender to andrei@gravitonic.com using -f Date: Thu, 13 Mar 2003 15:52:41 -0500 To: PHP Internals Message-ID: <20030313205241.GB21734@hyperion.gravitonic.com> Mail-Followup-To: Andrei Zmievski , PHP Internals References: <20030313205122.GA21734@hyperion.gravitonic.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="a8Wt8u1KmwUX3Y2C" Content-Disposition: inline In-Reply-To: <20030313205122.GA21734@hyperion.gravitonic.com> User-Agent: Mutt/1.4i Subject: Re: [PHP-DEV] Doc comment patch From: andrei@gravitonic.com (Andrei Zmievski) --a8Wt8u1KmwUX3Y2C Content-Type: text/plain; charset=us-ascii Content-Disposition: inline I will remember to attach the patch... I will remember to attach the patch... I will remember to attach the patch... I will.. On Thu, 13 Mar 2003, Andrei Zmievski wrote: > 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 --a8Wt8u1KmwUX3Y2C Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="introsp.txt" Index: zend_compile.c =================================================================== RCS file: /repository/ZendEngine2/zend_compile.c,v retrieving revision 1.395 diff -u -2 -b -w -B -r1.395 zend_compile.c --- zend_compile.c 12 Mar 2003 09:38:19 -0000 1.395 +++ zend_compile.c 13 Mar 2003 20:43:34 -0000 @@ -977,4 +977,6 @@ op_array.ns = CG(active_namespace); + op_array.line_start = CG(zend_lineno); + if (is_method) { char *short_class_name = CG(active_class_entry)->name; @@ -1074,4 +1076,5 @@ zend_do_return(NULL, 0 TSRMLS_CC); pass_two(CG(active_op_array) TSRMLS_CC); + CG(active_op_array)->line_end = CG(zend_lineno); CG(active_op_array) = function_token->u.op_array; @@ -3208,4 +3211,5 @@ switch (retval) { case T_COMMENT: + case T_DOC_COMMENT: case T_OPEN_TAG: case T_WHITESPACE: Index: zend_compile.h =================================================================== RCS file: /repository/ZendEngine2/zend_compile.h,v retrieving revision 1.224 diff -u -2 -b -w -B -r1.224 zend_compile.h --- zend_compile.h 9 Mar 2003 22:17:15 -0000 1.224 +++ zend_compile.h 13 Mar 2003 20:43:34 -0000 @@ -147,4 +147,6 @@ char *filename; + int line_start; + int line_end; void *reserved[ZEND_MAX_RESERVED_RESOURCES]; Index: zend_globals.h =================================================================== RCS file: /repository/ZendEngine2/zend_globals.h,v retrieving revision 1.120 diff -u -2 -b -w -B -r1.120 zend_globals.h --- zend_globals.h 5 Mar 2003 11:14:43 -0000 1.120 +++ zend_globals.h 13 Mar 2003 20:43:34 -0000 @@ -86,4 +86,6 @@ char *heredoc; int heredoc_len; + char *doc_comment; + int doc_comment_len; zend_op_array *active_op_array; Index: zend_highlight.c =================================================================== RCS file: /repository/ZendEngine2/zend_highlight.c,v retrieving revision 1.35 diff -u -2 -b -w -B -r1.35 zend_highlight.c --- zend_highlight.c 6 Mar 2003 15:38:28 -0000 1.35 +++ zend_highlight.c 13 Mar 2003 20:43:34 -0000 @@ -98,4 +98,5 @@ break; case T_COMMENT: + case T_DOC_COMMENT: next_color = syntax_highlighter_ini->highlight_comment; break; Index: zend_language_parser.y =================================================================== RCS file: /repository/ZendEngine2/zend_language_parser.y,v retrieving revision 1.103 diff -u -2 -b -w -B -r1.103 zend_language_parser.y --- zend_language_parser.y 9 Mar 2003 22:23:27 -0000 1.103 +++ zend_language_parser.y 13 Mar 2003 20:43:34 -0000 @@ -131,5 +131,5 @@ %token T_FILE %token T_COMMENT -%token T_ML_COMMENT +%token T_DOC_COMMENT %token T_OPEN_TAG %token T_OPEN_TAG_WITH_ECHO Index: zend_language_scanner.l =================================================================== RCS file: /repository/ZendEngine2/zend_language_scanner.l,v retrieving revision 1.80 diff -u -2 -b -w -B -r1.80 zend_language_scanner.l --- zend_language_scanner.l 9 Mar 2003 21:12:12 -0000 1.80 +++ zend_language_scanner.l 13 Mar 2003 20:43:34 -0000 @@ -42,4 +42,5 @@ %x ST_LOOKING_FOR_VARNAME %x ST_COMMENT +%x ST_DOC_COMMENT %x ST_ONE_LINE_COMMENT %option stack @@ -135,4 +136,8 @@ CG(heredoc_len)=0; } + if (CG(doc_comment)) { + efree(CG(doc_comment)); + CG(doc_comment_len) = 0; + } } END_EXTERN_C() @@ -1170,4 +1175,10 @@ } +"/** "{NEWLINE} { + CG(comment_start_line) = CG(zend_lineno); + BEGIN(ST_DOC_COMMENT); + yymore(); +} + "/*" { CG(comment_start_line) = CG(zend_lineno); @@ -1177,8 +1188,24 @@ -[^*]+ { +[^*]+ { yymore(); } +"*/" { + char *s = &yytext[yyleng-3]; + CG(doc_comment_len) = yyleng-7; + while (*s == ' ' || *s == '\t' || *s == '\n' || *s == '\r') { + s--; + CG(doc_comment_len)--; + } + if (CG(doc_comment)) { + efree(CG(doc_comment)); + } + CG(doc_comment) = estrndup(yytext+5, CG(doc_comment_len)); + HANDLE_NEWLINES(yytext, yyleng); + BEGIN(ST_IN_SCRIPTING); + return T_DOC_COMMENT; +} + "*/" { HANDLE_NEWLINES(yytext, yyleng); @@ -1187,5 +1214,5 @@ } -"*" { +"*" { yymore(); } @@ -1553,5 +1580,5 @@ } -<> { +<> { zend_error(E_COMPILE_WARNING,"Unterminated comment starting line %d", CG(comment_start_line)); return 0; --a8Wt8u1KmwUX3Y2C--