diff options
| author | Markus Roberts <Markus@reality.com> | 2010-09-28 11:50:56 -0700 |
|---|---|---|
| committer | Markus Roberts <Markus@reality.com> | 2010-09-28 19:42:06 -0700 |
| commit | 53a2bea4ddad0a9f0d537fd8833a437ed2376889 (patch) | |
| tree | ea4e3973c32120fa753eb984a964e7f961c162b1 /lib/puppet | |
| parent | d12e477326a645f75cc58cc0ad7e4fd3ec7eee23 (diff) | |
| download | puppet-53a2bea4ddad0a9f0d537fd8833a437ed2376889.tar.gz puppet-53a2bea4ddad0a9f0d537fd8833a437ed2376889.tar.xz puppet-53a2bea4ddad0a9f0d537fd8833a437ed2376889.zip | |
Fix for #4804 -- escaped backslashes in interpolated strings
Part of the ongoing refinement / cleanup of the string interpolation semantics.
When scanning for an unescaped string terminator we now also allow an 0 or more
pairs of backslashes (that is, escaped backslashes) before the terminator.
Thanks to Jacob for the test I should have added.
Diffstat (limited to 'lib/puppet')
| -rw-r--r-- | lib/puppet/parser/lexer.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/puppet/parser/lexer.rb b/lib/puppet/parser/lexer.rb index a25a17e3f..9036d652e 100644 --- a/lib/puppet/parser/lexer.rb +++ b/lib/puppet/parser/lexer.rb @@ -520,7 +520,7 @@ class Puppet::Parser::Lexer def slurpstring(terminators,escapes=%w{ \\ $ ' " n t s }+["\n"],ignore_invalid_escapes=false) # we search for the next quote that isn't preceded by a # backslash; the caret is there to match empty strings - str = @scanner.scan_until(/([^\\]|^)[#{terminators}]/) or lex_error "Unclosed quote after '#{last}' in '#{rest}'" + str = @scanner.scan_until(/([^\\]|^|[^\\])([\\]{2})*[#{terminators}]/) or lex_error "Unclosed quote after '#{last}' in '#{rest}'" @line += str.count("\n") # literal carriage returns add to the line count. str.gsub!(/\\(.)/) { ch = $1 |
