diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-08-22 23:34:40 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-08-22 23:34:40 +0000 |
| commit | 4151fd59ef6490c875140a874c0a13c5d3f311aa (patch) | |
| tree | ceb265c6fdc52fa46889737263d2d5d8c3819a41 /lib/puppet/parser/grammar.ra | |
| parent | 1b2ee4bb9d9fef44bdf8217f45d6893b7609a432 (diff) | |
| download | puppet-4151fd59ef6490c875140a874c0a13c5d3f311aa.tar.gz puppet-4151fd59ef6490c875140a874c0a13c5d3f311aa.tar.xz puppet-4151fd59ef6490c875140a874c0a13c5d3f311aa.zip | |
Committing definition inheritance. I have not yet written tests yet, but my last commit pretty seriously broke some things without me realizing it, so I wanted to get this in.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1484 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/parser/grammar.ra')
| -rw-r--r-- | lib/puppet/parser/grammar.ra | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/lib/puppet/parser/grammar.ra b/lib/puppet/parser/grammar.ra index 9a5fb68a9..673c41a9f 100644 --- a/lib/puppet/parser/grammar.ra +++ b/lib/puppet/parser/grammar.ra @@ -400,22 +400,38 @@ import: IMPORT quotedtext { } } -definition: DEFINE NAME argumentlist LBRACE statements RBRACE { - result = ast AST::CompDef, +definition: DEFINE NAME argumentlist parent LBRACE statements RBRACE { + args = { + :type => ast(AST::Name, :value => val[1]), :args => val[2], :keyword => val[0], - :code => val[4] -} | DEFINE NAME argumentlist LBRACE RBRACE { - result = ast AST::CompDef, + :code => val[5] + } + + if val[3].instance_of?(AST::Name) + args[:parentclass] = val[3] + end + result = ast AST::CompDef, args +} | DEFINE NAME argumentlist parent LBRACE RBRACE { + args = { + :type => ast(AST::Name, :value => val[1]), :args => val[2], :keyword => val[0], - :code => ast(AST::ASTArray, :children => []) + :code => ast(AST::ASTArray) + } + + if val[3].instance_of?(AST::Name) + args[:parentclass] = val[3] + end + + result = ast AST::CompDef,args } #hostclass: CLASS NAME argumentlist parent LBRACE statements RBRACE { hostclass: CLASS NAME parent LBRACE statements RBRACE { #:args => val[2], args = { + :type => ast(AST::Name, :value => val[1]), :keyword => val[0], :code => val[4] } @@ -426,6 +442,7 @@ hostclass: CLASS NAME parent LBRACE statements RBRACE { result = ast AST::ClassDef, args } | CLASS NAME parent LBRACE RBRACE { args = { + :type => ast(AST::Name, :value => val[1]), :keyword => val[0], :code => ast(AST::ASTArray, :children => []) } |
