From 9ddee72e05af79ab7f453b37e9497dca33f7d5ba Mon Sep 17 00:00:00 2001 From: Brice Figureau Date: Fri, 23 Apr 2010 20:41:29 +0200 Subject: 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 --- lib/puppet/parser/lexer.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'lib/puppet/parser') 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 -- cgit