On Mon, 2010-04-26 at 14:46 -0700, Markus Roberts wrote:
> Brice --
> 
> Your patch fixes the overt behaviour (and the test is a good addition)
> but I'd favour a slightly different approach.  Since the core issue is
> that CLASSNAME (like NAME) is never valid in the ____ position of
> "blah ${___}" construct, I'd rather add the same Token#acceptable?
> test on CLASSNAME (and also CLASSREF, which appears to present the
> same challenge) as is already used on NAME, like so:
> 
> diff --git a/lib/puppet/parser/lexer.rb b/lib/puppet/parser/lexer.rb
> index 2a1f88e..a495763 100644
> --- a/lib/puppet/parser/lexer.rb
> +++ b/lib/puppet/parser/lexer.rb
> @@ -173,9 +173,11 @@ class Puppet::Parser::Lexer
>          end
>          [string_token, value]
>      end
> -    def (TOKENS[:NAME]).acceptable?(context={})
> -        ![:DQPRE,:DQMID].include? context[:after]
> -    end
> +    [:NAME,:CLASSNAME,:CLASSREF].each { |name_token|
> +        def (TOKENS[name_token]).acceptable?(context={})
> +            ![:DQPRE,:DQMID].include? context[:after]
> +        end
> +    }
>  
>      TOKENS.add_token :COMMENT, %r{#.*}, :accumulate => true, :skip =>
> true do |lexer,value|
>          value.sub!(/# ?/,'')
> 
> This basically says "it is only acceptable to generate a NAME,
> CLASSNAME, or CLASSREF in a context that isn't directly after a DQPRE
> (..."blah ${...) or a DQMID (...} blather ${...) token.
> 
> Does that seem reasonable?

Yes, it is perfect (as usual) :-)
-- 
Brice Figureau
Follow the latest Puppet Community evolutions on www.planetpuppet.org!

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to puppet-...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to