Closed woosley closed 12 years ago
Modify $skip, or supply
Also, rules that succeed returned a defined value, not a true value.
Your test for success should be defined $parser->line() or die;
On 7/24/2012 2:20 AM, WoOsley wrote:
simple if I use /\s+/ to match blanks, the match would fail, I have to use /\s*/ for temporary solution. Version is 1.967009
Aha, thanks for the clarification, can't believe I missed this part in the document.
simple if I use /\s+/ to match blanks, the match would fail, I have to use /\s*/ for temporary solution. Version is 1.967009
By default, P::RD grammars automatically skip any whitespace between tokens. In other words, before everything you explicitly tell them to match, they inject an extra invisible /\s*/ match.
That injected matcher is eating all the whitespace and preventing your /\s+/ from matching. You need to use a skip:... directive (as described in the modules manpage, under 'Terminal Separators' and 'Skipping between terminals') to change this default behaviour.
All the best,
Damian
Please see https://gist.github.com/3168999 for this issue.
simplely if I use /\s+/ to match blanks, the match would fail, I have to use /\s*/ for temporary solution. Version is 1.967009