summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/grammar.ra
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/parser/grammar.ra')
-rw-r--r--lib/puppet/parser/grammar.ra43
1 files changed, 26 insertions, 17 deletions
diff --git a/lib/puppet/parser/grammar.ra b/lib/puppet/parser/grammar.ra
index 7f07cc322..23c2934b9 100644
--- a/lib/puppet/parser/grammar.ra
+++ b/lib/puppet/parser/grammar.ra
@@ -79,7 +79,13 @@ fstatement: NAME LPAREN funcvalues RPAREN {
:arguments => args,
:ftype => :statement
}
- | NAME LPAREN RPAREN {
+ | NAME LPAREN funcvalues COMMA RPAREN {
+ args = aryfy(val[2])
+ result = ast AST::Function,
+ :name => val[0],
+ :arguments => args,
+ :ftype => :statement
+} | NAME LPAREN RPAREN {
result = ast AST::Function,
:name => val[0],
:arguments => AST::ASTArray.new({}),
@@ -93,15 +99,22 @@ fstatement: NAME LPAREN funcvalues RPAREN {
:ftype => :statement
}
-funcvalues: namestrings
- | resourcerefs
-
-namestrings: namestring
- | namestrings COMMA namestring {
+funcvalues: namestring
+ | resourceref
+ | funcvalues COMMA namestring {
result = aryfy(val[0], val[2])
result.line = @lexer.line
result.file = @lexer.file
}
+ | funcvalues COMMA resourceref {
+ unless val[0].is_a?(AST::ASTArray)
+ val[0] = aryfy(val[0])
+ end
+
+ val[0].push(val[2])
+
+ result = val[0]
+}
# This is *almost* an rvalue, but I couldn't get a full
# rvalue to work without scads of shift/reduce conflicts.
@@ -116,17 +129,6 @@ namestring: name
result = ast AST::Name, :value => val[0]
}
-resourcerefs: resourceref
- | resourcerefs COMMA resourceref {
- unless val[0].is_a?(AST::ASTArray)
- val[0] = aryfy(val[0])
- end
-
- val[0].push(val[2])
-
- result = val[0]
-}
-
resource: classname LBRACE resourceinstances endsemi RBRACE {
array = val[2]
if array.instance_of?(AST::ResourceInstance)
@@ -701,6 +703,13 @@ array: LBRACK rvalues RBRACK {
else
result = ast AST::ASTArray, :children => [val[1]]
end
+}
+ | LBRACK rvalues COMMA RBRACK {
+ if val[1].instance_of?(AST::ASTArray)
+ result = val[1]
+ else
+ result = ast AST::ASTArray, :children => [val[1]]
+ end
} | LBRACK RBRACK {
result = ast AST::ASTArray
}