diff options
| author | James Turnbull <james@lovedthanlost.net> | 2008-08-14 00:32:30 +1000 |
|---|---|---|
| committer | James Turnbull <james@lovedthanlost.net> | 2008-08-17 14:02:27 +1000 |
| commit | 6676b6b104e3f60dd14be18cbfb91b4cd96ec06e (patch) | |
| tree | f8db0a5169e47ebd5b1261e73f0491c2f10b837c | |
| parent | d02f95cb608e1ee5d90ac06405e354cbc0000706 (diff) | |
| download | puppet-6676b6b104e3f60dd14be18cbfb91b4cd96ec06e.tar.gz puppet-6676b6b104e3f60dd14be18cbfb91b4cd96ec06e.tar.xz puppet-6676b6b104e3f60dd14be18cbfb91b4cd96ec06e.zip | |
Fixes #1274 - allow class names to start with numbers
| -rw-r--r-- | lib/puppet/parser/lexer.rb | 2 | ||||
| -rwxr-xr-x | spec/unit/parser/lexer.rb | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/lib/puppet/parser/lexer.rb b/lib/puppet/parser/lexer.rb index 51026ea1b..2c5f66e5a 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 9972f7268..fb666054d 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 = ""' |
