diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-10-04 18:24:24 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-10-04 18:24:24 +0000 |
| commit | 28cee40689440388994a4768bd301ae32c8ecc05 (patch) | |
| tree | c865ab44f4c9247052cf83de16ffc8ebe8b15e54 /lib/puppet/parser/ast/nodedef.rb | |
| parent | e0e291332bd4676962a28c7b220ae5c5e9651c0a (diff) | |
| download | puppet-28cee40689440388994a4768bd301ae32c8ecc05.tar.gz puppet-28cee40689440388994a4768bd301ae32c8ecc05.tar.xz puppet-28cee40689440388994a4768bd301ae32c8ecc05.zip | |
Merging the changes from the override-refactor branch. This is a significant rewrite of the parser, but it has little affect on the rest of the code tree.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1726 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/parser/ast/nodedef.rb')
| -rw-r--r-- | lib/puppet/parser/ast/nodedef.rb | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/lib/puppet/parser/ast/nodedef.rb b/lib/puppet/parser/ast/nodedef.rb deleted file mode 100644 index 06b104828..000000000 --- a/lib/puppet/parser/ast/nodedef.rb +++ /dev/null @@ -1,73 +0,0 @@ -class Puppet::Parser::AST - # Define a node. The node definition stores a parse tree for each - # specified node, and this parse tree is only ever looked up when - # a client connects. - class NodeDef < AST::Branch - attr_accessor :names, :code, :parentclass, :keyword, :scope - - def each - [@names,@code].each { |child| yield child } - end - - # Do implicit iteration over each of the names passed. - def evaluate(hash) - scope = hash[:scope] - names = @names.safeevaluate(:scope => scope) - - unless names.is_a?(Array) - names = [names] - end - - names.each { |name| - #Puppet.debug("defining host '%s' in scope %s" % - # [name, scope.object_id]) - # We use 'type' here instead of name, because every component - # type supports both 'type' and 'name', and 'type' is a more - # appropriate description of the syntactic role that this term - # plays. - arghash = { - :type => name, - :code => @code - } - - if @parentclass - arghash[:parentclass] = @parentclass.safeevaluate(:scope => scope) - end - - begin - node = Node.new(arghash) - node.keyword = true - scope.setnode(name, node) - rescue Puppet::ParseError => except - except.line = self.line - except.file = self.file - raise except - rescue => detail - error = Puppet::ParseError.new(detail) - error.line = self.line - error.file = self.file - raise error - end - } - end - - def initialize(hash) - @parentclass = nil - @keyword = "node" - super - end - - def tree(indent = 0) - return [ - @names.tree(indent + 1), - ((@@indline * 4 * indent) + self.typewrap("node")), - @code.tree(indent + 1), - ].join("\n") - end - - def to_s - return "node %s {\n%s }" % [@name, @code] - end - end - -end |
