HomePhorge

(PUP-2581) Make illegal names interchangeable to legal variable work
c1d9cce436d6Unpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

(PUP-2581) Make illegal names interchangeable to legal variable work

In interpolation when using expression mode ${} and having an illegal
name (e.g. _x) that resulted in a syntax error as the _x got translated
to a STRING token (a bare word not being a name). The interpolation
logic could then not transform it into a (valid) variable expression
(i.e. $_x).

The change is to let the lexer emit a WORD token for the illegal NAME.
The interpolation then changes that to a VARIBLE if it is the only
expression. If the WORD token escapes into the grammar, it is equivalent
to having used a quoted string in the source text.

Note that WORD only accepts unqualified input, anything with a : that is
not a valid NAME is still flagged as an error. Thus _x::y, x::_y are
both illegal NAME.

Details

Provenance
Henrik Lindberg <henrik.lindberg@cloudsmith.com>Authored on
vanmeeuwenPushed on Jun 2 2015, 2:22 PM
Parents
rPU35db4e4415a9: Merge pull request #2654 from peterhuene/pup/2182
Branches
Unknown
Tags
Unknown

Event Timeline

Henrik Lindberg <henrik.lindberg@cloudsmith.com> committed rPUc1d9cce436d6: (PUP-2581) Make illegal names interchangeable to legal variable work (authored by Henrik Lindberg <henrik.lindberg@cloudsmith.com>).May 16 2014, 3:08 AM