Provided we squash in a test for this: +1

Something like the following?

diff --git i/spec/unit/parser/lexer_spec.rb w/spec/unit/parser/lexer_spec.rb
index b27980b..2ada297 100755
--- i/spec/unit/parser/lexer_spec.rb
+++ w/spec/unit/parser/lexer_spec.rb
@@ -30,6 +30,14 @@ describe Puppet::Parser::Lexer do
 
       @lexer.line.should == 10
     end
+
+    it "should not think the terminator is escaped, when preceeded by an even 
number of backslashes" do
+        @lexer.line = 10
+        @lexer.string = "here\nis\nthe\nstring\\\\'with\nextra\njunk"
+        @lexer.slurpstring("'")
+
+        @lexer.line.should == 13
+    end
   end
 end

-- 
Jacob Helwig

On Tue, 28 Sep 2010 12:07:46 -0700, Markus Roberts wrote:
> 
> 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.
> 
> Signed-off-by: Markus Roberts <[email protected]>
> ---
>  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 a25a17e..9036d65 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
> -- 
> 1.7.0.4
> 

Attachment: signature.asc
Description: Digital signature

Reply via email to