+1
On Wed, Oct 20, 2010 at 10:28 AM, Markus Roberts <[email protected]>wrote:
>
>
> Did this code change? It looks exactly the same to me.
>
>
> Yes, it did. I have no idea why the changes didn't come through in the
> email (I probably goofed something up when I did "rake mail_patches" but
> offhand I can't say what. The present version (copied below from "git log
> -U" fixes the commit messages ("/" vs. "\") and changes the string in the
> test (though not exactly to the wording you suggested):
>
> commit 3b53bfcd0dd20a43c751b2b0d5dbb0e3463ef47b
> Author: Markus Roberts <[email protected]>
> Date: Mon Oct 18 14:25:17 2010 -0700
>
> Fix for #5022 -- Escaped newlines should be elided
>
>
> This was a regression, not covered by a test; previously the string
>
> "foo\
> bar"
>
> would be interpreded as "foobar" but this was changed to "foo\\\nbar"
> in
> 2.6.x with my string interpolation refactor. This change restores the
> behaviour.
>
> diff --git a/lib/puppet/parser/lexer.rb b/lib/puppet/parser/lexer.rb
> index 9036d65..31d39ae 100644
> --- a/lib/puppet/parser/lexer.rb
> +++ b/lib/puppet/parser/lexer.rb
> @@ -522,13 +522,14 @@ class Puppet::Parser::Lexer
> # backslash; the caret is there to match empty strings
> 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.
> +++ b/lib/puppet/parser/lexer.rb
> @@ -522,13 +522,14 @@ class Puppet::Parser::Lexer
> # backslash; the caret is there to match empty strings
> 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!(/\\(.)/) {
> + str.gsub!(/\\(.)/m) {
> ch = $1
> if escapes.include? ch
> case ch
> when 'n'; "\n"
> when 't'; "\t"
> when 's'; " "
> + when "\n": ''
> else ch
> end
> else
> diff --git a/spec/unit/parser/lexer_spec.rb
> b/spec/unit/parser/lexer_spec.rb
> index 2d67bf3..d52add3 100755
>
> --- a/spec/unit/parser/lexer_spec.rb
> +++ b/spec/unit/parser/lexer_spec.rb
> @@ -424,6 +424,7 @@ describe Puppet::Parser::Lexer,"when lexing strings" do
> %q{'single quoted string with an escaped "\\\\"'} =>
> [[:STRING,'single quoted string with an escaped "\\\\"']],
> %q{"string with an escaped '\\"'"} =>
> [[:STRING,"string with an escaped '\"'"]],
> %q{"string with an escaped '\\$'"} =>
> [[:STRING,"string with an escaped '$'"]],
> + %Q{"string with a line ending with a backslash: \\\nfoo"} =>
> [[:STRING,"string with a line ending with a backslash: foo"]],
>
> %q{"string with $v (but no braces)"} =>
> [[:DQPRE,"string with "],[:VARIABLE,'v'],[:DQPOST,' (but no braces)']],
> %q["string with ${v} in braces"] =>
> [[:DQPRE,"string with "],[:VARIABLE,'v'],[:DQPOST,' in braces']],
> %q["string with ${qualified::var} in braces"] =>
> [[:DQPRE,"string with "],[:VARIABLE,'qualified::var'],[:DQPOST,' in
> braces']],
>
>
> -- M
> -----------------------------------------------------------
> The power of accurate observation is
> commonly called cynicism by those
> who have not got it. ~George Bernard Shaw
> ------------------------------------------------------------
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Developers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<puppet-dev%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/puppet-dev?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-dev?hl=en.