J -- Agreed on the test.
-- M On Tue, Sep 28, 2010 at 2:19 PM, Jacob Helwig <[email protected]> wrote: > 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 > + �[email protected] = 10 > + �[email protected] = "here\nis\nthe\nstring\\\\'with\nextra\njunk" > + �[email protected]("'") > + > + �[email protected] == 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 >> > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.10 (GNU/Linux) > > iQGcBAEBAgAGBQJMolvWAAoJEHJabXWGiqEBVwgMAKjTw8SDlyE55C+i/MGdvddJ > /CwQk8p7151JAdBsyeLPefUsHCarUFQFA2JBlIaBzMd8ZFMskDYH9gMcINnSToKa > 5QcuwKi02nYYsVfhxyLSLkBTxuVyy/7TCbxIhyrQYD2Es32Grw6sVFYw38/GaO8L > IQYpNiMPnX7ZNs7mHPQm3B2eifDe1fyBOXzosHYstWNuHnYf9IlkZWAqe5ebVrFO > MEGCZYExFJbFxcoySDzLWh0hQlNp5XdNWFs66/P2TP7g42mFIrpsu0MtUErYCae/ > WaBvZyWXQ1ukPxldaiIyvyGFhr5bQmvpSV6PHimGUI1J6lylk9zUmEKIwjaUhmkK > uTDBiczDaTEzu+kuJ7ud8f5jBTlUcI3kja9xr/YKbNtGvhF7GXymSt5TzOEKm8zi > J5LMBBPr6PND20nPQs6d1gEf9O70zPZrtYYfl4TCB22L0qiVI9RsIHrwZ9u6L9xF > 5O194JxoNut2sHPerxgt3ZTIn8eWpFpIRxpGxePTDg== > =+dJh > -----END PGP SIGNATURE----- > > -- ----------------------------------------------------------- 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]. For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.
