HomePhorge

Fix for #4236 -- Only interpolate $ if followed by a variable
4822de3f95e0Unpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

Fix for #4236 -- Only interpolate $ if followed by a variable

This is a modification of the Nick/Jesse/Matt patch, retaining their tests and
the analysis of the problem but reversing the implementation direction of the
solution.

Rather than trying to make the already somewhat brittle slurpstring smarter,
which requires telling it what following strings will be accepted by the caller
with a zero-width-lookahead negation of the regular expression used to extract
a variable name, this patch keeps that responsibility in the caller where it
belongs.

The caller (tokenize_interpolated_string) now checks to see if it got a
variable name _before_ emitting a variable token; if it got one, it proceeds
normally, but if it didn't it simply tries again from that point in the string
(accumulating the false match as a prefix). This change actually simplifies
the logic of tokenize_interpolated_string somewhat.

Details

Provenance
Markus Roberts <Markus@reality.com>Authored on
vanmeeuwenPushed on Jun 2 2015, 2:22 PM
Parents
rPUb509032e559c: Fix #4238 - if should match undef as ''
Branches
Unknown
Tags
Unknown

Event Timeline

Markus Roberts <Markus@reality.com> committed rPU4822de3f95e0: Fix for #4236 -- Only interpolate $ if followed by a variable (authored by Markus Roberts <Markus@reality.com>).Jul 19 2010, 4:44 AM