Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^3: Modify C comment removal code to kill newlines

by borisz (Canon)
on Aug 21, 2006 at 15:37 UTC ( [id://568582]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Modify C comment removal code to kill newlines
in thread Modify C comment removal code to kill newlines

Ok, try this. It looks perfect to me on UNIX.
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++; }
Boris

Replies are listed 'Best First'.
Re^4: Modify C comment removal code to kill newlines
by anjiro (Beadle) on Aug 21, 2006 at 17:24 UTC
    Congratulations, sir! You are a winner! Works perfectly on my horrible convolutedly commented code!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://568582]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-03-29 07:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found