in reply to Parse::RecDescent: problem with grammar and error reporting

Seems to me like the best way to define text would be something like:

/( \\@ | \\\\ | [^\\@\r\n] )*/x

In other words, text is sero or more occurances of any of:

Replies are listed 'Best First'.
Re^2: Parse::RecDescent: problem with grammar and error reporting
by locked_user sundialsvc4 (Abbot) on Jan 23, 2012 at 13:49 UTC

    And the other approach says that the text is a series of “tokens,” using e.g. the definitions you give here.   That is the first stage of a good parser ... the so-called “lexer.”   The fun begins when you have to deal with the structures that this stream-of-tokens can take.   That is the upper-half of a parser ... and the point where its real power comes to play.

    I say this, merely to describe situations where a full-blown Parser is extremely useful.   If “all that you really need is a lexer,” and the structure of the “language” is so straightforward that you really are not in need of decision-making to decide what you have and/or what to do, then a Parser might (or, might not ...) be overkill.   The time to make these decisions is early.