Edit report at http://bugs.php.net/bug.php?id=53622&edit=1

 ID:                 53622
 Updated by:         johan...@php.net
 Reported by:        mnelson at teshy dot com
 Summary:            CLI -w separate functions of striping whitespace and
                     comments
 Status:             Open
 Type:               Feature/Change Request
 Package:            CGI related
 Operating System:   all
 PHP Version:        5.3.4
 Block user comment: N
 Private report:     N

 New Comment:

I didn't test the patch but two comments: The simple one is that the
documentation in the man page is missing.



The more complex one is around single line comments. T_COMMENT includes
the trailing new line. So I assume that



<?php

foo();

// some comment

bar();

?>



would become



<?php

foo();bar();

?>



Such issues make me believe more and more in specialized tools like
mentioned above :-)


Previous Comments:
------------------------------------------------------------------------
[2011-01-04 16:01:25] ahar...@php.net

I tend to agree, but I implemented it anyway. :)



Quick and dirty patch against trunk attached.

------------------------------------------------------------------------
[2011-01-04 16:01:20] ahar...@php.net

The following patch has been added/updated:

Patch Name: strip-comments-whitespace
Revision:   1294153279
URL:       
http://bugs.php.net/patch-display.php?bug=53622&patch=strip-comments-whitespace&revision=1294153279

------------------------------------------------------------------------
[2011-01-01 01:57:40] johan...@php.net

I believe it is better to do this in userland. I'd actually drop the -w
flag completely. Keeping the bug open so people can disagree and
implement it :-)



btw. a userspace beautifier is on
http://pear.php.net/package/PHP_Beautifier

------------------------------------------------------------------------
[2010-12-28 17:44:55] mnelson at teshy dot com

Description:
------------
It would be useful if The Command line option "-w" for stripping
comments and 

whitespace was broken down into separate commands. One for striping
whitespace and 

one for striping comments, the commands could be combined for users that
want 

both. 



In our use case we have code that has become unreadable and needs
excessive 

whitespace removed so it can be reformatted properly, we however want to
keep all 

code comments.



------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=53622&edit=1

Reply via email to