There's more than one way to do things | |
PerlMonks |
Re^2: Random Tips on Parse::RecDescentby Anonymous Monk |
on Apr 27, 2012 at 10:53 UTC ( [id://967587]=note: print w/replies, xml ) | Need Help?? |
The example in random tip #16 does not explicitly spell out that you need to : use Text::DelimMatch;and in the grammar definition you need a rule : newline: "\n"With those two things in place the code works fine for parsing multi line HTML comments. Parsing multi line C style comments is complicated by the fact that * is a regexp character so it needs escaping. I managed to get the following code to work OK based on technique outlined in the tip. I'm sure it could be done better but I was struggling with the escaping
and the grammar rules :
Successfully matches the following example :
Hope this may help someone Adrian
In Section
Meditations
|
|