summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
authorBrice Figureau <brice-puppet@daysofwonder.com>2010-04-23 20:41:29 +0200
committertest branch <puppet-dev@googlegroups.com>2010-02-17 06:50:53 -0800
commit9ddee72e05af79ab7f453b37e9497dca33f7d5ba (patch)
treebf0a233689c15f54a1c76fd8eb0fe32383233728 /lib/puppet
parenta32381e822779b56030f6bd7009cd978970cecd2 (diff)
downloadpuppet-9ddee72e05af79ab7f453b37e9497dca33f7d5ba.tar.gz
puppet-9ddee72e05af79ab7f453b37e9497dca33f7d5ba.tar.xz
puppet-9ddee72e05af79ab7f453b37e9497dca33f7d5ba.zip
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@daysofwonder.com>
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/parser/lexer.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/puppet/parser/lexer.rb b/lib/puppet/parser/lexer.rb
index def462129..c3c53a528 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