Re: q and escaping paired delimiters
On Sun, 27 Jul 1997 19:57:31 EDT, Kenneth Albanowski wrote:
>In fact, the code in toke.c looks a little suspicious, as if a cut'n'paste
>error happened, and the balanced branch didn't get the cleanup it
>deserved. There's a "if term != '\\'" statement that does nothing, for
>example.
Keen. That same deadcode was in one of my post 4_01 patches
too (it does no damage, but like you say it serves no purpose
either).
>Here'a patch over 5.004_01 (although I'd expect it to work with most
>versions) to allow you to escape both the starting and end quotes for q
>(unbalanced and qq is unchanged), and the obligatory addition to the
>tests. If nobody has any complaints, I expect this will be in _02.
The toke.c hunk is "dangerous", in the sense that GNU patch will
apply it to the wrong branch, if it needs to offset the patch
due to later patches having been applied. This is thanks to
the two branches having the exact same 8 lines of code.
I of course recommend the change you suggest, and to prove
my faith, I attach my own version, which:
* eliminates the same deadcode in one of my later patches
* uses the more meaningful names in the balanced branch
* doesn't provoke the GNU patch problem with inadequate
context
Credited: Kenneth Albanowski <kjahds@kjahds.com>
p5p-msgid:
199707280516.BAA14055@aatma.engin.umich.edu