diff options
| author | Jesse Wolfe <jes5199@gmail.com> | 2010-06-30 17:20:37 -0700 |
|---|---|---|
| committer | Markus Roberts <Markus@reality.com> | 2010-07-01 13:48:14 -0700 |
| commit | 59bf5e4c1be5eb70b6f6cfe3e725e9763ec79ece (patch) | |
| tree | d0ceae9a7357a73607d9db318752b890bd9070b1 /lib/puppet/parser/grammar.ra | |
| parent | ebd03113d2c4024a7db603e73ca9f5dab34034c8 (diff) | |
| download | puppet-59bf5e4c1be5eb70b6f6cfe3e725e9763ec79ece.tar.gz puppet-59bf5e4c1be5eb70b6f6cfe3e725e9763ec79ece.tar.xz puppet-59bf5e4c1be5eb70b6f6cfe3e725e9763ec79ece.zip | |
[#2713] Enable ELSIF
Diffstat (limited to 'lib/puppet/parser/grammar.ra')
| -rw-r--r-- | lib/puppet/parser/grammar.ra | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/lib/puppet/parser/grammar.ra b/lib/puppet/parser/grammar.ra index 545137e50..a6e64a38f 100644 --- a/lib/puppet/parser/grammar.ra +++ b/lib/puppet/parser/grammar.ra @@ -67,7 +67,7 @@ statement: resource | collection | assignment | casestatement - | ifstatement + | ifstatement_begin | import | fstatement | definition @@ -463,34 +463,41 @@ resourceref: NAME LBRACK rvalues RBRACK { result = ast AST::ResourceReference, :type => val[0], :title => val[2] } -ifstatement: IF expression LBRACE statements RBRACE else { +ifstatement_begin: IF ifstatement { + result = val[1] +} + +ifstatement: expression LBRACE statements RBRACE else { @lexer.commentpop args = { - :test => val[1], - :statements => val[3] + :test => val[0], + :statements => val[2] } - if val[5] - args[:else] = val[5] + if val[4] + args[:else] = val[4] end result = ast AST::IfStatement, args } - | IF expression LBRACE RBRACE else { + | expression LBRACE RBRACE else { @lexer.commentpop args = { - :test => val[1], + :test => val[0], :statements => ast(AST::Nop) } - if val[4] - args[:else] = val[4] + if val[3] + args[:else] = val[3] end result = ast AST::IfStatement, args } else: # nothing + | ELSIF ifstatement { + result = ast AST::Else, :statements => val[1] +} | ELSE LBRACE statements RBRACE { @lexer.commentpop result = ast AST::Else, :statements => val[2] |
