[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. debian/0.24.6-1-356-g5718585

James Turnbull james at lovedthanlost.net
Fri Jan 23 14:20:48 UTC 2009


The following commit has been merged in the master branch:
commit 6676b6b104e3f60dd14be18cbfb91b4cd96ec06e
Author: James Turnbull <james at lovedthanlost.net>
Date:   Thu Aug 14 00:32:30 2008 +1000

    Fixes #1274 - allow class names to start with numbers

diff --git a/lib/puppet/parser/lexer.rb b/lib/puppet/parser/lexer.rb
index 51026ea..2c5f66e 100644
--- a/lib/puppet/parser/lexer.rb
+++ b/lib/puppet/parser/lexer.rb
@@ -131,7 +131,7 @@ class Puppet::Parser::Lexer
 
     TOKENS.add_tokens "Whatever" => :DQTEXT, "Nomatter" => :SQTEXT, "alsonomatter" => :BOOLEAN
 
-    TOKENS.add_token :NAME, %r{[a-z][-\w]*} do |lexer, value|
+    TOKENS.add_token :NAME, %r{[a-z0-9][-\w]*} do |lexer, value|
         string_token = self
         # we're looking for keywords here
         if tmp = KEYWORDS.lookup(value)
diff --git a/spec/unit/parser/lexer.rb b/spec/unit/parser/lexer.rb
index 9972f72..fb66605 100755
--- a/spec/unit/parser/lexer.rb
+++ b/spec/unit/parser/lexer.rb
@@ -378,6 +378,15 @@ describe "Puppet::Parser::Lexer in the old tests" do
         }
     end
 
+    it "should correctly parse names with numerals" do
+       string = %w{1name name1 11names names11}
+    
+       string.each { |t|
+            @lexer.string = t
+            @lexer.fullscan.should == [[:NAME,t],[false,false]]
+       }
+    end
+
     it "should correctly parse empty strings" do
         bit = '$var = ""'
 

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list