On 2011-02-12 17:36, Brice Figureau wrote:
It appears that I'm late to the party, but:
> The following manifest was producing a parse error:
> $int = { 'eth0' => 'bla' }
> $foo = $int['eth0'] ? {
> 'bla' => 'foo',
> default => 'bleh'
> }
>
> because selectors didn't support hash access.
> diff --git a/lib/puppet/parser/grammar.ra b/lib/puppet/parser/grammar.ra
> index 7a316d4..3a386d8 100644
> --- a/lib/puppet/parser/grammar.ra
> +++ b/lib/puppet/parser/grammar.ra
> @@ -642,6 +642,7 @@ selectlhand: name
> | funcrvalue
> | boolean
> | undef
> + | hasharrayaccess
> | DEFAULT {
> result = ast AST::Default, :value => val[0][:value], :line =>
> val[0][:line]
> }
Question: why does the grammar not allow a generic rvalue here instead
of only allowing a few ways of specifying values? This question applies
to lots of other places in the grammar as well, like resource names or
function paramaters (you can't use a function call for a resource name,
and you can't specify a literal array as a function parameter, but have
to assign them to a dummy variable first).
And even so, shouldn't the above patch add "hasharrayaccesses" (plural)?
I'm not a parser expert, and this is the first time I've even looked at
grammar.ra, but as a user of Puppet I find those restrictions annoying...
/Bellman
--
You received this message because you are subscribed to the Google Groups
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-dev?hl=en.