in reply to Re^2: Comment a block that match a keyword
in thread Comment a block that match a keyword
I'm nor arguing your point that my original code was a hack - I simply wanted to illustrate the value of the flip-flop operator for this type of situation, including the fact that it CAN be use properly in production level code, and that it simplifies code.
##! perl -slw use strict; my $p=0; # Counts number of unmatched parens while( <DATA> ) { ##m/\(TIMINGCHECK/ .. do {$p++ for m/\(/g; $p-- for m/\)/g;$p==0} o +r print , next; ## Faster+simpler version, plagerizing BrowserUK's paren counting m +echanism m/\(TIMINGCHECK/ .. ($p+=tr[(][(] - tr[)][)])==0 or print ,next; print "//$_" } __DATA__ (CELL ... (TIMINGCHECK .... .... ) ) (CELL (CELLTYPE "SEDFQD1") (INSTANCE uTrigger/TrcInclCtrlReg_reg[13]) (DELAY (ABSOLUTE (IOPATH CP Q (0.10:0.15:0.25)(0.09:0.15:0.24)) ) ) (TIMINGCHECK (OTHERTEST (SETUP (posedge SI) (posedge CP) (0.14:0.23:0.41)) (SETUP (negedge SI) (posedge CP) (0.09:0.16:0.30)) ....(random lines) (HOLD (negedge SI) (posedge CP) (0.00:0.00:0.00)) (HOLD (negedge D) (posedge CP) (0.00:0.00:0.00)) ) ) )
"An undefined problem has an infinite number of solutions." - Robert A. Humphrey "If you're not part of the solution, you're part of the precipitate." - Henry J. Tillman
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Comment a block that match a keyword
by BrowserUk (Patriarch) on Aug 16, 2007 at 18:43 UTC |