in reply to Another Parse::RecDescent Question

Just like many other parsers, PRD allows for optional whitespace between 'tokens'. So, after PRD has matched a token, it will first eat all whitespace before attempting to match another token. Therefore, if you don't change the whitespace eating behaviour, PRD will never match a token that starts with whitespace. And DD_Style is a token that starts with whitespace, the regex starts with \s+?.

You can do one of two things. You can either make use of the <skip> directive (or some by some other means) to alter the 'eating of whitespace between tokens' behaviour, or you remove the leading \s+? from the DD_Style token. I'd prefer to do the latter, after all, the comment starts with the --, and not with the whitespace.

Abigail

Replies are listed 'Best First'.
Re: Re: Another Parse::RecDescent Question
by sth (Priest) on Nov 03, 2003 at 22:10 UTC

    I plan to change it. I was thinking in terms of regex, not tokens. This is my first PRD attempt, learning as I go....

    Thanks Abigail-II!