summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/grammar.ra
diff options
context:
space:
mode:
authorBrice Figureau <brice-puppet@daysofwonder.com>2009-11-14 19:51:15 +0100
committertest branch <puppet-dev@googlegroups.com>2010-02-17 06:50:53 -0800
commit164f1ce85bad49c7e197deeb452828c94539e06e (patch)
tree6978a10e67447e0a28ed73dd2a0f352c4d6470df /lib/puppet/parser/grammar.ra
parentfd427a51bc2bd97656767acc7f6b48160f8e60c4 (diff)
downloadpuppet-164f1ce85bad49c7e197deeb452828c94539e06e.tar.gz
puppet-164f1ce85bad49c7e197deeb452828c94539e06e.tar.xz
puppet-164f1ce85bad49c7e197deeb452828c94539e06e.zip
Allow adding single key to hashes
This patch allow this syntax: $hash[mykey] = 12 If the key already exist an error is raised. Hashes are essentially write only, like puppet variables. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
Diffstat (limited to 'lib/puppet/parser/grammar.ra')
-rw-r--r--lib/puppet/parser/grammar.ra3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/puppet/parser/grammar.ra b/lib/puppet/parser/grammar.ra
index 6b7b31b34..76a82e38e 100644
--- a/lib/puppet/parser/grammar.ra
+++ b/lib/puppet/parser/grammar.ra
@@ -336,6 +336,9 @@ assignment: VARIABLE EQUALS expression {
variable = ast AST::Name, :value => val[0][:value], :line => val[0][:line]
result = ast AST::VarDef, :name => variable, :value => val[2], :line => val[0][:line]
}
+ | hasharrayaccess EQUALS expression {
+ result = ast AST::VarDef, :name => val[0], :value => val[2]
+}
append: VARIABLE APPENDS expression {
variable = ast AST::Name, :value => val[0][:value], :line => val[0][:line]