In the contents of COPY/ADD, we perform expansion on variables using a
lexer. However, this lexer, by default, removes quotes as well as
expanding variables - this isn't really the kind of behavior we're
after, as it feels quite unintuitive.
To fix this, we introduce a new ExpandRaw function, which commands can
implement that implement an alternative expansion that preserves quotes
(and possibly other characters/features in the future).
Additionally, we introduce new tests to more clearly define the desired
behavior. One major note is that backslashes are not passed directly,
and are processed, following normal escape rules (so that we can use `$`
symbols directly).
Signed-off-by: Justin Chadwell <me@jedevc.com>
Previously, heredoc names were restricted to simple alphanumeric
strings. However, heredocs should support much more complex use-cases,
including quoting anywhere, as well as allowing special symbols like `.`
for easily expressing file extensions.
This patch adds support for these more complex cases, by using the shell
lexer to parse each heredoc name. Additionally, we include improvements
to the lexer to optionally preserve escape tokens to avoid problems when
lexing words that have already been lexed before.
Signed-off-by: Justin Chadwell <me@jedevc.com>