in reply to Re^6: Replace only unescaped metachars
in thread Replace only unescaped metachars

The definition would have to be: A backslash is escaped if it preceded by an unescaped backslash. Implementing that directly leads to recursion. It takes an analysis of the definition to arrive at the the odd-even rule and a simpler implementation.

Anno

Replies are listed 'Best First'.
Re^8: Replace only unescaped metachars
by ikegami (Patriarch) on Feb 22, 2007 at 21:24 UTC

    You got me there. Still not the reason why parser is better, though. The tokenizer converts strings literals to strings before the parser is involved, so the parser never even sees the escapes.