cvs: ZendEngine2 / zend_highlight.c
| From: | Ilia Alshanetsky | Date: | Thu, 06 Mar 2003 15:38:28 +0000 |
| Subject: | cvs: ZendEngine2 / zend_highlight.c | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-1000@lists.php.net to get a copy of this message | ||
iliaa Thu Mar 6 10:38:28 2003 EDT
Modified files:
/ZendEngine2 zend_highlight.c
Log:
More cleanup of the zend_strip() function.
No longer strip __LINE__, since while it may become useless it could break
code where __LINE__ is passed as a function parameter.
Index: ZendEngine2/zend_highlight.c
diff -u ZendEngine2/zend_highlight.c:1.34 ZendEngine2/zend_highlight.c:1.35
--- ZendEngine2/zend_highlight.c:1.34 Thu Mar 6 09:47:13 2003
+++ ZendEngine2/zend_highlight.c Thu Mar 6 10:38:28 2003
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_highlight.c,v 1.34 2003/03/06 14:47:13 iliaa Exp $ */
+/* $Id: zend_highlight.c,v 1.35 2003/03/06 15:38:28 iliaa Exp $ */
#include "zend.h"
#include "zend_language_parser.h"
@@ -185,42 +185,37 @@
{
zval token;
int token_type;
+ int prev_space = 0;
token.type = 0;
while ((token_type=lex_scan(&token TSRMLS_CC))) {
switch (token_type) {
- case T_COMMENT:
- token.type = 0;
- continue;
-
case T_WHITESPACE:
- if (token.type) {
+ if (!prev_space) {
putchar(' ');
- token.type = 0;
+ prev_space = 1;
}
+ /* lack of break; is intentional */
+ case T_COMMENT:
+ token.type = 0;
continue;
- }
-
- switch (token_type) {
- case T_CLASS:
- break;
-
- default: {
+
+ case T_END_HEREDOC: {
char *ptr = LANG_SCNG(yy_text);
- if (token_type != T_END_HEREDOC) {
- fwrite(ptr, LANG_SCNG(yy_leng), 1, stdout);
- } else {
- fwrite(ptr, LANG_SCNG(yy_leng) - 1, 1, stdout);
- /* The ensure that we only write one ; and that it followed by the required newline */
- putchar('\n');
- if (ptr[LANG_SCNG(yy_leng) - 1] == ';') {
- lex_scan(&token TSRMLS_CC);
- }
- efree(token.value.str.val);
+ fwrite(ptr, LANG_SCNG(yy_leng) - 1, 1, stdout);
+ /* The ensure that we only write one ; and that it followed by the required newline */
+ putchar('\n');
+ if (ptr[LANG_SCNG(yy_leng) - 1] == ';') {
+ lex_scan(&token TSRMLS_CC);
}
+ efree(token.value.str.val);
}
break;
+
+ default:
+ fwrite(LANG_SCNG(yy_text), LANG_SCNG(yy_leng), 1, stdout);
+ break;
}
if (token.type == IS_STRING) {
@@ -237,7 +232,7 @@
break;
}
}
- token.type = 0;
+ prev_space = token.type = 0;
}
}
@@ -248,3 +243,4 @@
* indent-tabs-mode: t
* End:
*/
+