use Regexp::Common qw/comment/; local $/; $_ = <DATA>; s/(^[ \t]*$RE{comment}{C}\n|$RE{comment}{C})//gm; print; __DATA__ /*This is a bogus function*/ void function foo(void) /*My function is the best*/ { int i; /*i is an integer*/ int j; /*j is also an integer*/ /*Now I'm going to set i to 1*/ i = 1; /*Also j*/ j = 1; /*Here's some incrementing!*/ i++; /*And more!*/ j++; /*The end!*/} __OUTPUT__ void function foo(void) { int i; int j; i = 1; j = 1; i++; j++; }
In reply to Re^3: Modify C comment removal code to kill newlines
by borisz
in thread Modify C comment removal code to kill newlines
by anjiro
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |