rodent has asked for the wisdom of the Perl Monks concerning the following question:
I've been digging high and low for a perl module that is capable of parsing, and modifying C source code "on the fly" and generate a new .c file for use during the compilation process. I use perl quite regularly in my build process and I thought that it would be easily up to the task...
Essentially I'm trying to reproduce the behaviour of the old unix xstr command, but have found VERY little in terms of useful code.
At the moment, I'm using a while(<FILE>) and a silly regex to try to extract and replace the strings, but I'm not getting all syntactical cases of string literals in the C code.
Has anyone attempted this before, or have a port of xstr to perl, or know of decent regex, or perl module that is up to this task. I've dug through CPAN but without much success...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regex to extract/modify C source string literals? (cheap)
by tye (Sage) on May 29, 2003 at 16:48 UTC | |
|
Re: Regex to extract/modify C source string literals?
by educated_foo (Vicar) on May 29, 2003 at 14:31 UTC |