[Israel.pm] Sophisticated text processing tools
Jason.Elbaum at motorola.com
Sun Feb 8 06:12:12 PST 2004
Gaal Yahas wrote:
> Take a look at the pos function, and the \G regexp metacharacter.
I will. Thanks.
> But if you're doing source code analysis and you want it to be robust,
> you really need a parser.
I'd like to see how far I can get without one first.
> (I hope you're not trying to parse Perl.)
Worse - C++.
> Parse::RecDescent comes with a c grammar, if that's what you're after;
> grammars for Java and C++ I'm sure are available online.
Last time I tried using the C grammar from Parse::RecDescent, it failed
miserably. In any case, C++ is horribly difficult to parse, since the
syntactical meaning of an identifier depends on the contents of the
symbol table. There are very few complete open source C++ parsers
available anywhere, and they are pretty much all written in C or C++.
Since the code changes I need to make are local, I'm hopeful that I can
do without a parser. Assuming the code is reasonably conventional, I
(hopefully) won't need to be able to parse it.
> In some cases
> you'll get by with straight regexps but that's only if your source is
> strictly formatted.
I don't expect the code to be strictly formatted. That's why I'm looking
for more powerful tools than regexps.
More information about the Perl