|go ahead... be a heretic|
Parsing... possible w/o too much stress ?by spurperl (Priest)
|on Mar 19, 2003 at 13:33 UTC||Need Help??|
spurperl has asked for the wisdom of the Perl Monks concerning the following question:
We have a certain internal language (a programming language, or more accurately a Hardware Description Language, like Verilog). There are full-fledged parsers for it (C + Lex + Yacc), but I have to do some simple preprocessing and wonder what is the easiest way to go...
Suppose I have some keyword, say "env", which is followed by a body within braces:
I want to rip the contents out (from the braces) into some string. Needless to say that there may be other "bodies", delimited by braces nested inside to an arbitrary level, so regexes aren't much of a help (a regex assuming just one level of nesting already looks very scary).
Thus my question: what is the easiest way to handle it ? Use some Parser module from CPAN ? I don't need, and don't want to define the full grammar of this language - I just want what's inside the braces.