Refer to Parse::RecDescent's <skip> directive:
For the purpose of matching, each terminal in a production is considered to be preceded by a "prefix" - a pattern which must be matched before a token match is attempted. By default, the prefix is optional whitespace (which always matches, at least trivially), but this default may be reset in any production.
That's a convoluted way of saying all productions are implicitly prefixed with a /\s*/ rule. This can be overridden as follows:
... doc: <skip:""> segment(s) { $return =1; } ...
output ====== got a IEA (~\n) got a IEA (~\n) got a IEA (\n) got a IEA (\n)
In reply to Re: newlines in Parse::RecDescent
by ikegami
in thread newlines in Parse::RecDescent
by kgoess
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |