[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 0.25.5-639-g8f94f35

test branch puppet-dev at googlegroups.com
Wed Jul 14 10:33:59 UTC 2010


The following commit has been merged in the upstream branch:
commit 9ddee72e05af79ab7f453b37e9497dca33f7d5ba
Author: Brice Figureau <brice-puppet at daysofwonder.com>
Date:   Fri Apr 23 20:41:29 2010 +0200

    Fix #3664 - qualified variable parsing in string interpolation
    
    "${myclass::var}" was lexed as a CLASSNAME instead of a VARIABLE token,
    giving an error while parsing because a rvalue can't be a bare CLASSNAME
    token.
    
    This patch fixes the issue by making VARIABLE lexing higher priority than
    CLASSNAME.
    
    Signed-off-by: Brice Figureau <brice-puppet at daysofwonder.com>

diff --git a/lib/puppet/parser/lexer.rb b/lib/puppet/parser/lexer.rb
index def4621..c3c53a5 100644
--- a/lib/puppet/parser/lexer.rb
+++ b/lib/puppet/parser/lexer.rb
@@ -108,6 +108,12 @@ class Puppet::Parser::Lexer
     end
 
     TOKENS = TokenList.new
+
+    TOKENS.add_token :VARIABLE, %r{(\w*::)*\w+}
+    def (TOKENS[:VARIABLE]).acceptable?(context={})
+        [:DQPRE,:DQMID].include? context[:after]
+    end
+
     TOKENS.add_tokens(
         '[' => :LBRACK,
         ']' => :RBRACK,
@@ -231,10 +237,6 @@ class Puppet::Parser::Lexer
         [TOKENS[:VARIABLE],value[1..-1]]
     end
 
-    TOKENS.add_token :VARIABLE, %r{(\w*::)*\w+}
-    def (TOKENS[:VARIABLE]).acceptable?(context={})
-        [:DQPRE,:DQMID].include? context[:after]
-    end
 
 
     TOKENS.sort_tokens
diff --git a/spec/unit/parser/lexer.rb b/spec/unit/parser/lexer.rb
index b1524f1..204cde7 100755
--- a/spec/unit/parser/lexer.rb
+++ b/spec/unit/parser/lexer.rb
@@ -413,6 +413,7 @@ describe Puppet::Parser::Lexer,"when lexing strings" do
         %q["string with an escaped '\\$'"]                              => [[:STRING,"string with an escaped '$'"]],
         %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']],
         %q["string with $v and $v (but no braces)"]                     => [[:DQPRE,"string with "],[:VARIABLE,"v"],[:DQMID," and "],[:VARIABLE,"v"],[:DQPOST," (but no braces)"]],
         %q["string with ${v} and ${v} in braces"]                       => [[:DQPRE,"string with "],[:VARIABLE,"v"],[:DQMID," and "],[:VARIABLE,"v"],[:DQPOST," in braces"]],
         %q["string with ${'a nested single quoted string'} inside it."] => [[:DQPRE,"string with "],[:STRING,'a nested single quoted string'],[:DQPOST,' inside it.']],

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list