[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, experimental, updated. debian/2.6.8-1-844-g7ec39d5

Paul Berry paul at puppetlabs.com
Tue May 10 07:58:52 UTC 2011


The following commit has been merged in the experimental branch:
commit 4da88fb4cd57871f16649d50572240ac3f7420f0
Author: Paul Berry <paul at puppetlabs.com>
Date:   Fri Aug 13 15:43:34 2010 -0700

    [#4496]+[#4521]+[#4522] Add structures to the AST to represent type definitions (classes, definitions, and nodes).
    
    Previously, type definitions were not represented directly in the AST.
    Instead, the parser would instantiate types and insert them into
    known_resource_types as soon as they were parsed.  This made it
    difficult to distinguish which types had come from the file that was
    just parsed and which types had been loaded previously, which led to
    bug 4496.
    
    A side-effect of this change is that the user is no longer allowed to
    define types inside of conditional constructs (such as if/else).  This
    was allowed before but had unexpected semantics (bugs 4521 and 4522).
    
    It is still possible, however, to place an "include" statement inside
    a conditional construct, and have that "include" statement trigger the
    autoloading of a file that instantiates types.

diff --git a/lib/puppet/node/environment.rb b/lib/puppet/node/environment.rb
index ad11a04..3d55ac1 100644
--- a/lib/puppet/node/environment.rb
+++ b/lib/puppet/node/environment.rb
@@ -81,7 +81,7 @@ class Puppet::Node::Environment
     Thread.current[:known_resource_types] ||= synchronize {
       if @known_resource_types.nil? or @known_resource_types.stale?
         @known_resource_types = Puppet::Resource::TypeCollection.new(self)
-        perform_initial_import
+        @known_resource_types.import_ast(perform_initial_import, '')
       end
       @known_resource_types
     }
@@ -146,13 +146,13 @@ class Puppet::Node::Environment
   private
 
   def perform_initial_import
-    return if Puppet.settings[:ignoreimport]
+    return empty_parse_result if Puppet.settings[:ignoreimport]
     parser = Puppet::Parser::Parser.new(self)
     if code = Puppet.settings.uninterpolated_value(:code, name.to_s) and code != ""
       parser.string = code
     else
       file = Puppet.settings.value(:manifest, name.to_s)
-      return unless File.exist?(file)
+      return empty_parse_result unless File.exist?(file)
       parser.file = file
     end
     parser.parse
@@ -163,5 +163,11 @@ class Puppet::Node::Environment
     raise error
   end
 
+  def empty_parse_result
+    # Return an empty toplevel hostclass to use as the result of
+    # perform_initial_import when no file was actually loaded.
+    return Puppet::Parser::AST::Hostclass.new('')
+  end
+
   @root = new(:'*root*')
 end
diff --git a/lib/puppet/parser/ast.rb b/lib/puppet/parser/ast.rb
index 54e034a..0369a6d 100644
--- a/lib/puppet/parser/ast.rb
+++ b/lib/puppet/parser/ast.rb
@@ -107,22 +107,26 @@ end
 require 'puppet/parser/ast/arithmetic_operator'
 require 'puppet/parser/ast/astarray'
 require 'puppet/parser/ast/asthash'
-require 'puppet/parser/ast/branch'
 require 'puppet/parser/ast/boolean_operator'
+require 'puppet/parser/ast/branch'
 require 'puppet/parser/ast/caseopt'
 require 'puppet/parser/ast/casestatement'
 require 'puppet/parser/ast/collection'
 require 'puppet/parser/ast/collexpr'
 require 'puppet/parser/ast/comparison_operator'
+require 'puppet/parser/ast/definition'
 require 'puppet/parser/ast/else'
 require 'puppet/parser/ast/function'
+require 'puppet/parser/ast/hostclass'
 require 'puppet/parser/ast/ifstatement'
 require 'puppet/parser/ast/in_operator'
 require 'puppet/parser/ast/leaf'
 require 'puppet/parser/ast/match_operator'
 require 'puppet/parser/ast/minus'
+require 'puppet/parser/ast/node'
 require 'puppet/parser/ast/nop'
 require 'puppet/parser/ast/not'
+require 'puppet/parser/ast/relationship'
 require 'puppet/parser/ast/resource'
 require 'puppet/parser/ast/resource_defaults'
 require 'puppet/parser/ast/resource_override'
@@ -131,4 +135,3 @@ require 'puppet/parser/ast/resourceparam'
 require 'puppet/parser/ast/selector'
 require 'puppet/parser/ast/tag'
 require 'puppet/parser/ast/vardef'
-require 'puppet/parser/ast/relationship'
diff --git a/lib/puppet/parser/ast/astarray.rb b/lib/puppet/parser/ast/astarray.rb
index 529998e..432300c 100644
--- a/lib/puppet/parser/ast/astarray.rb
+++ b/lib/puppet/parser/ast/astarray.rb
@@ -9,6 +9,11 @@ class Puppet::Parser::AST
   class ASTArray < Branch
     include Enumerable
 
+    # True if this ASTArray represents a list of statements in a
+    # context that defines a namespace.  Classes and definitions may
+    # only appear in such a context.
+    attr_accessor :is_a_namespace
+
     # Return a child by index.  Probably never used.
     def [](index)
       @children[index]
@@ -32,7 +37,19 @@ class Puppet::Parser::AST
       }
 
       rets = items.flatten.collect { |child|
-        child.safeevaluate(scope)
+        if child.respond_to? :instantiate
+          if is_a_namespace
+            # no problem, just don't evaluate it.
+          else
+            msg = "Classes, definitions, and nodes may only appear at toplevel or inside other classes"
+            error = Puppet::Error.new(msg)
+            error.line = child.line
+            error.file = child.file
+            raise error
+          end
+        else
+          child.safeevaluate(scope)
+        end
       }
       rets.reject { |o| o.nil? }
     end
diff --git a/lib/puppet/parser/ast/definition.rb b/lib/puppet/parser/ast/definition.rb
new file mode 100644
index 0000000..09f52b5
--- /dev/null
+++ b/lib/puppet/parser/ast/definition.rb
@@ -0,0 +1,12 @@
+require 'puppet/parser/ast/top_level_construct'
+
+class Puppet::Parser::AST::Definition < Puppet::Parser::AST::TopLevelConstruct
+  def initialize(name, context = {})
+    @name = name
+    @context = context
+  end
+
+  def instantiate(modname)
+    return [Puppet::Resource::Type.new(:definition, @name, @context.merge(:module_name => modname))]
+  end
+end
diff --git a/lib/puppet/parser/ast/hostclass.rb b/lib/puppet/parser/ast/hostclass.rb
new file mode 100644
index 0000000..d539e4d
--- /dev/null
+++ b/lib/puppet/parser/ast/hostclass.rb
@@ -0,0 +1,26 @@
+require 'puppet/parser/ast/top_level_construct'
+
+class Puppet::Parser::AST::Hostclass < Puppet::Parser::AST::TopLevelConstruct
+  attr_accessor :name, :context
+
+  def initialize(name, context = {})
+    @context = context
+    @name = name
+  end
+
+  def instantiate(modname)
+    all_types = [Puppet::Resource::Type.new(:hostclass, @name, @context.merge(:module_name => modname))]
+    if code
+      code.each do |nested_ast_node|
+        if nested_ast_node.respond_to? :instantiate
+          all_types += nested_ast_node.instantiate(modname)
+        end
+      end
+    end
+    return all_types
+  end
+
+  def code()
+    @context[:code]
+  end
+end
diff --git a/lib/puppet/parser/ast/node.rb b/lib/puppet/parser/ast/node.rb
new file mode 100644
index 0000000..c19a24c
--- /dev/null
+++ b/lib/puppet/parser/ast/node.rb
@@ -0,0 +1,17 @@
+require 'puppet/parser/ast/top_level_construct'
+
+class Puppet::Parser::AST::Node < Puppet::Parser::AST::TopLevelConstruct
+  attr_accessor :names
+
+  def initialize(names, context = {})
+    raise ArgumentError, "names should be an array" unless names.is_a? Array
+    @names = names
+    @context = context
+  end
+
+  def instantiate(modname)
+    @names.collect do |name|
+      Puppet::Resource::Type.new(:node, name, @context.merge(:module_name => modname))
+    end
+  end
+end
diff --git a/lib/puppet/parser/ast/top_level_construct.rb b/lib/puppet/parser/ast/top_level_construct.rb
new file mode 100644
index 0000000..901a939
--- /dev/null
+++ b/lib/puppet/parser/ast/top_level_construct.rb
@@ -0,0 +1,4 @@
+# The base class for AST nodes representing top level things:
+# hostclasses, definitions, and nodes.
+class Puppet::Parser::AST::TopLevelConstruct < Puppet::Parser::AST
+end
diff --git a/lib/puppet/parser/grammar.ra b/lib/puppet/parser/grammar.ra
index 7a316d4..3185c43 100644
--- a/lib/puppet/parser/grammar.ra
+++ b/lib/puppet/parser/grammar.ra
@@ -29,37 +29,18 @@ preclow
 
 rule
 program:    statements {
-  if val[0]
-    # Make sure we always return an array.
-    if val[0].is_a?(AST::ASTArray)
-      if val[0].children.empty?
-        result = nil
-      else
-        result = val[0]
-      end
-    else
-      result = aryfy(val[0])
-    end
-  else
-    result = nil
-  end
+  val[0].is_a_namespace = true
+  result = val[0]
 }
   | nil
 
-statements:   statement
+  statements:   statement {
+    result = ast AST::ASTArray, :children => [val[0]]
+  }
   | statements statement {
-    if val[0] and val[1]
-    if val[0].instance_of?(AST::ASTArray)
-      val[0].push(val[1])
-      result = val[0]
-    else
-      result = ast AST::ASTArray, :children => [val[0],val[1]]
-    end
-  elsif obj = (val[0] || val[1])
-    result = obj
-  else result = nil
-  end
-}
+    val[0].push(val[1])
+    result = val[0]
+  }
 
 # The main list of valid statements
 statement:    resource
@@ -664,16 +645,17 @@ import: IMPORT strings {
 #definition: DEFINE NAME argumentlist parent LBRACE statements RBRACE {
 definition: DEFINE classname argumentlist LBRACE statements RBRACE {
   @lexer.commentpop
-  newdefine classname(val[1]), :arguments => val[2], :code => val[4], :line => val[0][:line]
+  result = Puppet::Parser::AST::Definition.new(classname(val[1]),
+                                               ast_context(true).merge(:arguments => val[2], :code => val[4],
+                                                                       :line => val[0][:line]))
   @lexer.indefine = false
-  result = nil
 
 #}           | DEFINE NAME argumentlist parent LBRACE RBRACE {
 }           | DEFINE classname argumentlist LBRACE RBRACE {
   @lexer.commentpop
-  newdefine classname(val[1]), :arguments => val[2], :line => val[0][:line]
+  result = Puppet::Parser::AST::Definition.new(classname(val[1]),
+                                               ast_context(true).merge(:arguments => val[2], :line => val[0][:line]))
   @lexer.indefine = false
-  result = nil
 }
 
 #hostclass: CLASS NAME argumentlist parent LBRACE statements RBRACE {
@@ -681,24 +663,27 @@ hostclass: CLASS classname argumentlist classparent LBRACE statements RBRACE {
   @lexer.commentpop
   # Our class gets defined in the parent namespace, not our own.
   @lexer.namepop
-  newclass classname(val[1]), :arguments => val[2], :parent => val[3], :code => val[5], :line => val[0][:line]
-  result = nil
+  val[5].is_a_namespace = true
+  result = Puppet::Parser::AST::Hostclass.new(classname(val[1]),
+                                              ast_context(true).merge(:arguments => val[2], :parent => val[3],
+                                                                      :code => val[5], :line => val[0][:line]))
 }           | CLASS classname argumentlist classparent LBRACE RBRACE {
   @lexer.commentpop
   # Our class gets defined in the parent namespace, not our own.
   @lexer.namepop
-  newclass classname(val[1]), :arguments => val[2], :parent => val[3], :line => val[0][:line]
-  result = nil
+  result = Puppet::Parser::AST::Hostclass.new(classname(val[1]),
+                                              ast_context(true).merge(:arguments => val[2], :parent => val[3],
+                                                                      :line => val[0][:line]))
 }
 
 nodedef: NODE hostnames nodeparent LBRACE statements RBRACE {
   @lexer.commentpop
-  newnode val[1], :parent => val[2], :code => val[4], :line => val[0][:line]
-  result = nil
+  result = Puppet::Parser::AST::Node.new(val[1],
+                                         ast_context(true).merge(:parent => val[2], :code => val[4],
+                                                                 :line => val[0][:line]))
 }       |  NODE hostnames nodeparent LBRACE RBRACE {
   @lexer.commentpop
-  newnode val[1], :parent => val[2], :line => val[0][:line]
-  result = nil
+  result = Puppet::Parser::AST::Node.new(val[1], ast_context(true).merge(:parent => val[2], :line => val[0][:line]))
 }
 
 classref:       CLASSREF { result = val[0][:value] }
@@ -709,10 +694,11 @@ classname:       NAME { result = val[0][:value] }
 
 # Multiple hostnames, as used for node names.  These are all literal
 # strings, not AST objects.
-hostnames:    nodename
+hostnames:    nodename {
+    result = [result]
+}
   | hostnames COMMA nodename {
     result = val[0]
-    result = [result] unless result.is_a?(Array)
     result << val[2]
 }
 
diff --git a/lib/puppet/parser/parser.rb b/lib/puppet/parser/parser.rb
index 5be9e5a..e4f5149 100644
--- a/lib/puppet/parser/parser.rb
+++ b/lib/puppet/parser/parser.rb
@@ -1,11 +1,10 @@
 #
 # DO NOT MODIFY!!!!
-# This file is automatically generated by racc 1.4.5
-# from racc grammer file "grammar.ra".
+# This file is automatically generated by Racc 1.4.6
+# from Racc grammer file "".
 #
 
-require 'racc/parser'
-
+require 'racc/parser.rb'
 
 require 'puppet'
 require 'puppet/util/loadedfile'
@@ -13,19 +12,16 @@ require 'puppet/parser/lexer'
 require 'puppet/parser/ast'
 
 module Puppet
-    class ParseError < Puppet::Error; end
-    class ImportError < Racc::ParseError; end
-    class AlreadyImportedError < ImportError; end
+  class ParseError < Puppet::Error; end
+  class ImportError < Racc::ParseError; end
+  class AlreadyImportedError < ImportError; end
 end
 
-
 module Puppet
-
   module Parser
-
     class Parser < Racc::Parser
 
-module_eval <<'..end grammar.ra modeval..id7145220b1b', 'grammar.ra', 876
+module_eval(<<'...end grammar.ra/module_eval...', 'grammar.ra', 851)
 
 # It got too annoying having code in a file that needs to be compiled.
 require 'puppet/parser/parser_support'
@@ -36,249 +32,8 @@ require 'puppet/parser/parser_support'
 # End:
 
 # $Id$
-
-..end grammar.ra modeval..id7145220b1b
-
-##### racc 1.4.5 generates ###
-
-racc_reduce_table = [
- 0, 0, :racc_error,
- 1, 70, :_reduce_1,
- 1, 70, :_reduce_none,
- 1, 71, :_reduce_none,
- 2, 71, :_reduce_4,
- 1, 73, :_reduce_none,
- 1, 73, :_reduce_none,
- 1, 73, :_reduce_none,
- 1, 73, :_reduce_none,
- 1, 73, :_reduce_none,
- 1, 73, :_reduce_none,
- 1, 73, :_reduce_none,
- 1, 73, :_reduce_none,
- 1, 73, :_reduce_none,
- 1, 73, :_reduce_none,
- 1, 73, :_reduce_none,
- 1, 73, :_reduce_none,
- 1, 73, :_reduce_none,
- 1, 73, :_reduce_none,
- 3, 87, :_reduce_19,
- 3, 87, :_reduce_20,
- 1, 88, :_reduce_none,
- 1, 88, :_reduce_none,
- 1, 88, :_reduce_none,
- 1, 89, :_reduce_none,
- 1, 89, :_reduce_none,
- 1, 89, :_reduce_none,
- 1, 89, :_reduce_none,
- 4, 81, :_reduce_28,
- 5, 81, :_reduce_29,
- 3, 81, :_reduce_30,
- 2, 81, :_reduce_31,
- 1, 91, :_reduce_none,
- 1, 91, :_reduce_none,
- 3, 91, :_reduce_34,
- 3, 91, :_reduce_35,
- 1, 92, :_reduce_none,
- 1, 92, :_reduce_none,
- 1, 92, :_reduce_none,
- 1, 92, :_reduce_none,
- 1, 92, :_reduce_none,
- 1, 92, :_reduce_none,
- 1, 92, :_reduce_none,
- 1, 92, :_reduce_none,
- 1, 92, :_reduce_44,
- 5, 74, :_reduce_45,
- 5, 74, :_reduce_46,
- 5, 74, :_reduce_47,
- 5, 85, :_reduce_48,
- 2, 75, :_reduce_49,
- 1, 108, :_reduce_50,
- 2, 108, :_reduce_51,
- 6, 76, :_reduce_52,
- 2, 76, :_reduce_53,
- 3, 109, :_reduce_54,
- 3, 109, :_reduce_55,
- 1, 110, :_reduce_none,
- 1, 110, :_reduce_none,
- 3, 110, :_reduce_58,
- 1, 111, :_reduce_none,
- 3, 111, :_reduce_60,
- 1, 112, :_reduce_61,
- 1, 112, :_reduce_62,
- 3, 113, :_reduce_63,
- 3, 113, :_reduce_64,
- 1, 114, :_reduce_none,
- 1, 114, :_reduce_none,
- 4, 116, :_reduce_67,
- 1, 102, :_reduce_none,
- 3, 102, :_reduce_69,
- 0, 103, :_reduce_none,
- 1, 103, :_reduce_none,
- 1, 118, :_reduce_72,
- 1, 93, :_reduce_73,
- 1, 95, :_reduce_74,
- 1, 117, :_reduce_none,
- 1, 117, :_reduce_none,
- 1, 117, :_reduce_none,
- 1, 117, :_reduce_none,
- 1, 117, :_reduce_none,
- 1, 117, :_reduce_none,
- 1, 117, :_reduce_none,
- 3, 77, :_reduce_82,
- 3, 77, :_reduce_83,
- 3, 86, :_reduce_84,
- 0, 104, :_reduce_85,
- 1, 104, :_reduce_86,
- 3, 104, :_reduce_87,
- 3, 122, :_reduce_88,
- 3, 124, :_reduce_89,
- 1, 125, :_reduce_none,
- 1, 125, :_reduce_none,
- 0, 107, :_reduce_92,
- 1, 107, :_reduce_93,
- 3, 107, :_reduce_94,
- 1, 126, :_reduce_none,
- 3, 126, :_reduce_96,
- 1, 115, :_reduce_none,
- 1, 115, :_reduce_none,
- 1, 115, :_reduce_none,
- 1, 115, :_reduce_none,
- 1, 115, :_reduce_none,
- 1, 115, :_reduce_none,
- 1, 123, :_reduce_none,
- 1, 123, :_reduce_none,
- 1, 123, :_reduce_none,
- 1, 123, :_reduce_none,
- 1, 123, :_reduce_none,
- 1, 123, :_reduce_none,
- 1, 123, :_reduce_none,
- 1, 123, :_reduce_none,
- 1, 123, :_reduce_none,
- 1, 123, :_reduce_none,
- 1, 123, :_reduce_none,
- 1, 123, :_reduce_none,
- 4, 97, :_reduce_115,
- 3, 97, :_reduce_116,
- 1, 99, :_reduce_117,
- 2, 99, :_reduce_118,
- 2, 129, :_reduce_119,
- 1, 130, :_reduce_120,
- 2, 130, :_reduce_121,
- 1, 96, :_reduce_122,
- 4, 90, :_reduce_123,
- 4, 90, :_reduce_124,
- 2, 79, :_reduce_125,
- 5, 131, :_reduce_126,
- 4, 131, :_reduce_127,
- 0, 132, :_reduce_none,
- 2, 132, :_reduce_129,
- 4, 132, :_reduce_130,
- 3, 132, :_reduce_131,
- 1, 120, :_reduce_none,
- 3, 120, :_reduce_133,
- 3, 120, :_reduce_134,
- 3, 120, :_reduce_135,
- 3, 120, :_reduce_136,
- 3, 120, :_reduce_137,
- 3, 120, :_reduce_138,
- 3, 120, :_reduce_139,
- 3, 120, :_reduce_140,
- 3, 120, :_reduce_141,
- 2, 120, :_reduce_142,
- 3, 120, :_reduce_143,
- 3, 120, :_reduce_144,
- 3, 120, :_reduce_145,
- 3, 120, :_reduce_146,
- 3, 120, :_reduce_147,
- 3, 120, :_reduce_148,
- 2, 120, :_reduce_149,
- 3, 120, :_reduce_150,
- 3, 120, :_reduce_151,
- 3, 120, :_reduce_152,
- 5, 78, :_reduce_153,
- 1, 134, :_reduce_none,
- 2, 134, :_reduce_155,
- 5, 135, :_reduce_156,
- 4, 135, :_reduce_157,
- 1, 136, :_reduce_none,
- 3, 136, :_reduce_159,
- 3, 98, :_reduce_160,
- 1, 138, :_reduce_none,
- 4, 138, :_reduce_162,
- 1, 140, :_reduce_none,
- 3, 140, :_reduce_164,
- 3, 139, :_reduce_165,
- 1, 137, :_reduce_none,
- 1, 137, :_reduce_none,
- 1, 137, :_reduce_none,
- 1, 137, :_reduce_none,
- 1, 137, :_reduce_none,
- 1, 137, :_reduce_none,
- 1, 137, :_reduce_none,
- 1, 137, :_reduce_173,
- 1, 137, :_reduce_none,
- 1, 141, :_reduce_175,
- 1, 142, :_reduce_none,
- 3, 142, :_reduce_177,
- 2, 80, :_reduce_178,
- 6, 82, :_reduce_179,
- 5, 82, :_reduce_180,
- 7, 83, :_reduce_181,
- 6, 83, :_reduce_182,
- 6, 84, :_reduce_183,
- 5, 84, :_reduce_184,
- 1, 106, :_reduce_185,
- 1, 101, :_reduce_186,
- 1, 101, :_reduce_187,
- 1, 101, :_reduce_188,
- 1, 145, :_reduce_none,
- 3, 145, :_reduce_190,
- 1, 147, :_reduce_191,
- 1, 148, :_reduce_192,
- 1, 148, :_reduce_193,
- 1, 148, :_reduce_194,
- 1, 148, :_reduce_none,
- 0, 72, :_reduce_196,
- 0, 149, :_reduce_197,
- 1, 143, :_reduce_none,
- 3, 143, :_reduce_199,
- 3, 143, :_reduce_200,
- 1, 150, :_reduce_none,
- 3, 150, :_reduce_202,
- 3, 151, :_reduce_203,
- 1, 151, :_reduce_204,
- 3, 151, :_reduce_205,
- 1, 151, :_reduce_206,
- 1, 146, :_reduce_none,
- 2, 146, :_reduce_208,
- 1, 144, :_reduce_none,
- 2, 144, :_reduce_210,
- 1, 152, :_reduce_none,
- 1, 152, :_reduce_none,
- 1, 94, :_reduce_213,
- 3, 119, :_reduce_214,
- 4, 119, :_reduce_215,
- 2, 119, :_reduce_216,
- 1, 127, :_reduce_none,
- 1, 127, :_reduce_none,
- 0, 105, :_reduce_none,
- 1, 105, :_reduce_220,
- 1, 133, :_reduce_221,
- 3, 128, :_reduce_222,
- 4, 128, :_reduce_223,
- 2, 128, :_reduce_224,
- 1, 153, :_reduce_none,
- 3, 153, :_reduce_226,
- 3, 154, :_reduce_227,
- 1, 155, :_reduce_228,
- 1, 155, :_reduce_229,
- 4, 121, :_reduce_230,
- 1, 100, :_reduce_none,
- 4, 100, :_reduce_232 ]
-
-racc_reduce_n = 233
-
-racc_shift_n = 384
+...end grammar.ra/module_eval...
+##### State transition tables begin ###
 
 racc_action_table = [
    256,   257,   228,    82,    54,    72,    75,   181,   251,    48,
@@ -920,1683 +675,2015 @@ racc_goto_default = [
    nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,    57,
    nil,   nil,   nil,   nil,   nil,   nil,   192 ]
 
-racc_token_table = {
- false => 0,
- Object.new => 1,
- :STRING => 2,
- :DQPRE => 3,
- :DQMID => 4,
- :DQPOST => 5,
- :LBRACK => 6,
- :RBRACK => 7,
- :LBRACE => 8,
- :RBRACE => 9,
- :SYMBOL => 10,
- :FARROW => 11,
- :COMMA => 12,
- :TRUE => 13,
- :FALSE => 14,
- :EQUALS => 15,
- :APPENDS => 16,
- :LESSEQUAL => 17,
- :NOTEQUAL => 18,
- :DOT => 19,
- :COLON => 20,
- :LLCOLLECT => 21,
- :RRCOLLECT => 22,
- :QMARK => 23,
- :LPAREN => 24,
- :RPAREN => 25,
- :ISEQUAL => 26,
- :GREATEREQUAL => 27,
- :GREATERTHAN => 28,
- :LESSTHAN => 29,
- :IF => 30,
- :ELSE => 31,
- :IMPORT => 32,
- :DEFINE => 33,
- :ELSIF => 34,
- :VARIABLE => 35,
- :CLASS => 36,
- :INHERITS => 37,
- :NODE => 38,
- :BOOLEAN => 39,
- :NAME => 40,
- :SEMIC => 41,
- :CASE => 42,
- :DEFAULT => 43,
- :AT => 44,
- :LCOLLECT => 45,
- :RCOLLECT => 46,
- :CLASSNAME => 47,
- :CLASSREF => 48,
- :NOT => 49,
- :OR => 50,
- :AND => 51,
- :UNDEF => 52,
- :PARROW => 53,
- :PLUS => 54,
- :MINUS => 55,
- :TIMES => 56,
- :DIV => 57,
- :LSHIFT => 58,
- :RSHIFT => 59,
- :UMINUS => 60,
- :MATCH => 61,
- :NOMATCH => 62,
- :REGEX => 63,
- :IN_EDGE => 64,
- :OUT_EDGE => 65,
- :IN_EDGE_SUB => 66,
- :OUT_EDGE_SUB => 67,
- :IN => 68 }
+racc_reduce_table = [
+  0, 0, :racc_error,
+  1, 70, :_reduce_1,
+  1, 70, :_reduce_none,
+  1, 71, :_reduce_3,
+  2, 71, :_reduce_4,
+  1, 73, :_reduce_none,
+  1, 73, :_reduce_none,
+  1, 73, :_reduce_none,
+  1, 73, :_reduce_none,
+  1, 73, :_reduce_none,
+  1, 73, :_reduce_none,
+  1, 73, :_reduce_none,
+  1, 73, :_reduce_none,
+  1, 73, :_reduce_none,
+  1, 73, :_reduce_none,
+  1, 73, :_reduce_none,
+  1, 73, :_reduce_none,
+  1, 73, :_reduce_none,
+  1, 73, :_reduce_none,
+  3, 87, :_reduce_19,
+  3, 87, :_reduce_20,
+  1, 88, :_reduce_none,
+  1, 88, :_reduce_none,
+  1, 88, :_reduce_none,
+  1, 89, :_reduce_none,
+  1, 89, :_reduce_none,
+  1, 89, :_reduce_none,
+  1, 89, :_reduce_none,
+  4, 81, :_reduce_28,
+  5, 81, :_reduce_29,
+  3, 81, :_reduce_30,
+  2, 81, :_reduce_31,
+  1, 91, :_reduce_none,
+  1, 91, :_reduce_none,
+  3, 91, :_reduce_34,
+  3, 91, :_reduce_35,
+  1, 92, :_reduce_none,
+  1, 92, :_reduce_none,
+  1, 92, :_reduce_none,
+  1, 92, :_reduce_none,
+  1, 92, :_reduce_none,
+  1, 92, :_reduce_none,
+  1, 92, :_reduce_none,
+  1, 92, :_reduce_none,
+  1, 92, :_reduce_44,
+  5, 74, :_reduce_45,
+  5, 74, :_reduce_46,
+  5, 74, :_reduce_47,
+  5, 85, :_reduce_48,
+  2, 75, :_reduce_49,
+  1, 108, :_reduce_50,
+  2, 108, :_reduce_51,
+  6, 76, :_reduce_52,
+  2, 76, :_reduce_53,
+  3, 109, :_reduce_54,
+  3, 109, :_reduce_55,
+  1, 110, :_reduce_none,
+  1, 110, :_reduce_none,
+  3, 110, :_reduce_58,
+  1, 111, :_reduce_none,
+  3, 111, :_reduce_60,
+  1, 112, :_reduce_61,
+  1, 112, :_reduce_62,
+  3, 113, :_reduce_63,
+  3, 113, :_reduce_64,
+  1, 114, :_reduce_none,
+  1, 114, :_reduce_none,
+  4, 116, :_reduce_67,
+  1, 102, :_reduce_none,
+  3, 102, :_reduce_69,
+  0, 103, :_reduce_none,
+  1, 103, :_reduce_none,
+  1, 118, :_reduce_72,
+  1, 93, :_reduce_73,
+  1, 95, :_reduce_74,
+  1, 117, :_reduce_none,
+  1, 117, :_reduce_none,
+  1, 117, :_reduce_none,
+  1, 117, :_reduce_none,
+  1, 117, :_reduce_none,
+  1, 117, :_reduce_none,
+  1, 117, :_reduce_none,
+  3, 77, :_reduce_82,
+  3, 77, :_reduce_83,
+  3, 86, :_reduce_84,
+  0, 104, :_reduce_85,
+  1, 104, :_reduce_86,
+  3, 104, :_reduce_87,
+  3, 122, :_reduce_88,
+  3, 124, :_reduce_89,
+  1, 125, :_reduce_none,
+  1, 125, :_reduce_none,
+  0, 107, :_reduce_92,
+  1, 107, :_reduce_93,
+  3, 107, :_reduce_94,
+  1, 126, :_reduce_none,
+  3, 126, :_reduce_96,
+  1, 115, :_reduce_none,
+  1, 115, :_reduce_none,
+  1, 115, :_reduce_none,
+  1, 115, :_reduce_none,
+  1, 115, :_reduce_none,
+  1, 115, :_reduce_none,
+  1, 123, :_reduce_none,
+  1, 123, :_reduce_none,
+  1, 123, :_reduce_none,
+  1, 123, :_reduce_none,
+  1, 123, :_reduce_none,
+  1, 123, :_reduce_none,
+  1, 123, :_reduce_none,
+  1, 123, :_reduce_none,
+  1, 123, :_reduce_none,
+  1, 123, :_reduce_none,
+  1, 123, :_reduce_none,
+  1, 123, :_reduce_none,
+  4, 97, :_reduce_115,
+  3, 97, :_reduce_116,
+  1, 99, :_reduce_117,
+  2, 99, :_reduce_118,
+  2, 129, :_reduce_119,
+  1, 130, :_reduce_120,
+  2, 130, :_reduce_121,
+  1, 96, :_reduce_122,
+  4, 90, :_reduce_123,
+  4, 90, :_reduce_124,
+  2, 79, :_reduce_125,
+  5, 131, :_reduce_126,
+  4, 131, :_reduce_127,
+  0, 132, :_reduce_none,
+  2, 132, :_reduce_129,
+  4, 132, :_reduce_130,
+  3, 132, :_reduce_131,
+  1, 120, :_reduce_none,
+  3, 120, :_reduce_133,
+  3, 120, :_reduce_134,
+  3, 120, :_reduce_135,
+  3, 120, :_reduce_136,
+  3, 120, :_reduce_137,
+  3, 120, :_reduce_138,
+  3, 120, :_reduce_139,
+  3, 120, :_reduce_140,
+  3, 120, :_reduce_141,
+  2, 120, :_reduce_142,
+  3, 120, :_reduce_143,
+  3, 120, :_reduce_144,
+  3, 120, :_reduce_145,
+  3, 120, :_reduce_146,
+  3, 120, :_reduce_147,
+  3, 120, :_reduce_148,
+  2, 120, :_reduce_149,
+  3, 120, :_reduce_150,
+  3, 120, :_reduce_151,
+  3, 120, :_reduce_152,
+  5, 78, :_reduce_153,
+  1, 134, :_reduce_none,
+  2, 134, :_reduce_155,
+  5, 135, :_reduce_156,
+  4, 135, :_reduce_157,
+  1, 136, :_reduce_none,
+  3, 136, :_reduce_159,
+  3, 98, :_reduce_160,
+  1, 138, :_reduce_none,
+  4, 138, :_reduce_162,
+  1, 140, :_reduce_none,
+  3, 140, :_reduce_164,
+  3, 139, :_reduce_165,
+  1, 137, :_reduce_none,
+  1, 137, :_reduce_none,
+  1, 137, :_reduce_none,
+  1, 137, :_reduce_none,
+  1, 137, :_reduce_none,
+  1, 137, :_reduce_none,
+  1, 137, :_reduce_none,
+  1, 137, :_reduce_173,
+  1, 137, :_reduce_none,
+  1, 141, :_reduce_175,
+  1, 142, :_reduce_none,
+  3, 142, :_reduce_177,
+  2, 80, :_reduce_178,
+  6, 82, :_reduce_179,
+  5, 82, :_reduce_180,
+  7, 83, :_reduce_181,
+  6, 83, :_reduce_182,
+  6, 84, :_reduce_183,
+  5, 84, :_reduce_184,
+  1, 106, :_reduce_185,
+  1, 101, :_reduce_186,
+  1, 101, :_reduce_187,
+  1, 101, :_reduce_188,
+  1, 145, :_reduce_189,
+  3, 145, :_reduce_190,
+  1, 147, :_reduce_191,
+  1, 148, :_reduce_192,
+  1, 148, :_reduce_193,
+  1, 148, :_reduce_194,
+  1, 148, :_reduce_none,
+  0, 72, :_reduce_196,
+  0, 149, :_reduce_197,
+  1, 143, :_reduce_none,
+  3, 143, :_reduce_199,
+  3, 143, :_reduce_200,
+  1, 150, :_reduce_none,
+  3, 150, :_reduce_202,
+  3, 151, :_reduce_203,
+  1, 151, :_reduce_204,
+  3, 151, :_reduce_205,
+  1, 151, :_reduce_206,
+  1, 146, :_reduce_none,
+  2, 146, :_reduce_208,
+  1, 144, :_reduce_none,
+  2, 144, :_reduce_210,
+  1, 152, :_reduce_none,
+  1, 152, :_reduce_none,
+  1, 94, :_reduce_213,
+  3, 119, :_reduce_214,
+  4, 119, :_reduce_215,
+  2, 119, :_reduce_216,
+  1, 127, :_reduce_none,
+  1, 127, :_reduce_none,
+  0, 105, :_reduce_none,
+  1, 105, :_reduce_220,
+  1, 133, :_reduce_221,
+  3, 128, :_reduce_222,
+  4, 128, :_reduce_223,
+  2, 128, :_reduce_224,
+  1, 153, :_reduce_none,
+  3, 153, :_reduce_226,
+  3, 154, :_reduce_227,
+  1, 155, :_reduce_228,
+  1, 155, :_reduce_229,
+  4, 121, :_reduce_230,
+  1, 100, :_reduce_none,
+  4, 100, :_reduce_232 ]
 
-racc_use_result_var = true
+racc_reduce_n = 233
+
+racc_shift_n = 384
+
+racc_token_table = {
+  false => 0,
+  :error => 1,
+  :STRING => 2,
+  :DQPRE => 3,
+  :DQMID => 4,
+  :DQPOST => 5,
+  :LBRACK => 6,
+  :RBRACK => 7,
+  :LBRACE => 8,
+  :RBRACE => 9,
+  :SYMBOL => 10,
+  :FARROW => 11,
+  :COMMA => 12,
+  :TRUE => 13,
+  :FALSE => 14,
+  :EQUALS => 15,
+  :APPENDS => 16,
+  :LESSEQUAL => 17,
+  :NOTEQUAL => 18,
+  :DOT => 19,
+  :COLON => 20,
+  :LLCOLLECT => 21,
+  :RRCOLLECT => 22,
+  :QMARK => 23,
+  :LPAREN => 24,
+  :RPAREN => 25,
+  :ISEQUAL => 26,
+  :GREATEREQUAL => 27,
+  :GREATERTHAN => 28,
+  :LESSTHAN => 29,
+  :IF => 30,
+  :ELSE => 31,
+  :IMPORT => 32,
+  :DEFINE => 33,
+  :ELSIF => 34,
+  :VARIABLE => 35,
+  :CLASS => 36,
+  :INHERITS => 37,
+  :NODE => 38,
+  :BOOLEAN => 39,
+  :NAME => 40,
+  :SEMIC => 41,
+  :CASE => 42,
+  :DEFAULT => 43,
+  :AT => 44,
+  :LCOLLECT => 45,
+  :RCOLLECT => 46,
+  :CLASSNAME => 47,
+  :CLASSREF => 48,
+  :NOT => 49,
+  :OR => 50,
+  :AND => 51,
+  :UNDEF => 52,
+  :PARROW => 53,
+  :PLUS => 54,
+  :MINUS => 55,
+  :TIMES => 56,
+  :DIV => 57,
+  :LSHIFT => 58,
+  :RSHIFT => 59,
+  :UMINUS => 60,
+  :MATCH => 61,
+  :NOMATCH => 62,
+  :REGEX => 63,
+  :IN_EDGE => 64,
+  :OUT_EDGE => 65,
+  :IN_EDGE_SUB => 66,
+  :OUT_EDGE_SUB => 67,
+  :IN => 68 }
 
 racc_nt_base = 69
 
+racc_use_result_var = true
+
 Racc_arg = [
- racc_action_table,
- racc_action_check,
- racc_action_default,
- racc_action_pointer,
- racc_goto_table,
- racc_goto_check,
- racc_goto_default,
- racc_goto_pointer,
- racc_nt_base,
- racc_reduce_table,
- racc_token_table,
- racc_shift_n,
- racc_reduce_n,
- racc_use_result_var ]
+  racc_action_table,
+  racc_action_check,
+  racc_action_default,
+  racc_action_pointer,
+  racc_goto_table,
+  racc_goto_check,
+  racc_goto_default,
+  racc_goto_pointer,
+  racc_nt_base,
+  racc_reduce_table,
+  racc_token_table,
+  racc_shift_n,
+  racc_reduce_n,
+  racc_use_result_var ]
 
 Racc_token_to_s_table = [
-'$end',
-'error',
-'STRING',
-'DQPRE',
-'DQMID',
-'DQPOST',
-'LBRACK',
-'RBRACK',
-'LBRACE',
-'RBRACE',
-'SYMBOL',
-'FARROW',
-'COMMA',
-'TRUE',
-'FALSE',
-'EQUALS',
-'APPENDS',
-'LESSEQUAL',
-'NOTEQUAL',
-'DOT',
-'COLON',
-'LLCOLLECT',
-'RRCOLLECT',
-'QMARK',
-'LPAREN',
-'RPAREN',
-'ISEQUAL',
-'GREATEREQUAL',
-'GREATERTHAN',
-'LESSTHAN',
-'IF',
-'ELSE',
-'IMPORT',
-'DEFINE',
-'ELSIF',
-'VARIABLE',
-'CLASS',
-'INHERITS',
-'NODE',
-'BOOLEAN',
-'NAME',
-'SEMIC',
-'CASE',
-'DEFAULT',
-'AT',
-'LCOLLECT',
-'RCOLLECT',
-'CLASSNAME',
-'CLASSREF',
-'NOT',
-'OR',
-'AND',
-'UNDEF',
-'PARROW',
-'PLUS',
-'MINUS',
-'TIMES',
-'DIV',
-'LSHIFT',
-'RSHIFT',
-'UMINUS',
-'MATCH',
-'NOMATCH',
-'REGEX',
-'IN_EDGE',
-'OUT_EDGE',
-'IN_EDGE_SUB',
-'OUT_EDGE_SUB',
-'IN',
-'$start',
-'program',
-'statements',
-'nil',
-'statement',
-'resource',
-'virtualresource',
-'collection',
-'assignment',
-'casestatement',
-'ifstatement_begin',
-'import',
-'fstatement',
-'definition',
-'hostclass',
-'nodedef',
-'resourceoverride',
-'append',
-'relationship',
-'relationship_side',
-'edge',
-'resourceref',
-'funcvalues',
-'namestring',
-'name',
-'variable',
-'type',
-'boolean',
-'funcrvalue',
-'selector',
-'quotedtext',
-'hasharrayaccesses',
-'classname',
-'resourceinstances',
-'endsemi',
-'params',
-'endcomma',
-'classref',
-'anyparams',
-'at',
-'collectrhand',
-'collstatements',
-'collstatement',
-'colljoin',
-'collexpr',
-'colllval',
-'simplervalue',
-'resourceinst',
-'resourcename',
-'undef',
-'array',
-'expression',
-'hasharrayaccess',
-'param',
-'rvalue',
-'addparam',
-'anyparam',
-'rvalues',
-'comma',
-'hash',
-'dqrval',
-'dqtail',
-'ifstatement',
-'else',
-'regex',
-'caseopts',
-'caseopt',
-'casevalues',
-'selectlhand',
-'svalues',
-'selectval',
-'sintvalues',
-'string',
-'strings',
-'argumentlist',
-'classparent',
-'hostnames',
-'nodeparent',
-'nodename',
-'hostname',
-'nothing',
-'arguments',
-'argument',
-'classnameordefault',
-'hashpairs',
-'hashpair',
-'key']
+  "$end",
+  "error",
+  "STRING",
+  "DQPRE",
+  "DQMID",
+  "DQPOST",
+  "LBRACK",
+  "RBRACK",
+  "LBRACE",
+  "RBRACE",
+  "SYMBOL",
+  "FARROW",
+  "COMMA",
+  "TRUE",
+  "FALSE",
+  "EQUALS",
+  "APPENDS",
+  "LESSEQUAL",
+  "NOTEQUAL",
+  "DOT",
+  "COLON",
+  "LLCOLLECT",
+  "RRCOLLECT",
+  "QMARK",
+  "LPAREN",
+  "RPAREN",
+  "ISEQUAL",
+  "GREATEREQUAL",
+  "GREATERTHAN",
+  "LESSTHAN",
+  "IF",
+  "ELSE",
+  "IMPORT",
+  "DEFINE",
+  "ELSIF",
+  "VARIABLE",
+  "CLASS",
+  "INHERITS",
+  "NODE",
+  "BOOLEAN",
+  "NAME",
+  "SEMIC",
+  "CASE",
+  "DEFAULT",
+  "AT",
+  "LCOLLECT",
+  "RCOLLECT",
+  "CLASSNAME",
+  "CLASSREF",
+  "NOT",
+  "OR",
+  "AND",
+  "UNDEF",
+  "PARROW",
+  "PLUS",
+  "MINUS",
+  "TIMES",
+  "DIV",
+  "LSHIFT",
+  "RSHIFT",
+  "UMINUS",
+  "MATCH",
+  "NOMATCH",
+  "REGEX",
+  "IN_EDGE",
+  "OUT_EDGE",
+  "IN_EDGE_SUB",
+  "OUT_EDGE_SUB",
+  "IN",
+  "$start",
+  "program",
+  "statements",
+  "nil",
+  "statement",
+  "resource",
+  "virtualresource",
+  "collection",
+  "assignment",
+  "casestatement",
+  "ifstatement_begin",
+  "import",
+  "fstatement",
+  "definition",
+  "hostclass",
+  "nodedef",
+  "resourceoverride",
+  "append",
+  "relationship",
+  "relationship_side",
+  "edge",
+  "resourceref",
+  "funcvalues",
+  "namestring",
+  "name",
+  "variable",
+  "type",
+  "boolean",
+  "funcrvalue",
+  "selector",
+  "quotedtext",
+  "hasharrayaccesses",
+  "classname",
+  "resourceinstances",
+  "endsemi",
+  "params",
+  "endcomma",
+  "classref",
+  "anyparams",
+  "at",
+  "collectrhand",
+  "collstatements",
+  "collstatement",
+  "colljoin",
+  "collexpr",
+  "colllval",
+  "simplervalue",
+  "resourceinst",
+  "resourcename",
+  "undef",
+  "array",
+  "expression",
+  "hasharrayaccess",
+  "param",
+  "rvalue",
+  "addparam",
+  "anyparam",
+  "rvalues",
+  "comma",
+  "hash",
+  "dqrval",
+  "dqtail",
+  "ifstatement",
+  "else",
+  "regex",
+  "caseopts",
+  "caseopt",
+  "casevalues",
+  "selectlhand",
+  "svalues",
+  "selectval",
+  "sintvalues",
+  "string",
+  "strings",
+  "argumentlist",
+  "classparent",
+  "hostnames",
+  "nodeparent",
+  "nodename",
+  "hostname",
+  "nothing",
+  "arguments",
+  "argument",
+  "classnameordefault",
+  "hashpairs",
+  "hashpair",
+  "key" ]
 
 Racc_debug_parser = false
 
-##### racc system variables end #####
-
- # reduce 0 omitted
-
-module_eval <<'.,.,', 'grammar.ra', 46
-  def _reduce_1( val, _values, result )
-    if val[0]
-        # Make sure we always return an array.
-        if val[0].is_a?(AST::ASTArray)
-            if val[0].children.empty?
-                result = nil
-            else
-                result = val[0]
-            end
-        else
-            result = aryfy(val[0])
-        end
-    else
-        result = nil
-    end
-   result
+##### State transition tables end #####
+
+# reduce 0 omitted
+
+module_eval(<<'.,.,', 'grammar.ra', 31)
+  def _reduce_1(val, _values, result)
+      val[0].is_a_namespace = true
+  result = val[0]
+
+    result
   end
 .,.,
 
- # reduce 2 omitted
+# reduce 2 omitted
 
- # reduce 3 omitted
+module_eval(<<'.,.,', 'grammar.ra', 37)
+  def _reduce_3(val, _values, result)
+        result = ast AST::ASTArray, :children => [val[0]]
+  
+    result
+  end
+.,.,
 
-module_eval <<'.,.,', 'grammar.ra', 62
-  def _reduce_4( val, _values, result )
-    if val[0] and val[1]
-        if val[0].instance_of?(AST::ASTArray)
-            val[0].push(val[1])
-            result = val[0]
-        else
-            result = ast AST::ASTArray, :children => [val[0],val[1]]
-        end
-    elsif obj = (val[0] || val[1])
-        result = obj
-    else result = nil
-    end
-   result
+module_eval(<<'.,.,', 'grammar.ra', 40)
+  def _reduce_4(val, _values, result)
+        val[0].push(val[1])
+    result = val[0]
+  
+    result
   end
 .,.,
 
- # reduce 5 omitted
+# reduce 5 omitted
 
- # reduce 6 omitted
+# reduce 6 omitted
 
- # reduce 7 omitted
+# reduce 7 omitted
 
- # reduce 8 omitted
+# reduce 8 omitted
 
- # reduce 9 omitted
+# reduce 9 omitted
 
- # reduce 10 omitted
+# reduce 10 omitted
 
- # reduce 11 omitted
+# reduce 11 omitted
 
- # reduce 12 omitted
+# reduce 12 omitted
 
- # reduce 13 omitted
+# reduce 13 omitted
 
- # reduce 14 omitted
+# reduce 14 omitted
 
- # reduce 15 omitted
+# reduce 15 omitted
 
- # reduce 16 omitted
+# reduce 16 omitted
 
- # reduce 17 omitted
+# reduce 17 omitted
 
- # reduce 18 omitted
+# reduce 18 omitted
 
-module_eval <<'.,.,', 'grammar.ra', 82
-  def _reduce_19( val, _values, result )
-    result = AST::Relationship.new(val[0], val[2], val[1][:value], ast_context)
-   result
+module_eval(<<'.,.,', 'grammar.ra', 61)
+  def _reduce_19(val, _values, result)
+      result = AST::Relationship.new(val[0], val[2], val[1][:value], ast_context)
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 85
-  def _reduce_20( val, _values, result )
-    result = AST::Relationship.new(val[0], val[2], val[1][:value], ast_context)
-   result
+module_eval(<<'.,.,', 'grammar.ra', 64)
+  def _reduce_20(val, _values, result)
+        result = AST::Relationship.new(val[0], val[2], val[1][:value], ast_context)
+
+    result
   end
 .,.,
 
- # reduce 21 omitted
+# reduce 21 omitted
 
- # reduce 22 omitted
+# reduce 22 omitted
 
- # reduce 23 omitted
+# reduce 23 omitted
 
- # reduce 24 omitted
+# reduce 24 omitted
 
- # reduce 25 omitted
+# reduce 25 omitted
 
- # reduce 26 omitted
+# reduce 26 omitted
 
- # reduce 27 omitted
+# reduce 27 omitted
 
-module_eval <<'.,.,', 'grammar.ra', 98
-  def _reduce_28( val, _values, result )
-    args = aryfy(val[2])
-    result = ast AST::Function,
-        :name => val[0][:value],
-        :line => val[0][:line],
-        :arguments => args,
-        :ftype => :statement
-   result
+module_eval(<<'.,.,', 'grammar.ra', 72)
+  def _reduce_28(val, _values, result)
+      args = aryfy(val[2])
+  result = ast AST::Function,
+    :name => val[0][:value],
+    :line => val[0][:line],
+    :arguments => args,
+    :ftype => :statement
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 106
-  def _reduce_29( val, _values, result )
-    args = aryfy(val[2])
-    result = ast AST::Function,
-        :name => val[0][:value],
-        :line => val[0][:line],
-        :arguments => args,
-        :ftype => :statement
-   result
+module_eval(<<'.,.,', 'grammar.ra', 80)
+  def _reduce_29(val, _values, result)
+      args = aryfy(val[2])
+  result = ast AST::Function,
+    :name => val[0][:value],
+    :line => val[0][:line],
+    :arguments => args,
+    :ftype => :statement
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 112
-  def _reduce_30( val, _values, result )
-    result = ast AST::Function,
-        :name => val[0][:value],
-        :line => val[0][:line],
-        :arguments => AST::ASTArray.new({}),
-        :ftype => :statement
-   result
+module_eval(<<'.,.,', 'grammar.ra', 87)
+  def _reduce_30(val, _values, result)
+      result = ast AST::Function,
+    :name => val[0][:value],
+    :line => val[0][:line],
+    :arguments => AST::ASTArray.new({}),
+    :ftype => :statement
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 120
-  def _reduce_31( val, _values, result )
-    args = aryfy(val[1])
+module_eval(<<'.,.,', 'grammar.ra', 94)
+  def _reduce_31(val, _values, result)
+        args = aryfy(val[1])
     result = ast AST::Function,
-        :name => val[0][:value],
-        :line => val[0][:line],
-        :arguments => args,
-        :ftype => :statement
-   result
+    :name => val[0][:value],
+    :line => val[0][:line],
+    :arguments => args,
+    :ftype => :statement
+
+    result
   end
 .,.,
 
- # reduce 32 omitted
+# reduce 32 omitted
 
- # reduce 33 omitted
+# reduce 33 omitted
 
-module_eval <<'.,.,', 'grammar.ra', 128
-  def _reduce_34( val, _values, result )
-    result = aryfy(val[0], val[2])
+module_eval(<<'.,.,', 'grammar.ra', 105)
+  def _reduce_34(val, _values, result)
+        result = aryfy(val[0], val[2])
     result.line = @lexer.line
     result.file = @lexer.file
-   result
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 137
-  def _reduce_35( val, _values, result )
-    unless val[0].is_a?(AST::ASTArray)
-        val[0] = aryfy(val[0])
-    end
+module_eval(<<'.,.,', 'grammar.ra', 110)
+  def _reduce_35(val, _values, result)
+        unless val[0].is_a?(AST::ASTArray)
+    val[0] = aryfy(val[0])
+  end
 
-    val[0].push(val[2])
+  val[0].push(val[2])
 
-    result = val[0]
-   result
+  result = val[0]
+
+    result
   end
 .,.,
 
- # reduce 36 omitted
+# reduce 36 omitted
 
- # reduce 37 omitted
+# reduce 37 omitted
 
- # reduce 38 omitted
+# reduce 38 omitted
 
- # reduce 39 omitted
+# reduce 39 omitted
 
- # reduce 40 omitted
+# reduce 40 omitted
 
- # reduce 41 omitted
+# reduce 41 omitted
 
- # reduce 42 omitted
+# reduce 42 omitted
 
- # reduce 43 omitted
+# reduce 43 omitted
 
-module_eval <<'.,.,', 'grammar.ra', 151
-  def _reduce_44( val, _values, result )
-                    result = ast AST::Name, :value => val[0][:value]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 130)
+  def _reduce_44(val, _values, result)
+        result = ast AST::Name, :value => val[0][:value]
+      
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 173
-  def _reduce_45( val, _values, result )
-    @lexer.commentpop
-    array = val[2]
-    if array.instance_of?(AST::ResourceInstance)
-        array = [array]
-    end
-    result = ast AST::ASTArray
+module_eval(<<'.,.,', 'grammar.ra', 134)
+  def _reduce_45(val, _values, result)
+      @lexer.commentpop
+  array = val[2]
+  array = [array] if array.instance_of?(AST::ResourceInstance)
+  result = ast AST::ASTArray
+
+  # this iterates across each specified resourceinstance
+  array.each { |instance|
+    raise Puppet::Dev, "Got something that isn't an instance" unless instance.instance_of?(AST::ResourceInstance)
+    # now, i need to somehow differentiate between those things with
+    # arrays in their names, and normal things
+
+      result.push ast(
+        AST::Resource,
+      :type => val[0],
+      :title => instance[0],
+
+      :parameters => instance[1])
+  }
 
-    # this iterates across each specified resourceinstance
-    array.each { |instance|
-        unless instance.instance_of?(AST::ResourceInstance)
-            raise Puppet::Dev, "Got something that isn't an instance"
-        end
-        # now, i need to somehow differentiate between those things with
-        # arrays in their names, and normal things
-        result.push ast(AST::Resource,
-            :type => val[0],
-            :title => instance[0],
-            :parameters => instance[1])
-    }
-   result
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 176
-  def _reduce_46( val, _values, result )
-    # This is a deprecated syntax.
-    error "All resource specifications require names"
-   result
+module_eval(<<'.,.,', 'grammar.ra', 153)
+  def _reduce_46(val, _values, result)
+      # This is a deprecated syntax.
+  error "All resource specifications require names"
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 180
-  def _reduce_47( val, _values, result )
-    # a defaults setting for a type
-    @lexer.commentpop
-    result = ast(AST::ResourceDefaults, :type => val[0], :parameters => val[2])
-   result
+module_eval(<<'.,.,', 'grammar.ra', 156)
+  def _reduce_47(val, _values, result)
+      # a defaults setting for a type
+  @lexer.commentpop
+  result = ast(AST::ResourceDefaults, :type => val[0], :parameters => val[2])
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 186
-  def _reduce_48( val, _values, result )
-    @lexer.commentpop
-    result = ast AST::ResourceOverride, :object => val[0], :parameters => val[2]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 163)
+  def _reduce_48(val, _values, result)
+      @lexer.commentpop
+  result = ast AST::ResourceOverride, :object => val[0], :parameters => val[2]
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 213
-  def _reduce_49( val, _values, result )
-    type = val[0]
+module_eval(<<'.,.,', 'grammar.ra', 170)
+  def _reduce_49(val, _values, result)
+      type = val[0]
 
-    if (type == :exported and ! Puppet[:storeconfigs]) and ! Puppet[:parseonly]
-        Puppet.warning addcontext("You cannot collect without storeconfigs being set")
-    end
+  if (type == :exported and ! Puppet[:storeconfigs]) and ! Puppet[:parseonly]
+    Puppet.warning addcontext("You cannot collect without storeconfigs being set")
+  end
 
-    if val[1].is_a? AST::ResourceDefaults
-        error "Defaults are not virtualizable"
-    end
+  error "Defaults are not virtualizable" if val[1].is_a? AST::ResourceDefaults
 
-    method = type.to_s + "="
+  method = type.to_s + "="
 
-    # Just mark our resources as exported and pass them through.
-    if val[1].instance_of?(AST::ASTArray)
-        val[1].each do |obj|
-            obj.send(method, true)
-        end
-    else
-        val[1].send(method, true)
+  # Just mark our resources as exported and pass them through.
+  if val[1].instance_of?(AST::ASTArray)
+    val[1].each do |obj|
+      obj.send(method, true)
     end
+  else
+    val[1].send(method, true)
+  end
 
-    result = val[1]
-   result
+  result = val[1]
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 214
-  def _reduce_50( val, _values, result )
- result = :virtual
-   result
+module_eval(<<'.,.,', 'grammar.ra', 192)
+  def _reduce_50(val, _values, result)
+     result = :virtual 
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 215
-  def _reduce_51( val, _values, result )
- result = :exported
-   result
+module_eval(<<'.,.,', 'grammar.ra', 193)
+  def _reduce_51(val, _values, result)
+     result = :exported 
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 240
-  def _reduce_52( val, _values, result )
-    @lexer.commentpop
-    if val[0] =~ /^[a-z]/
-        Puppet.warning addcontext("Collection names must now be capitalized")
-    end
-    type = val[0].downcase
-    args = {:type => type}
-
-    if val[1].is_a?(AST::CollExpr)
-        args[:query] = val[1]
-        args[:query].type = type
-        args[:form] = args[:query].form
-    else
-        args[:form] = val[1]
-    end
-    if args[:form] == :exported and ! Puppet[:storeconfigs] and ! Puppet[:parseonly]
-        Puppet.warning addcontext("You cannot collect exported resources without storeconfigs being set; the collection will be ignored")
-    end
-    args[:override] = val[3]
-    result = ast AST::Collection, args
-   result
+module_eval(<<'.,.,', 'grammar.ra', 198)
+  def _reduce_52(val, _values, result)
+      @lexer.commentpop
+  Puppet.warning addcontext("Collection names must now be capitalized") if val[0] =~ /^[a-z]/
+  type = val[0].downcase
+  args = {:type => type}
+
+  if val[1].is_a?(AST::CollExpr)
+    args[:query] = val[1]
+    args[:query].type = type
+    args[:form] = args[:query].form
+  else
+    args[:form] = val[1]
+  end
+  if args[:form] == :exported and ! Puppet[:storeconfigs] and ! Puppet[:parseonly]
+    Puppet.warning addcontext("You cannot collect exported resources without storeconfigs being set; the collection will be ignored")
+  end
+  args[:override] = val[3]
+  result = ast AST::Collection, args
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 259
-  def _reduce_53( val, _values, result )
-    if val[0] =~ /^[a-z]/
-        Puppet.warning addcontext("Collection names must now be capitalized")
-    end
-    type = val[0].downcase
-    args = {:type => type }
-
-    if val[1].is_a?(AST::CollExpr)
-        args[:query] = val[1]
-        args[:query].type = type
-        args[:form] = args[:query].form
-    else
-        args[:form] = val[1]
-    end
-    if args[:form] == :exported and ! Puppet[:storeconfigs] and ! Puppet[:parseonly]
-        Puppet.warning addcontext("You cannot collect exported resources without storeconfigs being set; the collection will be ignored")
-    end
-    result = ast AST::Collection, args
-   result
+module_eval(<<'.,.,', 'grammar.ra', 217)
+  def _reduce_53(val, _values, result)
+        if val[0] =~ /^[a-z]/
+    Puppet.warning addcontext("Collection names must now be capitalized")
+  end
+  type = val[0].downcase
+  args = {:type => type }
+
+  if val[1].is_a?(AST::CollExpr)
+    args[:query] = val[1]
+    args[:query].type = type
+    args[:form] = args[:query].form
+  else
+    args[:form] = val[1]
+  end
+  if args[:form] == :exported and ! Puppet[:storeconfigs] and ! Puppet[:parseonly]
+    Puppet.warning addcontext("You cannot collect exported resources without storeconfigs being set; the collection will be ignored")
+  end
+  result = ast AST::Collection, args
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 269
-  def _reduce_54( val, _values, result )
-    if val[1]
-        result = val[1]
-        result.form = :virtual
-    else
-        result = :virtual
-    end
-   result
+module_eval(<<'.,.,', 'grammar.ra', 238)
+  def _reduce_54(val, _values, result)
+      if val[1]
+    result = val[1]
+    result.form = :virtual
+  else
+    result = :virtual
+  end
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 277
-  def _reduce_55( val, _values, result )
-    if val[1]
-        result = val[1]
-        result.form = :exported
-    else
-        result = :exported
-    end
-   result
+module_eval(<<'.,.,', 'grammar.ra', 246)
+  def _reduce_55(val, _values, result)
+        if val[1]
+    result = val[1]
+    result.form = :exported
+  else
+    result = :exported
+  end
+
+    result
   end
 .,.,
 
- # reduce 56 omitted
+# reduce 56 omitted
+
+# reduce 57 omitted
 
- # reduce 57 omitted
+module_eval(<<'.,.,', 'grammar.ra', 259)
+  def _reduce_58(val, _values, result)
+        result = ast AST::CollExpr, :test1 => val[0], :oper => val[1], :test2 => val[2]
 
-module_eval <<'.,.,', 'grammar.ra', 285
-  def _reduce_58( val, _values, result )
-    result = ast AST::CollExpr, :test1 => val[0], :oper => val[1], :test2 => val[2]
-   result
+    result
   end
 .,.,
 
- # reduce 59 omitted
+# reduce 59 omitted
 
-module_eval <<'.,.,', 'grammar.ra', 291
-  def _reduce_60( val, _values, result )
-    result = val[1]
+module_eval(<<'.,.,', 'grammar.ra', 264)
+  def _reduce_60(val, _values, result)
+        result = val[1]
     result.parens = true
-   result
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 292
-  def _reduce_61( val, _values, result )
- result=val[0][:value]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 268)
+  def _reduce_61(val, _values, result)
+     result=val[0][:value] 
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 293
-  def _reduce_62( val, _values, result )
- result=val[0][:value]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 269)
+  def _reduce_62(val, _values, result)
+     result=val[0][:value] 
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 300
-  def _reduce_63( val, _values, result )
-    result = ast AST::CollExpr, :test1 => val[0], :oper => val[1][:value], :test2 => val[2]
-    #result = ast AST::CollExpr
-    #result.push *val
-   result
+module_eval(<<'.,.,', 'grammar.ra', 272)
+  def _reduce_63(val, _values, result)
+      result = ast AST::CollExpr, :test1 => val[0], :oper => val[1][:value], :test2 => val[2]
+  #result = ast AST::CollExpr
+  #result.push *val
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 305
-  def _reduce_64( val, _values, result )
-    result = ast AST::CollExpr, :test1 => val[0], :oper => val[1][:value], :test2 => val[2]
+module_eval(<<'.,.,', 'grammar.ra', 277)
+  def _reduce_64(val, _values, result)
+        result = ast AST::CollExpr, :test1 => val[0], :oper => val[1][:value], :test2 => val[2]
     #result = ast AST::CollExpr
     #result.push *val
-   result
+
+    result
   end
 .,.,
 
- # reduce 65 omitted
+# reduce 65 omitted
 
- # reduce 66 omitted
+# reduce 66 omitted
 
-module_eval <<'.,.,', 'grammar.ra', 312
-  def _reduce_67( val, _values, result )
-    result = ast AST::ResourceInstance, :children => [val[0],val[2]]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 286)
+  def _reduce_67(val, _values, result)
+      result = ast AST::ResourceInstance, :children => [val[0],val[2]]
+
+    result
   end
 .,.,
 
- # reduce 68 omitted
+# reduce 68 omitted
 
-module_eval <<'.,.,', 'grammar.ra', 322
-  def _reduce_69( val, _values, result )
-    if val[0].instance_of?(AST::ResourceInstance)
-        result = ast AST::ASTArray, :children => [val[0],val[2]]
-    else
-        val[0].push val[2]
-        result = val[0]
-    end
-   result
+module_eval(<<'.,.,', 'grammar.ra', 291)
+  def _reduce_69(val, _values, result)
+        if val[0].instance_of?(AST::ResourceInstance)
+    result = ast AST::ASTArray, :children => [val[0],val[2]]
+  else
+    val[0].push val[2]
+    result = val[0]
+  end
+
+    result
   end
 .,.,
 
- # reduce 70 omitted
+# reduce 70 omitted
 
- # reduce 71 omitted
+# reduce 71 omitted
 
-module_eval <<'.,.,', 'grammar.ra', 329
-  def _reduce_72( val, _values, result )
-    result = ast AST::Undef, :value => :undef
-   result
+module_eval(<<'.,.,', 'grammar.ra', 303)
+  def _reduce_72(val, _values, result)
+      result = ast AST::Undef, :value => :undef
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 333
-  def _reduce_73( val, _values, result )
-    result = ast AST::Name, :value => val[0][:value], :line => val[0][:line]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 307)
+  def _reduce_73(val, _values, result)
+      result = ast AST::Name, :value => val[0][:value], :line => val[0][:line]
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 337
-  def _reduce_74( val, _values, result )
-    result = ast AST::Type, :value => val[0][:value], :line => val[0][:line]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 311)
+  def _reduce_74(val, _values, result)
+      result = ast AST::Type, :value => val[0][:value], :line => val[0][:line]
+
+    result
   end
 .,.,
 
- # reduce 75 omitted
+# reduce 75 omitted
 
- # reduce 76 omitted
+# reduce 76 omitted
 
- # reduce 77 omitted
+# reduce 77 omitted
 
- # reduce 78 omitted
+# reduce 78 omitted
 
- # reduce 79 omitted
+# reduce 79 omitted
 
- # reduce 80 omitted
+# reduce 80 omitted
 
- # reduce 81 omitted
+# reduce 81 omitted
 
-module_eval <<'.,.,', 'grammar.ra', 354
-  def _reduce_82( val, _values, result )
-    if val[0][:value] =~ /::/
-        raise Puppet::ParseError, "Cannot assign to variables in other namespaces"
-    end
-    # this is distinct from referencing a variable
-    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]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 323)
+  def _reduce_82(val, _values, result)
+      raise Puppet::ParseError, "Cannot assign to variables in other namespaces" if val[0][:value] =~ /::/
+  # this is distinct from referencing a variable
+  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]
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 357
-  def _reduce_83( val, _values, result )
-    result = ast AST::VarDef, :name => val[0], :value => val[2]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 329)
+  def _reduce_83(val, _values, result)
+        result = ast AST::VarDef, :name => val[0], :value => val[2]
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 362
-  def _reduce_84( val, _values, result )
-    variable = ast AST::Name, :value => val[0][:value], :line => val[0][:line]
-    result = ast AST::VarDef, :name => variable, :value => val[2], :append => true, :line => val[0][:line]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 333)
+  def _reduce_84(val, _values, result)
+      variable = ast AST::Name, :value => val[0][:value], :line => val[0][:line]
+  result = ast AST::VarDef, :name => variable, :value => val[2], :append => true, :line => val[0][:line]
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 367
-  def _reduce_85( val, _values, result )
-    result = ast AST::ASTArray
-   result
+module_eval(<<'.,.,', 'grammar.ra', 339)
+  def _reduce_85(val, _values, result)
+      result = ast AST::ASTArray
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 367
-  def _reduce_86( val, _values, result )
- result = val[0]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 341)
+  def _reduce_86(val, _values, result)
+     result = val[0] 
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 376
-  def _reduce_87( val, _values, result )
-    if val[0].instance_of?(AST::ASTArray)
-        val[0].push(val[2])
-        result = val[0]
-    else
-        result = ast AST::ASTArray, :children => [val[0],val[2]]
-    end
-   result
+module_eval(<<'.,.,', 'grammar.ra', 343)
+  def _reduce_87(val, _values, result)
+        if val[0].instance_of?(AST::ASTArray)
+    val[0].push(val[2])
+    result = val[0]
+  else
+    result = ast AST::ASTArray, :children => [val[0],val[2]]
+  end
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 380
-  def _reduce_88( val, _values, result )
-    result = ast AST::ResourceParam, :param => val[0][:value], :line => val[0][:line], :value => val[2]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 352)
+  def _reduce_88(val, _values, result)
+      result = ast AST::ResourceParam, :param => val[0][:value], :line => val[0][:line], :value => val[2]
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 385
-  def _reduce_89( val, _values, result )
-    result = ast AST::ResourceParam, :param => val[0][:value], :line => val[0][:line], :value => val[2],
-                                     :add => true
-   result
+module_eval(<<'.,.,', 'grammar.ra', 356)
+  def _reduce_89(val, _values, result)
+      result = ast AST::ResourceParam, :param => val[0][:value], :line => val[0][:line], :value => val[2],
+    :add => true
+
+    result
   end
 .,.,
 
- # reduce 90 omitted
+# reduce 90 omitted
 
- # reduce 91 omitted
+# reduce 91 omitted
 
-module_eval <<'.,.,', 'grammar.ra', 393
-  def _reduce_92( val, _values, result )
-    result = ast AST::ASTArray
-   result
+module_eval(<<'.,.,', 'grammar.ra', 365)
+  def _reduce_92(val, _values, result)
+      result = ast AST::ASTArray
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 393
-  def _reduce_93( val, _values, result )
- result = val[0]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 367)
+  def _reduce_93(val, _values, result)
+     result = val[0] 
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 402
-  def _reduce_94( val, _values, result )
-    if val[0].instance_of?(AST::ASTArray)
-        val[0].push(val[2])
-        result = val[0]
-    else
-        result = ast AST::ASTArray, :children => [val[0],val[2]]
-    end
-   result
+module_eval(<<'.,.,', 'grammar.ra', 369)
+  def _reduce_94(val, _values, result)
+        if val[0].instance_of?(AST::ASTArray)
+    val[0].push(val[2])
+    result = val[0]
+  else
+    result = ast AST::ASTArray, :children => [val[0],val[2]]
+  end
+
+    result
   end
 .,.,
 
- # reduce 95 omitted
+# reduce 95 omitted
 
-module_eval <<'.,.,', 'grammar.ra', 411
-  def _reduce_96( val, _values, result )
-    if val[0].instance_of?(AST::ASTArray)
-        result = val[0].push(val[2])
-    else
-        result = ast AST::ASTArray, :children => [val[0],val[2]]
-    end
-   result
+module_eval(<<'.,.,', 'grammar.ra', 379)
+  def _reduce_96(val, _values, result)
+        if val[0].instance_of?(AST::ASTArray)
+    result = val[0].push(val[2])
+  else
+    result = ast AST::ASTArray, :children => [val[0],val[2]]
+  end
+
+    result
   end
 .,.,
 
- # reduce 97 omitted
+# reduce 97 omitted
 
- # reduce 98 omitted
+# reduce 98 omitted
 
- # reduce 99 omitted
+# reduce 99 omitted
 
- # reduce 100 omitted
+# reduce 100 omitted
 
- # reduce 101 omitted
+# reduce 101 omitted
 
- # reduce 102 omitted
+# reduce 102 omitted
 
- # reduce 103 omitted
+# reduce 103 omitted
 
- # reduce 104 omitted
+# reduce 104 omitted
 
- # reduce 105 omitted
+# reduce 105 omitted
 
- # reduce 106 omitted
+# reduce 106 omitted
 
- # reduce 107 omitted
+# reduce 107 omitted
 
- # reduce 108 omitted
+# reduce 108 omitted
 
- # reduce 109 omitted
+# reduce 109 omitted
 
- # reduce 110 omitted
+# reduce 110 omitted
 
- # reduce 111 omitted
+# reduce 111 omitted
 
- # reduce 112 omitted
+# reduce 112 omitted
 
- # reduce 113 omitted
+# reduce 113 omitted
 
- # reduce 114 omitted
+# reduce 114 omitted
 
-module_eval <<'.,.,', 'grammar.ra', 440
-  def _reduce_115( val, _values, result )
-    args = aryfy(val[2])
-    result = ast AST::Function,
-        :name => val[0][:value], :line => val[0][:line],
-        :arguments => args,
-        :ftype => :rvalue
-   result
+module_eval(<<'.,.,', 'grammar.ra', 408)
+  def _reduce_115(val, _values, result)
+      args = aryfy(val[2])
+  result = ast AST::Function,
+    :name => val[0][:value], :line => val[0][:line],
+    :arguments => args,
+    :ftype => :rvalue
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 445
-  def _reduce_116( val, _values, result )
-    result = ast AST::Function,
-        :name => val[0][:value], :line => val[0][:line],
-        :arguments => AST::ASTArray.new({}),
-        :ftype => :rvalue
-   result
+module_eval(<<'.,.,', 'grammar.ra', 414)
+  def _reduce_116(val, _values, result)
+      result = ast AST::Function,
+    :name => val[0][:value], :line => val[0][:line],
+    :arguments => AST::ASTArray.new({}),
+    :ftype => :rvalue
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 446
-  def _reduce_117( val, _values, result )
- result = ast AST::String, :value => val[0][:value],                  :line => val[0][:line]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 420)
+  def _reduce_117(val, _values, result)
+     result = ast AST::String, :value => val[0][:value],                  :line => val[0][:line] 
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 447
-  def _reduce_118( val, _values, result )
- result = ast AST::Concat, :value => [ast(AST::String,val[0])]+val[1], :line => val[0][:line]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 421)
+  def _reduce_118(val, _values, result)
+     result = ast AST::Concat, :value => [ast(AST::String,val[0])]+val[1], :line => val[0][:line] 
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 449
-  def _reduce_119( val, _values, result )
- result = [val[0]] + val[1]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 423)
+  def _reduce_119(val, _values, result)
+     result = [val[0]] + val[1] 
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 451
-  def _reduce_120( val, _values, result )
- result = [ast(AST::String,val[0])]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 425)
+  def _reduce_120(val, _values, result)
+     result = [ast(AST::String,val[0])]          
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 452
-  def _reduce_121( val, _values, result )
- result = [ast(AST::String,val[0])] + val[1]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 426)
+  def _reduce_121(val, _values, result)
+     result = [ast(AST::String,val[0])] + val[1] 
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 457
-  def _reduce_122( val, _values, result )
-    result = ast AST::Boolean, :value => val[0][:value], :line => val[0][:line]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 429)
+  def _reduce_122(val, _values, result)
+      result = ast AST::Boolean, :value => val[0][:value], :line => val[0][:line]
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 462
-  def _reduce_123( val, _values, result )
-    Puppet.warning addcontext("Deprecation notice:  Resource references should now be capitalized")
-    result = ast AST::ResourceReference, :type => val[0][:value], :line => val[0][:line], :title => val[2]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 433)
+  def _reduce_123(val, _values, result)
+      Puppet.warning addcontext("Deprecation notice:  Resource references should now be capitalized")
+  result = ast AST::ResourceReference, :type => val[0][:value], :line => val[0][:line], :title => val[2]
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 464
-  def _reduce_124( val, _values, result )
-    result = ast AST::ResourceReference, :type => val[0], :title => val[2]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 436)
+  def _reduce_124(val, _values, result)
+      result = ast AST::ResourceReference, :type => val[0], :title => val[2]
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 468
-  def _reduce_125( val, _values, result )
-    result = val[1]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 440)
+  def _reduce_125(val, _values, result)
+      result = val[1]
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 482
-  def _reduce_126( val, _values, result )
-    @lexer.commentpop
-    args = {
-        :test => val[0],
-        :statements => val[2]
-    }
+module_eval(<<'.,.,', 'grammar.ra', 444)
+  def _reduce_126(val, _values, result)
+      @lexer.commentpop
+  args = {
+    :test => val[0],
+    :statements => val[2]
+  }
 
-    if val[4]
-        args[:else] = val[4]
-    end
+  args[:else] = val[4] if val[4]
 
-    result = ast AST::IfStatement, args
-   result
+  result = ast AST::IfStatement, args
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 495
-  def _reduce_127( val, _values, result )
-    @lexer.commentpop
+module_eval(<<'.,.,', 'grammar.ra', 455)
+  def _reduce_127(val, _values, result)
+        @lexer.commentpop
     args = {
-        :test => val[0],
-        :statements => ast(AST::Nop)
-    }
+      :test => val[0],
+      :statements => ast(AST::Nop)
+  }
 
-    if val[3]
-        args[:else] = val[3]
-    end
+  args[:else] = val[3] if val[3]
 
-    result = ast AST::IfStatement, args
-   result
+  result = ast AST::IfStatement, args
+
+    result
   end
 .,.,
 
- # reduce 128 omitted
+# reduce 128 omitted
+
+module_eval(<<'.,.,', 'grammar.ra', 468)
+  def _reduce_129(val, _values, result)
+        result = ast AST::Else, :statements => val[1]
 
-module_eval <<'.,.,', 'grammar.ra', 501
-  def _reduce_129( val, _values, result )
-                #@lexer.commentpop
-    result = ast AST::Else, :statements => val[1]
-   result
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 505
-  def _reduce_130( val, _values, result )
-    @lexer.commentpop
+module_eval(<<'.,.,', 'grammar.ra', 471)
+  def _reduce_130(val, _values, result)
+        @lexer.commentpop
     result = ast AST::Else, :statements => val[2]
-   result
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 509
-  def _reduce_131( val, _values, result )
-    @lexer.commentpop
+module_eval(<<'.,.,', 'grammar.ra', 475)
+  def _reduce_131(val, _values, result)
+        @lexer.commentpop
     result = ast AST::Else, :statements => ast(AST::Nop)
-   result
+
+    result
   end
 .,.,
 
- # reduce 132 omitted
+# reduce 132 omitted
 
-module_eval <<'.,.,', 'grammar.ra', 526
-  def _reduce_133( val, _values, result )
-    result = ast AST::InOperator, :lval => val[0], :rval => val[2]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 493)
+  def _reduce_133(val, _values, result)
+        result = ast AST::InOperator, :lval => val[0], :rval => val[2]
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 529
-  def _reduce_134( val, _values, result )
-    result = ast AST::MatchOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 496)
+  def _reduce_134(val, _values, result)
+        result = ast AST::MatchOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2]
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 532
-  def _reduce_135( val, _values, result )
-    result = ast AST::MatchOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 499)
+  def _reduce_135(val, _values, result)
+        result = ast AST::MatchOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2]
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 535
-  def _reduce_136( val, _values, result )
-    result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 502)
+  def _reduce_136(val, _values, result)
+        result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2]
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 538
-  def _reduce_137( val, _values, result )
-    result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 505)
+  def _reduce_137(val, _values, result)
+        result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2]
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 541
-  def _reduce_138( val, _values, result )
-    result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 508)
+  def _reduce_138(val, _values, result)
+        result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2]
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 544
-  def _reduce_139( val, _values, result )
-    result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 511)
+  def _reduce_139(val, _values, result)
+        result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2]
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 547
-  def _reduce_140( val, _values, result )
-    result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 514)
+  def _reduce_140(val, _values, result)
+        result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2]
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 550
-  def _reduce_141( val, _values, result )
-    result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 517)
+  def _reduce_141(val, _values, result)
+        result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2]
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 553
-  def _reduce_142( val, _values, result )
-    result = ast AST::Minus, :value => val[1]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 520)
+  def _reduce_142(val, _values, result)
+        result = ast AST::Minus, :value => val[1]
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 556
-  def _reduce_143( val, _values, result )
-    result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 523)
+  def _reduce_143(val, _values, result)
+        result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2]
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 559
-  def _reduce_144( val, _values, result )
-    result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 526)
+  def _reduce_144(val, _values, result)
+        result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2]
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 562
-  def _reduce_145( val, _values, result )
-    result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 529)
+  def _reduce_145(val, _values, result)
+        result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2]
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 565
-  def _reduce_146( val, _values, result )
-    result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 532)
+  def _reduce_146(val, _values, result)
+        result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2]
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 568
-  def _reduce_147( val, _values, result )
-    result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 535)
+  def _reduce_147(val, _values, result)
+        result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2]
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 571
-  def _reduce_148( val, _values, result )
-    result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 538)
+  def _reduce_148(val, _values, result)
+        result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2]
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 574
-  def _reduce_149( val, _values, result )
-    result = ast AST::Not, :value => val[1]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 541)
+  def _reduce_149(val, _values, result)
+        result = ast AST::Not, :value => val[1]
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 577
-  def _reduce_150( val, _values, result )
-    result = ast AST::BooleanOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 544)
+  def _reduce_150(val, _values, result)
+        result = ast AST::BooleanOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2]
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 580
-  def _reduce_151( val, _values, result )
-    result = ast AST::BooleanOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 547)
+  def _reduce_151(val, _values, result)
+        result = ast AST::BooleanOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2]
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 583
-  def _reduce_152( val, _values, result )
-    result = val[1]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 550)
+  def _reduce_152(val, _values, result)
+        result = val[1]
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 592
-  def _reduce_153( val, _values, result )
-    @lexer.commentpop
-    options = val[3]
-    unless options.instance_of?(AST::ASTArray)
-        options = ast AST::ASTArray, :children => [val[3]]
-    end
-    result = ast AST::CaseStatement, :test => val[1], :options => options
-   result
+module_eval(<<'.,.,', 'grammar.ra', 554)
+  def _reduce_153(val, _values, result)
+      @lexer.commentpop
+  options = val[3]
+  options = ast AST::ASTArray, :children => [val[3]] unless options.instance_of?(AST::ASTArray)
+  result = ast AST::CaseStatement, :test => val[1], :options => options
+
+    result
   end
 .,.,
 
- # reduce 154 omitted
+# reduce 154 omitted
 
-module_eval <<'.,.,', 'grammar.ra', 602
-  def _reduce_155( val, _values, result )
-    if val[0].instance_of?(AST::ASTArray)
-        val[0].push val[1]
-        result = val[0]
-    else
-        result = ast AST::ASTArray, :children => [val[0], val[1]]
-    end
-   result
+module_eval(<<'.,.,', 'grammar.ra', 562)
+  def _reduce_155(val, _values, result)
+        if val[0].instance_of?(AST::ASTArray)
+    val[0].push val[1]
+    result = val[0]
+  else
+    result = ast AST::ASTArray, :children => [val[0], val[1]]
+  end
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 607
-  def _reduce_156( val, _values, result )
-    @lexer.commentpop
-    result = ast AST::CaseOpt, :value => val[0], :statements => val[3]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 571)
+  def _reduce_156(val, _values, result)
+      @lexer.commentpop
+  result = ast AST::CaseOpt, :value => val[0], :statements => val[3]
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 613
-  def _reduce_157( val, _values, result )
-    @lexer.commentpop
-    result = ast(AST::CaseOpt,
-        :value => val[0],
-        :statements => ast(AST::ASTArray)
-    )
-   result
+module_eval(<<'.,.,', 'grammar.ra', 574)
+  def _reduce_157(val, _values, result)
+      @lexer.commentpop
+
+    result = ast(
+    AST::CaseOpt,
+    :value => val[0],
+
+    :statements => ast(AST::ASTArray)
+  )
+
+    result
   end
 .,.,
 
- # reduce 158 omitted
+# reduce 158 omitted
 
-module_eval <<'.,.,', 'grammar.ra', 623
-  def _reduce_159( val, _values, result )
-    if val[0].instance_of?(AST::ASTArray)
-        val[0].push(val[2])
-        result = val[0]
-    else
-        result = ast AST::ASTArray, :children => [val[0],val[2]]
-    end
-   result
+module_eval(<<'.,.,', 'grammar.ra', 586)
+  def _reduce_159(val, _values, result)
+        if val[0].instance_of?(AST::ASTArray)
+    val[0].push(val[2])
+    result = val[0]
+  else
+    result = ast AST::ASTArray, :children => [val[0],val[2]]
+  end
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 627
-  def _reduce_160( val, _values, result )
-    result = ast AST::Selector, :param => val[0], :values => val[2]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 595)
+  def _reduce_160(val, _values, result)
+      result = ast AST::Selector, :param => val[0], :values => val[2]
+
+    result
   end
 .,.,
 
- # reduce 161 omitted
+# reduce 161 omitted
 
-module_eval <<'.,.,', 'grammar.ra', 633
-  def _reduce_162( val, _values, result )
-    @lexer.commentpop
+module_eval(<<'.,.,', 'grammar.ra', 600)
+  def _reduce_162(val, _values, result)
+        @lexer.commentpop
     result = val[1]
-   result
+
+    result
   end
 .,.,
 
- # reduce 163 omitted
+# reduce 163 omitted
 
-module_eval <<'.,.,', 'grammar.ra', 643
-  def _reduce_164( val, _values, result )
-    if val[0].instance_of?(AST::ASTArray)
-        val[0].push(val[2])
-        result = val[0]
-    else
-        result = ast AST::ASTArray, :children => [val[0],val[2]]
-    end
-   result
+module_eval(<<'.,.,', 'grammar.ra', 606)
+  def _reduce_164(val, _values, result)
+        if val[0].instance_of?(AST::ASTArray)
+    val[0].push(val[2])
+    result = val[0]
+  else
+    result = ast AST::ASTArray, :children => [val[0],val[2]]
+  end
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 647
-  def _reduce_165( val, _values, result )
-    result = ast AST::ResourceParam, :param => val[0], :value => val[2]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 615)
+  def _reduce_165(val, _values, result)
+      result = ast AST::ResourceParam, :param => val[0], :value => val[2]
+
+    result
   end
 .,.,
 
- # reduce 166 omitted
+# reduce 166 omitted
+
+# reduce 167 omitted
 
- # reduce 167 omitted
+# reduce 168 omitted
 
- # reduce 168 omitted
+# reduce 169 omitted
 
- # reduce 169 omitted
+# reduce 170 omitted
 
- # reduce 170 omitted
+# reduce 171 omitted
 
- # reduce 171 omitted
+# reduce 172 omitted
 
- # reduce 172 omitted
+module_eval(<<'.,.,', 'grammar.ra', 626)
+  def _reduce_173(val, _values, result)
+        result = ast AST::Default, :value => val[0][:value], :line => val[0][:line]
 
-module_eval <<'.,.,', 'grammar.ra', 658
-  def _reduce_173( val, _values, result )
-    result = ast AST::Default, :value => val[0][:value], :line => val[0][:line]
-   result
+    result
   end
 .,.,
 
- # reduce 174 omitted
+# reduce 174 omitted
 
-module_eval <<'.,.,', 'grammar.ra', 661
-  def _reduce_175( val, _values, result )
- result = [val[0][:value]]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 631)
+  def _reduce_175(val, _values, result)
+     result = [val[0][:value]] 
+    result
   end
 .,.,
 
- # reduce 176 omitted
+# reduce 176 omitted
 
-module_eval <<'.,.,', 'grammar.ra', 663
-  def _reduce_177( val, _values, result )
- result = val[0] += val[2]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 633)
+  def _reduce_177(val, _values, result)
+     result = val[0] += val[2] 
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 672
-  def _reduce_178( val, _values, result )
-    val[1].each do |file|
-        import(file)
-    end
+module_eval(<<'.,.,', 'grammar.ra', 636)
+  def _reduce_178(val, _values, result)
+      val[1].each do |file|
+    import(file)
+  end
 
-    result = AST::ASTArray.new(:children => [])
-   result
+  result = AST::ASTArray.new(:children => [])
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 683
-  def _reduce_179( val, _values, result )
-    @lexer.commentpop
-    newdefine classname(val[1]), :arguments => val[2], :code => val[4], :line => val[0][:line]
-    @lexer.indefine = false
-    result = nil
+module_eval(<<'.,.,', 'grammar.ra', 646)
+  def _reduce_179(val, _values, result)
+      @lexer.commentpop
+  result = Puppet::Parser::AST::Definition.new(classname(val[1]),
+                                               ast_context(true).merge(:arguments => val[2], :code => val[4],
+                                                                       :line => val[0][:line]))
+  @lexer.indefine = false
 
 #}           | DEFINE NAME argumentlist parent LBRACE RBRACE {
-   result
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 688
-  def _reduce_180( val, _values, result )
-    @lexer.commentpop
-    newdefine classname(val[1]), :arguments => val[2], :line => val[0][:line]
-    @lexer.indefine = false
-    result = nil
-   result
+module_eval(<<'.,.,', 'grammar.ra', 654)
+  def _reduce_180(val, _values, result)
+      @lexer.commentpop
+  result = Puppet::Parser::AST::Definition.new(classname(val[1]),
+                                               ast_context(true).merge(:arguments => val[2], :line => val[0][:line]))
+  @lexer.indefine = false
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 697
-  def _reduce_181( val, _values, result )
-    @lexer.commentpop
-    # Our class gets defined in the parent namespace, not our own.
-    @lexer.namepop
-    newclass classname(val[1]), :arguments => val[2], :parent => val[3], :code => val[5], :line => val[0][:line]
-    result = nil
-   result
+module_eval(<<'.,.,', 'grammar.ra', 662)
+  def _reduce_181(val, _values, result)
+      @lexer.commentpop
+  # Our class gets defined in the parent namespace, not our own.
+  @lexer.namepop
+  val[5].is_a_namespace = true
+  result = Puppet::Parser::AST::Hostclass.new(classname(val[1]),
+                                              ast_context(true).merge(:arguments => val[2], :parent => val[3],
+                                                                      :code => val[5], :line => val[0][:line]))
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 703
-  def _reduce_182( val, _values, result )
-    @lexer.commentpop
-    # Our class gets defined in the parent namespace, not our own.
-    @lexer.namepop
-    newclass classname(val[1]), :arguments => val[2], :parent => val[3], :line => val[0][:line]
-    result = nil
-   result
+module_eval(<<'.,.,', 'grammar.ra', 670)
+  def _reduce_182(val, _values, result)
+      @lexer.commentpop
+  # Our class gets defined in the parent namespace, not our own.
+  @lexer.namepop
+  result = Puppet::Parser::AST::Hostclass.new(classname(val[1]),
+                                              ast_context(true).merge(:arguments => val[2], :parent => val[3],
+                                                                      :line => val[0][:line]))
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 709
-  def _reduce_183( val, _values, result )
-    @lexer.commentpop
-    newnode val[1], :parent => val[2], :code => val[4], :line => val[0][:line]
-    result = nil
-   result
+module_eval(<<'.,.,', 'grammar.ra', 679)
+  def _reduce_183(val, _values, result)
+      @lexer.commentpop
+  result = Puppet::Parser::AST::Node.new(val[1],
+                                         ast_context(true).merge(:parent => val[2], :code => val[4],
+                                                                 :line => val[0][:line]))
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 713
-  def _reduce_184( val, _values, result )
-    @lexer.commentpop
-    newnode val[1], :parent => val[2], :line => val[0][:line]
-    result = nil
-   result
+module_eval(<<'.,.,', 'grammar.ra', 684)
+  def _reduce_184(val, _values, result)
+      @lexer.commentpop
+  result = Puppet::Parser::AST::Node.new(val[1], ast_context(true).merge(:parent => val[2], :line => val[0][:line]))
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 714
-  def _reduce_185( val, _values, result )
- result = val[0][:value]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 688)
+  def _reduce_185(val, _values, result)
+     result = val[0][:value] 
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 716
-  def _reduce_186( val, _values, result )
- result = val[0][:value]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 690)
+  def _reduce_186(val, _values, result)
+     result = val[0][:value] 
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 717
-  def _reduce_187( val, _values, result )
- result = val[0][:value]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 691)
+  def _reduce_187(val, _values, result)
+     result = val[0][:value] 
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 718
-  def _reduce_188( val, _values, result )
- result = "class"
-   result
+module_eval(<<'.,.,', 'grammar.ra', 692)
+  def _reduce_188(val, _values, result)
+     result = "class" 
+    result
   end
 .,.,
 
- # reduce 189 omitted
+module_eval(<<'.,.,', 'grammar.ra', 697)
+  def _reduce_189(val, _values, result)
+        result = [result]
 
-module_eval <<'.,.,', 'grammar.ra', 728
-  def _reduce_190( val, _values, result )
-    result = val[0]
-    result = [result] unless result.is_a?(Array)
+    result
+  end
+.,.,
+
+module_eval(<<'.,.,', 'grammar.ra', 700)
+  def _reduce_190(val, _values, result)
+        result = val[0]
     result << val[2]
-   result
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 732
-  def _reduce_191( val, _values, result )
-    result = ast AST::HostName, :value => val[0]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 705)
+  def _reduce_191(val, _values, result)
+      result = ast AST::HostName, :value => val[0]
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 733
-  def _reduce_192( val, _values, result )
- result = val[0][:value]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 708)
+  def _reduce_192(val, _values, result)
+     result = val[0][:value] 
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 734
-  def _reduce_193( val, _values, result )
- result = val[0][:value]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 709)
+  def _reduce_193(val, _values, result)
+     result = val[0][:value] 
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 735
-  def _reduce_194( val, _values, result )
- result = val[0][:value]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 710)
+  def _reduce_194(val, _values, result)
+     result = val[0][:value] 
+    result
   end
 .,.,
 
- # reduce 195 omitted
+# reduce 195 omitted
+
+module_eval(<<'.,.,', 'grammar.ra', 714)
+  def _reduce_196(val, _values, result)
+      result = nil
 
-module_eval <<'.,.,', 'grammar.ra', 741
-  def _reduce_196( val, _values, result )
-    result = nil
-   result
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 745
-  def _reduce_197( val, _values, result )
-    result = ast AST::ASTArray, :children => []
-   result
+module_eval(<<'.,.,', 'grammar.ra', 718)
+  def _reduce_197(val, _values, result)
+      result = ast AST::ASTArray, :children => []
+
+    result
   end
 .,.,
 
- # reduce 198 omitted
+# reduce 198 omitted
+
+module_eval(<<'.,.,', 'grammar.ra', 723)
+  def _reduce_199(val, _values, result)
+        result = nil
 
-module_eval <<'.,.,', 'grammar.ra', 750
-  def _reduce_199( val, _values, result )
-    result = nil
-   result
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 754
-  def _reduce_200( val, _values, result )
-    result = val[1]
+module_eval(<<'.,.,', 'grammar.ra', 726)
+  def _reduce_200(val, _values, result)
+        result = val[1]
     result = [result] unless result[0].is_a?(Array)
-   result
+
+    result
   end
 .,.,
 
- # reduce 201 omitted
+# reduce 201 omitted
 
-module_eval <<'.,.,', 'grammar.ra', 761
-  def _reduce_202( val, _values, result )
-    result = val[0]
+module_eval(<<'.,.,', 'grammar.ra', 732)
+  def _reduce_202(val, _values, result)
+        result = val[0]
     result = [result] unless result[0].is_a?(Array)
     result << val[2]
-   result
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 766
-  def _reduce_203( val, _values, result )
-    Puppet.warning addcontext("Deprecation notice: must now include '$' in prototype")
-    result = [val[0][:value], val[2]]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 738)
+  def _reduce_203(val, _values, result)
+      Puppet.warning addcontext("Deprecation notice: must now include '$' in prototype")
+  result = [val[0][:value], val[2]]
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 770
-  def _reduce_204( val, _values, result )
-    Puppet.warning addcontext("Deprecation notice: must now include '$' in prototype")
+module_eval(<<'.,.,', 'grammar.ra', 742)
+  def _reduce_204(val, _values, result)
+        Puppet.warning addcontext("Deprecation notice: must now include '$' in prototype")
     result = [val[0][:value]]
-   result
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 772
-  def _reduce_205( val, _values, result )
-    result = [val[0][:value], val[2]]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 745)
+  def _reduce_205(val, _values, result)
+      result = [val[0][:value], val[2]]
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 774
-  def _reduce_206( val, _values, result )
-    result = [val[0][:value]]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 747)
+  def _reduce_206(val, _values, result)
+      result = [val[0][:value]]
+
+    result
   end
 .,.,
 
- # reduce 207 omitted
+# reduce 207 omitted
 
-module_eval <<'.,.,', 'grammar.ra', 779
-  def _reduce_208( val, _values, result )
-    result = val[1]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 752)
+  def _reduce_208(val, _values, result)
+        result = val[1]
+
+    result
   end
 .,.,
 
- # reduce 209 omitted
+# reduce 209 omitted
 
-module_eval <<'.,.,', 'grammar.ra', 784
-  def _reduce_210( val, _values, result )
-    result = val[1]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 757)
+  def _reduce_210(val, _values, result)
+        result = val[1]
+
+    result
   end
 .,.,
 
- # reduce 211 omitted
+# reduce 211 omitted
 
- # reduce 212 omitted
+# reduce 212 omitted
 
-module_eval <<'.,.,', 'grammar.ra', 790
-  def _reduce_213( val, _values, result )
-    result = ast AST::Variable, :value => val[0][:value], :line => val[0][:line]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 763)
+  def _reduce_213(val, _values, result)
+      result = ast AST::Variable, :value => val[0][:value], :line => val[0][:line]
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 798
-  def _reduce_214( val, _values, result )
-    if val[1].instance_of?(AST::ASTArray)
-        result = val[1]
-    else
-        result = ast AST::ASTArray, :children => [val[1]]
-    end
-   result
+module_eval(<<'.,.,', 'grammar.ra', 767)
+  def _reduce_214(val, _values, result)
+      if val[1].instance_of?(AST::ASTArray)
+    result = val[1]
+  else
+    result = ast AST::ASTArray, :children => [val[1]]
+  end
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 805
-  def _reduce_215( val, _values, result )
-    if val[1].instance_of?(AST::ASTArray)
-        result = val[1]
-    else
-        result = ast AST::ASTArray, :children => [val[1]]
-    end
-   result
+module_eval(<<'.,.,', 'grammar.ra', 774)
+  def _reduce_215(val, _values, result)
+        if val[1].instance_of?(AST::ASTArray)
+    result = val[1]
+  else
+    result = ast AST::ASTArray, :children => [val[1]]
+  end
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 807
-  def _reduce_216( val, _values, result )
-    result = ast AST::ASTArray
-   result
+module_eval(<<'.,.,', 'grammar.ra', 780)
+  def _reduce_216(val, _values, result)
+      result = ast AST::ASTArray
+
+    result
   end
 .,.,
 
- # reduce 217 omitted
+# reduce 217 omitted
 
- # reduce 218 omitted
+# reduce 218 omitted
 
- # reduce 219 omitted
+# reduce 219 omitted
 
-module_eval <<'.,.,', 'grammar.ra', 812
-  def _reduce_220( val, _values, result )
- result = nil
-   result
+module_eval(<<'.,.,', 'grammar.ra', 787)
+  def _reduce_220(val, _values, result)
+     result = nil 
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 817
-  def _reduce_221( val, _values, result )
-    result = ast AST::Regex, :value => val[0][:value]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 790)
+  def _reduce_221(val, _values, result)
+      result = ast AST::Regex, :value => val[0][:value]
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 825
-  def _reduce_222( val, _values, result )
-    if val[1].instance_of?(AST::ASTHash)
-        result = val[1]
-    else
-        result = ast AST::ASTHash, { :value => val[1] }
-    end
-   result
+module_eval(<<'.,.,', 'grammar.ra', 794)
+  def _reduce_222(val, _values, result)
+      if val[1].instance_of?(AST::ASTHash)
+    result = val[1]
+  else
+    result = ast AST::ASTHash, { :value => val[1] }
   end
-.,.,
 
-module_eval <<'.,.,', 'grammar.ra', 832
-  def _reduce_223( val, _values, result )
-    if val[1].instance_of?(AST::ASTHash)
-        result = val[1]
-    else
-        result = ast AST::ASTHash, { :value => val[1] }
-    end
-   result
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 834
-  def _reduce_224( val, _values, result )
-    result = ast AST::ASTHash
-   result
+module_eval(<<'.,.,', 'grammar.ra', 801)
+  def _reduce_223(val, _values, result)
+        if val[1].instance_of?(AST::ASTHash)
+    result = val[1]
+  else
+    result = ast AST::ASTHash, { :value => val[1] }
+  end
+
+    result
   end
 .,.,
 
- # reduce 225 omitted
+module_eval(<<'.,.,', 'grammar.ra', 807)
+  def _reduce_224(val, _values, result)
+      result = ast AST::ASTHash
 
-module_eval <<'.,.,', 'grammar.ra', 844
-  def _reduce_226( val, _values, result )
-    if val[0].instance_of?(AST::ASTHash)
-        result = val[0].merge(val[2])
-    else
-        result = ast AST::ASTHash, :value => val[0]
-        result.merge(val[2])
-    end
-   result
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 848
-  def _reduce_227( val, _values, result )
-    result = ast AST::ASTHash, { :value => { val[0] => val[2] } }
-   result
+# reduce 225 omitted
+
+module_eval(<<'.,.,', 'grammar.ra', 812)
+  def _reduce_226(val, _values, result)
+        if val[0].instance_of?(AST::ASTHash)
+    result = val[0].merge(val[2])
+  else
+    result = ast AST::ASTHash, :value => val[0]
+    result.merge(val[2])
+  end
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 849
-  def _reduce_228( val, _values, result )
- result = val[0][:value]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 821)
+  def _reduce_227(val, _values, result)
+      result = ast AST::ASTHash, { :value => { val[0] => val[2] } }
+
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 850
-  def _reduce_229( val, _values, result )
- result = val[0]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 824)
+  def _reduce_228(val, _values, result)
+     result = val[0][:value] 
+    result
   end
 .,.,
 
-module_eval <<'.,.,', 'grammar.ra', 855
-  def _reduce_230( val, _values, result )
-    result = ast AST::HashOrArrayAccess, :variable => val[0][:value], :key => val[2]
-   result
+module_eval(<<'.,.,', 'grammar.ra', 825)
+  def _reduce_229(val, _values, result)
+     result = val[0] 
+    result
   end
 .,.,
 
- # reduce 231 omitted
+module_eval(<<'.,.,', 'grammar.ra', 828)
+  def _reduce_230(val, _values, result)
+      result = ast AST::HashOrArrayAccess, :variable => val[0][:value], :key => val[2]
 
-module_eval <<'.,.,', 'grammar.ra', 860
-  def _reduce_232( val, _values, result )
-    result = ast AST::HashOrArrayAccess, :variable => val[0], :key => val[2]
-   result
+    result
   end
 .,.,
 
- def _reduce_none( val, _values, result )
-  result
- end
+# reduce 231 omitted
 
-    end   # class Parser
+module_eval(<<'.,.,', 'grammar.ra', 833)
+  def _reduce_232(val, _values, result)
+        result = ast AST::HashOrArrayAccess, :variable => val[0], :key => val[2]
+
+    result
+  end
+.,.,
 
-  end   # module Parser
+def _reduce_none(val, _values, result)
+  val[0]
+end
 
-end   # module Puppet
+    end   # class Parser
+    end   # module Parser
+  end   # module Puppet
diff --git a/lib/puppet/parser/parser_support.rb b/lib/puppet/parser/parser_support.rb
index 97d985c..859897a 100644
--- a/lib/puppet/parser/parser_support.rb
+++ b/lib/puppet/parser/parser_support.rb
@@ -133,26 +133,6 @@ class Puppet::Parser::Parser
     return ns, n
   end
 
-  # Create a new class, or merge with an existing class.
-  def newclass(name, options = {})
-    known_resource_types.add Puppet::Resource::Type.new(:hostclass, name, ast_context(true).merge(options))
-  end
-
-  # Create a new definition.
-  def newdefine(name, options = {})
-    known_resource_types.add Puppet::Resource::Type.new(:definition, name, ast_context(true).merge(options))
-  end
-
-  # Create a new node.  Nodes are special, because they're stored in a global
-  # table, not according to namespaces.
-  def newnode(names, options = {})
-    names = [names] unless names.instance_of?(Array)
-    context = ast_context(true)
-    names.collect do |name|
-      known_resource_types.add(Puppet::Resource::Type.new(:node, name, context.merge(options)))
-    end
-  end
-
   def on_error(token,value,stack)
     if token == 0 # denotes end of file
       value = 'end of file'
@@ -174,42 +154,43 @@ class Puppet::Parser::Parser
 
   # how should I do error handling here?
   def parse(string = nil)
-    return parse_ruby_file if self.file =~ /\.rb$/
-    self.string = string if string
-    begin
-      @yydebug = false
-      main = yyparse(@lexer,:scan)
-    rescue Racc::ParseError => except
-      error = Puppet::ParseError.new(except)
-      error.line = @lexer.line
-      error.file = @lexer.file
-      error.set_backtrace except.backtrace
-      raise error
-    rescue Puppet::ParseError => except
-      except.line ||= @lexer.line
-      except.file ||= @lexer.file
-      raise except
-    rescue Puppet::Error => except
-      # and this is a framework error
-      except.line ||= @lexer.line
-      except.file ||= @lexer.file
-      raise except
-    rescue Puppet::DevError => except
-      except.line ||= @lexer.line
-      except.file ||= @lexer.file
-      raise except
-    rescue => except
-      error = Puppet::DevError.new(except.message)
-      error.line = @lexer.line
-      error.file = @lexer.file
-      error.set_backtrace except.backtrace
-      raise error
-    end
-    if main
-      # Store the results as the top-level class.
-      newclass("", :code => main)
+    if self.file =~ /\.rb$/
+      parse_ruby_file
+      main = nil
+    else
+      self.string = string if string
+      begin
+        @yydebug = false
+        main = yyparse(@lexer,:scan)
+      rescue Racc::ParseError => except
+        error = Puppet::ParseError.new(except)
+        error.line = @lexer.line
+        error.file = @lexer.file
+        error.set_backtrace except.backtrace
+        raise error
+      rescue Puppet::ParseError => except
+        except.line ||= @lexer.line
+        except.file ||= @lexer.file
+        raise except
+      rescue Puppet::Error => except
+        # and this is a framework error
+        except.line ||= @lexer.line
+        except.file ||= @lexer.file
+        raise except
+      rescue Puppet::DevError => except
+        except.line ||= @lexer.line
+        except.file ||= @lexer.file
+        raise except
+      rescue => except
+        error = Puppet::DevError.new(except.message)
+        error.line = @lexer.line
+        error.file = @lexer.file
+        error.set_backtrace except.backtrace
+        raise error
+      end
     end
-    return known_resource_types
+    # Store the results as the top-level class.
+    return Puppet::Parser::AST::Hostclass.new('', :code => main)
   ensure
     @lexer.clear
   end
diff --git a/lib/puppet/parser/type_loader.rb b/lib/puppet/parser/type_loader.rb
index 516c1e3..8a183f4 100644
--- a/lib/puppet/parser/type_loader.rb
+++ b/lib/puppet/parser/type_loader.rb
@@ -47,17 +47,19 @@ class Puppet::Parser::TypeLoader
       raise Puppet::ImportError.new("No file(s) found for import of '#{pat}'")
     end
 
+    loaded_asts = []
     files.each do |file|
       unless file =~ /^#{File::SEPARATOR}/
         file = File.join(dir, file)
       end
       unless imported? file
         @imported[file] = true
-        parse_file(file)
+        loaded_asts << parse_file(file)
       end
     end
-
-    modname
+    loaded_asts.inject([]) do |loaded_types, ast|
+      loaded_types + known_resource_types.import_ast(ast, modname)
+    end
   end
 
   def imported?(file)
@@ -76,23 +78,26 @@ class Puppet::Parser::TypeLoader
     @imported = {}
   end
 
-  # Try to load the object with the given fully qualified name.  For
-  # each file that was actually loaded, yield(filename, modname).
-  def try_load_fqname(fqname)
+  # Try to load the object with the given fully qualified name.
+  def try_load_fqname(type, fqname)
     return nil if fqname == "" # special-case main.
     name2files(fqname).each do |filename|
       if not loaded?(filename)
-        modname = begin
-          import_if_possible(filename)
+        begin
+          imported_types = import_if_possible(filename)
+          if result = imported_types.find { |t| t.type == type and t.name == fqname }
+            Puppet.debug "Automatically imported #{fqname} from #{filename} into #{environment}"
+            return result
+          end
         rescue Puppet::ImportError => detail
           # We couldn't load the item
           # I'm not convienced we should just drop these errors, but this
           # preserves existing behaviours.
-          nil
         end
-        yield(filename, modname)
       end
     end
+    # Nothing found.
+    return nil
   end
 
   def loaded?(name)
@@ -103,7 +108,7 @@ class Puppet::Parser::TypeLoader
     Puppet.debug("importing '#{file}' in environment #{environment}")
     parser = Puppet::Parser::Parser.new(environment)
     parser.file = file
-    parser.parse
+    return parser.parse
   end
 
   # Utility method factored out of load for handling thread-safety.
diff --git a/lib/puppet/resource/type.rb b/lib/puppet/resource/type.rb
index 6296d26..57ccba5 100644
--- a/lib/puppet/resource/type.rb
+++ b/lib/puppet/resource/type.rb
@@ -13,8 +13,8 @@ class Puppet::Resource::Type
 
   RESOURCE_SUPERTYPES = [:hostclass, :node, :definition]
 
-  attr_accessor :file, :line, :doc, :code, :ruby_code, :parent, :resource_type_collection, :module_name
-  attr_reader :type, :namespace, :arguments, :behaves_like
+  attr_accessor :file, :line, :doc, :code, :ruby_code, :parent, :resource_type_collection
+  attr_reader :type, :namespace, :arguments, :behaves_like, :module_name
 
   RESOURCE_SUPERTYPES.each do |t|
     define_method("#{t}?") { self.type == t }
@@ -91,6 +91,8 @@ class Puppet::Resource::Type
     end
 
     set_arguments(options[:arguments])
+
+    @module_name = options[:module_name]
   end
 
   # This is only used for node names, and really only when the node name
diff --git a/lib/puppet/resource/type_collection.rb b/lib/puppet/resource/type_collection.rb
index 4254b03..a969276 100644
--- a/lib/puppet/resource/type_collection.rb
+++ b/lib/puppet/resource/type_collection.rb
@@ -19,6 +19,12 @@ class Puppet::Resource::TypeCollection
     @watched_files = {}
   end
 
+  def import_ast(ast, modname)
+    ast.instantiate(modname).each do |instance|
+      add(instance)
+    end
+  end
+
   def <<(thing)
     add(thing)
     self
@@ -177,16 +183,9 @@ class Puppet::Resource::TypeCollection
   # necessary.
   def find_or_load(namespaces, name, type)
     resolve_namespaces(namespaces, name).each do |fqname|
-      if result = send(type, fqname)
+      if result = send(type, fqname) || loader.try_load_fqname(type, fqname)
         return result
       end
-      loader.try_load_fqname(fqname) do |filename, modname|
-        if result = send(type, fqname)
-          Puppet.debug "Automatically imported #{name} from #{filename} into #{environment}"
-          result.module_name = modname if modname and result.respond_to?(:module_name=)
-          return result
-        end
-      end
     end
 
     # Nothing found.
diff --git a/lib/puppet/util/rdoc/parser.rb b/lib/puppet/util/rdoc/parser.rb
index 63df38a..30da607 100644
--- a/lib/puppet/util/rdoc/parser.rb
+++ b/lib/puppet/util/rdoc/parser.rb
@@ -17,7 +17,7 @@ class Parser
 
   SITE = "__site__"
 
-  attr_accessor :ast, :input_file_name, :top_level
+  attr_accessor :input_file_name, :top_level
 
   # parser registration into RDoc
   parse_files_matching(/\.(rb|pp)$/)
@@ -36,8 +36,12 @@ class Parser
     Puppet.info "rdoc: scanning #{@input_file_name}"
     if @input_file_name =~ /\.pp$/
       @parser = Puppet::Parser::Parser.new(Puppet[:environment])
+      environment = @parser.environment
       @parser.file = @input_file_name
-      @ast = @parser.parse
+      @known_resource_types = environment.known_resource_types
+      @parser.parse.instantiate('').each do |type|
+        @known_resource_types.add type
+      end
     end
     scan_top_level(@top_level)
     @top_level
@@ -334,7 +338,7 @@ class Parser
   # that contains the documentation
   def parse_elements(container)
     Puppet.debug "rdoc: scanning manifest"
-    @ast.hostclasses.values.sort { |a,b| a.name <=> b.name }.each do |klass|
+    @known_resource_types.hostclasses.values.sort { |a,b| a.name <=> b.name }.each do |klass|
       name = klass.name
       if klass.file == @input_file_name
         unless name.empty?
@@ -347,13 +351,13 @@ class Parser
       end
     end
 
-    @ast.definitions.each do |name, define|
+    @known_resource_types.definitions.each do |name, define|
       if define.file == @input_file_name
         document_define(name,define,container)
       end
     end
 
-    @ast.nodes.each do |name, node|
+    @known_resource_types.nodes.each do |name, node|
       if node.file == @input_file_name
         document_node(name.to_s,node,container)
       end
diff --git a/spec/integration/parser/collector_spec.rb b/spec/integration/parser/collector_spec.rb
index 73273c9..b1cfc51 100755
--- a/spec/integration/parser/collector_spec.rb
+++ b/spec/integration/parser/collector_spec.rb
@@ -17,7 +17,7 @@ describe Puppet::Parser::Collector do
   def query(text)
     code = "File <| #{text} |>"
     parser = Puppet::Parser::Parser.new(@scope.compiler)
-    parser.parse(code).hostclass("").code[0].query
+    return parser.parse(code).code[0].query
   end
 
   {true => [%{title == "/tmp/testing"}, %{(title == "/tmp/testing")}, %{group == bin},
diff --git a/spec/integration/parser/compiler_spec.rb b/spec/integration/parser/compiler_spec.rb
index 67e8e5e..266347c 100755
--- a/spec/integration/parser/compiler_spec.rb
+++ b/spec/integration/parser/compiler_spec.rb
@@ -80,4 +80,15 @@ describe Puppet::Parser::Compiler do
     Puppet::Resource::TypeCollection.any_instance.stubs(:stale?).returns(true).then.returns(false) # pretend change
     Puppet::Parser::Compiler.compile(node).version.should == 2
   end
+
+  it "should not allow classes inside conditional constructs" do
+    Puppet[:code] = <<-PP
+      if true {
+        class foo {
+        }
+      }
+    PP
+
+    lambda { Puppet::Parser::Compiler.compile(Puppet::Node.new("mynode")) }.should raise_error(Puppet::Error)
+  end
 end
diff --git a/spec/integration/parser/parser_spec.rb b/spec/integration/parser/parser_spec.rb
index 7b85bca..0d9aa51 100755
--- a/spec/integration/parser/parser_spec.rb
+++ b/spec/integration/parser/parser_spec.rb
@@ -11,7 +11,7 @@ describe Puppet::Parser::Parser do
       end
 
       def result_instance
-        @result.hostclass("").code[0]
+        @result.code[0]
       end
 
       def matches?(string)
@@ -44,7 +44,7 @@ describe Puppet::Parser::Parser do
       end
 
       def result_instance
-        @result.hostclass("").code[0]
+        @result.code[0]
       end
 
       def matches?(string)
@@ -85,7 +85,9 @@ describe Puppet::Parser::Parser do
       class test {}
       """)
 
-      ast.hostclass("test").doc.should == "comment\n"
+      ast.code[0].should be_a(Puppet::Parser::AST::Hostclass)
+      ast.code[0].name.should == 'test'
+      ast.code[0].instantiate('')[0].doc.should == "comment\n"
     end
   end
 
diff --git a/spec/unit/dsl/resource_type_api_spec.rb b/spec/unit/dsl/resource_type_api_spec.rb
index 5abe79e..4b8ccf5 100755
--- a/spec/unit/dsl/resource_type_api_spec.rb
+++ b/spec/unit/dsl/resource_type_api_spec.rb
@@ -16,22 +16,20 @@ describe Puppet::DSL::ResourceTypeAPI do
   [:definition, :node, :hostclass].each do |type|
     method = type == :definition ? "define" : type
     it "should be able to create a #{type}" do
-      newtype = Puppet::Resource::Type.new(:hostclass, "foo")
-      Puppet::Resource::Type.expects(:new).with { |t, n, args| t == type }.returns newtype
-      @api.send(method, "myname")
+      newtype = @api.send(method, "myname")
+      newtype.should be_a(Puppet::Resource::Type)
+      newtype.type.should == type
     end
 
     it "should use the provided name when creating a #{type}" do
-      type = Puppet::Resource::Type.new(:hostclass, "foo")
-      Puppet::Resource::Type.expects(:new).with { |t, n, args| n == "myname" }.returns type
-      @api.send(method, "myname")
+      newtype = @api.send(method, "myname")
+      newtype.name.should == "myname"
     end
 
     unless type == :definition
-      it "should pass in any provided options" do
-        type = Puppet::Resource::Type.new(:hostclass, "foo")
-        Puppet::Resource::Type.expects(:new).with { |t, n, args| args == {:myarg => :myvalue} }.returns type
-        @api.send(method, "myname", :myarg => :myvalue)
+      it "should pass in any provided options when creating a #{type}" do
+        newtype = @api.send(method, "myname", :line => 200)
+        newtype.line.should == 200
       end
     end
 
diff --git a/spec/unit/node/environment_spec.rb b/spec/unit/node/environment_spec.rb
index e495d30..be29808 100755
--- a/spec/unit/node/environment_spec.rb
+++ b/spec/unit/node/environment_spec.rb
@@ -52,7 +52,7 @@ describe Puppet::Node::Environment do
     before do
       @env = Puppet::Node::Environment.new("dev")
       @collection = Puppet::Resource::TypeCollection.new(@env)
-      @env.stubs(:perform_initial_import)
+      @env.stubs(:perform_initial_import).returns(Puppet::Parser::AST::Hostclass.new(''))
       Thread.current[:known_resource_types] = nil
     end
 
@@ -67,7 +67,7 @@ describe Puppet::Node::Environment do
 
     it "should perform the initial import when creating a new collection" do
       @env = Puppet::Node::Environment.new("dev")
-      @env.expects(:perform_initial_import)
+      @env.expects(:perform_initial_import).returns(Puppet::Parser::AST::Hostclass.new(''))
       @env.known_resource_types
     end
 
diff --git a/spec/unit/parser/ast/definition_spec.rb b/spec/unit/parser/ast/definition_spec.rb
new file mode 100644
index 0000000..01ca068
--- /dev/null
+++ b/spec/unit/parser/ast/definition_spec.rb
@@ -0,0 +1,17 @@
+#!/usr/bin/env ruby
+
+require File.dirname(__FILE__) + '/../../../spec_helper'
+
+describe Puppet::Parser::AST::Definition do
+  describe "when instantiated" do
+    it "should create a definition with the proper type, name, context, and module name" do
+      definition = Puppet::Parser::AST::Definition.new('foo', :line => 5)
+      instantiated_definitions = definition.instantiate('modname')
+      instantiated_definitions.length.should == 1
+      instantiated_definitions[0].type.should == :definition
+      instantiated_definitions[0].name.should == 'foo'
+      instantiated_definitions[0].line.should == 5
+      instantiated_definitions[0].module_name.should == 'modname'
+    end
+  end
+end
diff --git a/spec/unit/parser/ast/hostclass_spec.rb b/spec/unit/parser/ast/hostclass_spec.rb
new file mode 100644
index 0000000..b22eba9
--- /dev/null
+++ b/spec/unit/parser/ast/hostclass_spec.rb
@@ -0,0 +1,73 @@
+#!/usr/bin/env ruby
+
+require File.dirname(__FILE__) + '/../../../spec_helper'
+
+describe Puppet::Parser::AST::Hostclass do
+  def ast
+    Puppet::Parser::AST
+  end
+
+  def newarray(*elems)
+    ast::ASTArray.new({}).push(*elems)
+  end
+
+  it "should make its name and context available through accessors" do
+    hostclass = ast::Hostclass.new('foo', :line => 5)
+    hostclass.name.should == 'foo'
+    hostclass.context.should == {:line => 5}
+  end
+
+  it "should make its code available through an accessor" do
+    code = newarray
+    hostclass = ast::Hostclass.new('foo', :code => code)
+    hostclass.code.should be_equal(code)
+  end
+
+  describe "when instantiated" do
+    it "should create a class with the proper type, code, name, context, and module name" do
+      code = newarray
+      hostclass = ast::Hostclass.new('foo', :code => code, :line => 5)
+      instantiated_class = hostclass.instantiate('modname')[0]
+      instantiated_class.type.should == :hostclass
+      instantiated_class.name.should == 'foo'
+      instantiated_class.code.should be_equal(code)
+      instantiated_class.line.should == 5
+      instantiated_class.module_name.should == 'modname'
+    end
+
+    it "should instantiate all nested classes, defines, and nodes with the same module name." do
+      nested_objects = newarray(ast::Hostclass.new('foo::child1'),
+                                ast::Definition.new('foo::child2'),
+                                ast::Definition.new('child3'))
+      hostclass = ast::Hostclass.new('foo', :code => nested_objects)
+      instantiated_classes = hostclass.instantiate('modname')
+      instantiated_classes.length.should == 4
+      instantiated_classes[0].name.should == 'foo'
+      instantiated_classes[1].name.should == 'foo::child1'
+      instantiated_classes[2].name.should == 'foo::child2'
+      instantiated_classes[3].name.should == 'child3'
+      instantiated_classes.each { |cls| cls.module_name.should == 'modname' }
+    end
+
+    it "should handle a nested class that contains its own nested classes." do
+      foo_bar_baz = ast::Hostclass.new('foo::bar::baz')
+      foo_bar = ast::Hostclass.new('foo::bar', :code => newarray(foo_bar_baz))
+      foo = ast::Hostclass.new('foo', :code => newarray(foo_bar))
+      instantiated_classes = foo.instantiate('')
+      instantiated_classes.length.should == 3
+      instantiated_classes[0].name.should == 'foo'
+      instantiated_classes[1].name.should == 'foo::bar'
+      instantiated_classes[2].name.should == 'foo::bar::baz'
+    end
+
+    it "should skip nested elements that are not classes, definitions, or nodes." do
+      func = ast::Function.new(:name => 'biz', :arguments => newarray(ast::Name.new(:value => 'baz')))
+      foo = ast::Hostclass.new('foo', :code => newarray(func))
+      instantiated_classes = foo.instantiate('')
+      instantiated_classes.length.should == 1
+      instantiated_classes[0].should be_a(Puppet::Resource::Type)
+      instantiated_classes[0].name.should == 'foo'
+    end
+  end
+end
+
diff --git a/spec/unit/parser/ast/node_spec.rb b/spec/unit/parser/ast/node_spec.rb
new file mode 100644
index 0000000..409e877
--- /dev/null
+++ b/spec/unit/parser/ast/node_spec.rb
@@ -0,0 +1,30 @@
+#!/usr/bin/env ruby
+
+require File.dirname(__FILE__) + '/../../../spec_helper'
+
+describe Puppet::Parser::AST::Node do
+  describe "when instantiated" do
+    it "should make its names available through an accessor" do
+      node = Puppet::Parser::AST::Node.new(['foo', 'bar'])
+      node.names.should == ['foo', 'bar']
+    end
+
+    it "should create a node with the proper type, name, context, and module name" do
+      node = Puppet::Parser::AST::Node.new(['foo'], :line => 5)
+      instantiated_nodes = node.instantiate('modname')
+      instantiated_nodes.length.should == 1
+      instantiated_nodes[0].type.should == :node
+      instantiated_nodes[0].name.should == 'foo'
+      instantiated_nodes[0].line.should == 5
+      instantiated_nodes[0].module_name.should == 'modname'
+    end
+
+    it "should handle multiple names" do
+      node = Puppet::Parser::AST::Node.new(['foo', 'bar'])
+      instantiated_nodes = node.instantiate('modname')
+      instantiated_nodes.length.should == 2
+      instantiated_nodes[0].name.should == 'foo'
+      instantiated_nodes[1].name.should == 'bar'
+    end
+  end
+end
diff --git a/spec/unit/parser/ast/resource_spec.rb b/spec/unit/parser/ast/resource_spec.rb
index 58ffae9..4e5549b 100755
--- a/spec/unit/parser/ast/resource_spec.rb
+++ b/spec/unit/parser/ast/resource_spec.rb
@@ -89,9 +89,9 @@ describe Puppet::Parser::AST::Resource do
     before do
       @scope = Puppet::Parser::Scope.new :compiler => Puppet::Parser::Compiler.new(Puppet::Node.new("mynode"))
       @parser = Puppet::Parser::Parser.new(Puppet::Node::Environment.new)
-      @parser.newdefine "one"
-      @parser.newdefine "one::two"
-      @parser.newdefine "three"
+      ["one", "one::two", "three"].each do |name|
+        @parser.environment.known_resource_types.add(Puppet::Resource::Type.new(:definition, name, {}))
+      end
       @twoscope = @scope.newscope(:namespace => "one")
       @twoscope.resource = @scope.resource
     end
diff --git a/spec/unit/parser/parser_spec.rb b/spec/unit/parser/parser_spec.rb
index 0657ab3..0a61e73 100755
--- a/spec/unit/parser/parser_spec.rb
+++ b/spec/unit/parser/parser_spec.rb
@@ -73,14 +73,16 @@ describe Puppet::Parser do
       lambda { @parser.parse("$var += ") }.should raise_error
     end
 
-    it "should call ast::VarDef with append=true" do
-      ast::VarDef.expects(:new).with { |h| h[:append] == true }
-      @parser.parse("$var += 2")
+    it "should create ast::VarDef with append=true" do
+      vardef = @parser.parse("$var += 2").code[0]
+      vardef.should be_a(Puppet::Parser::AST::VarDef)
+      vardef.append.should == true
     end
 
     it "should work with arrays too" do
-      ast::VarDef.expects(:new).with { |h| h[:append] == true }
-      @parser.parse("$var += ['test']")
+      vardef = @parser.parse("$var += ['test']").code[0]
+      vardef.should be_a(Puppet::Parser::AST::VarDef)
+      vardef.append.should == true
     end
 
   end
@@ -160,10 +162,14 @@ describe Puppet::Parser do
     end
 
     it "should create an ast::ResourceOverride" do
-      ast::ResourceOverride.expects(:new).with { |arg|
-        arg[:line]==1 and arg[:object].is_a?(ast::ResourceReference) and arg[:parameters].is_a?(ast::ResourceParam)
-      }
-      @parser.parse('Resource["title1","title2"] { param => value }')
+      #ast::ResourceOverride.expects(:new).with { |arg|
+      #  arg[:line]==1 and arg[:object].is_a?(ast::ResourceReference) and arg[:parameters].is_a?(ast::ResourceParam)
+      #}
+      ro = @parser.parse('Resource["title1","title2"] { param => value }').code[0]
+      ro.should be_a(ast::ResourceOverride)
+      ro.line.should == 1
+      ro.object.should be_a(ast::ResourceReference)
+      ro.parameters[0].should be_a(ast::ResourceParam)
     end
 
   end
@@ -290,24 +296,6 @@ describe Puppet::Parser do
     end
   end
 
-  describe "when creating a node" do
-    before :each do
-      @lexer = stub 'lexer'
-      @lexer.stubs(:getcomment)
-      @parser.stubs(:lexer).returns(@lexer)
-      @node = stub_everything 'node'
-      @parser.stubs(:ast_context).returns({})
-      @parser.stubs(:node).returns(nil)
-
-      @nodename = stub 'nodename', :is_a? => false, :value => "foo"
-      @nodename.stubs(:is_a?).with(Puppet::Parser::AST::HostName).returns(true)
-    end
-
-    it "should return an array of nodes" do
-      @parser.newnode(@nodename).should be_instance_of(Array)
-    end
-  end
-
   describe "when retrieving a specific node" do
     it "should delegate to the known_resource_types node" do
       @known_resource_types.expects(:node).with("node")
@@ -360,30 +348,28 @@ describe Puppet::Parser do
       @parser.stubs(:known_resource_types).returns @krt
     end
 
-    it "should create new classes" do
-      @parser.parse("class foobar {}")
-      @krt.hostclass("foobar").should be_instance_of(Puppet::Resource::Type)
+    it "should not create new classes" do
+      @parser.parse("class foobar {}").code[0].should be_a(Puppet::Parser::AST::Hostclass)
+      @krt.hostclass("foobar").should be_nil
     end
 
     it "should correctly set the parent class when one is provided" do
-      @parser.parse("class foobar inherits yayness {}")
-      @krt.hostclass("foobar").parent.should == "yayness"
+      @parser.parse("class foobar inherits yayness {}").code[0].instantiate('')[0].parent.should == "yayness"
     end
 
     it "should correctly set the parent class for multiple classes at a time" do
-      @parser.parse("class foobar inherits yayness {}\nclass boo inherits bar {}")
-      @krt.hostclass("foobar").parent.should == "yayness"
-      @krt.hostclass("boo").parent.should == "bar"
+      statements = @parser.parse("class foobar inherits yayness {}\nclass boo inherits bar {}").code
+      statements[0].instantiate('')[0].parent.should == "yayness"
+      statements[1].instantiate('')[0].parent.should == "bar"
     end
 
     it "should define the code when some is provided" do
-      @parser.parse("class foobar { $var = val }")
-      @krt.hostclass("foobar").code.should_not be_nil
+      @parser.parse("class foobar { $var = val }").code[0].code.should_not be_nil
     end
 
     it "should define parameters when provided" do
-      @parser.parse("class foobar($biz,$baz) {}")
-      @krt.hostclass("foobar").arguments.should == {"biz" => nil, "baz" => nil}
+      foobar = @parser.parse("class foobar($biz,$baz) {}").code[0].instantiate('')[0]
+      foobar.arguments.should == {"biz" => nil, "baz" => nil}
     end
   end
 
@@ -400,13 +386,37 @@ describe Puppet::Parser do
     end
 
     it "should correctly mark exported resources as exported" do
-      @parser.parse("@@file { '/file': }")
-      @krt.hostclass("").code[0].exported.should be_true
+      @parser.parse("@@file { '/file': }").code[0][0].exported.should be_true
     end
 
     it "should correctly mark virtual resources as virtual" do
-      @parser.parse("@file { '/file': }")
-      @krt.hostclass("").code[0].virtual.should be_true
+      @parser.parse("@file { '/file': }").code[0][0].virtual.should be_true
+    end
+  end
+
+  describe "when parsing nodes" do
+    it "should be able to parse a node with a single name" do
+      node = @parser.parse("node foo { }").code[0]
+      node.should be_a Puppet::Parser::AST::Node
+      node.names.length.should == 1
+      node.names[0].value.should == "foo"
+    end
+
+    it "should be able to parse a node with two names" do
+      node = @parser.parse("node foo, bar { }").code[0]
+      node.should be_a Puppet::Parser::AST::Node
+      node.names.length.should == 2
+      node.names[0].value.should == "foo"
+      node.names[1].value.should == "bar"
+    end
+
+    it "should be able to parse a node with three names" do
+      node = @parser.parse("node foo, bar, baz { }").code[0]
+      node.should be_a Puppet::Parser::AST::Node
+      node.names.length.should == 3
+      node.names[0].value.should == "foo"
+      node.names[1].value.should == "bar"
+      node.names[2].value.should == "baz"
     end
   end
 end
diff --git a/spec/unit/parser/scope_spec.rb b/spec/unit/parser/scope_spec.rb
index 9895f44..2e390a5 100755
--- a/spec/unit/parser/scope_spec.rb
+++ b/spec/unit/parser/scope_spec.rb
@@ -29,8 +29,7 @@ describe Puppet::Parser::Scope do
   end
 
   it "should be able to retrieve its parent module name from the source of its parent type" do
-    @topscope.source = Puppet::Resource::Type.new(:hostclass, :foo)
-    @topscope.source.module_name = "foo"
+    @topscope.source = Puppet::Resource::Type.new(:hostclass, :foo, :module_name => "foo")
 
     @scope.parent_module_name.should == "foo"
   end
diff --git a/spec/unit/parser/type_loader_spec.rb b/spec/unit/parser/type_loader_spec.rb
index b7e1747..b062516 100644
--- a/spec/unit/parser/type_loader_spec.rb
+++ b/spec/unit/parser/type_loader_spec.rb
@@ -28,26 +28,18 @@ describe Puppet::Parser::TypeLoader do
   describe "when loading names from namespaces" do
     it "should do nothing if the name to import is an empty string" do
       @loader.expects(:name2files).never
-      @loader.try_load_fqname("") { |filename, modname| raise :should_not_occur }.should be_nil
+      @loader.try_load_fqname(:hostclass, "") { |filename, modname| raise :should_not_occur }.should be_nil
     end
 
     it "should attempt to import each generated name" do
-      @loader.expects(:import).with("foo/bar",nil)
-      @loader.expects(:import).with("foo",nil)
-      @loader.try_load_fqname("foo::bar") { |f| false }
-    end
-
-    it "should yield after each import" do
-      yielded = []
-      @loader.expects(:import).with("foo/bar",nil)
-      @loader.expects(:import).with("foo",nil)
-      @loader.try_load_fqname("foo::bar") { |filename, modname| yielded << [filename, modname]; false }
-      yielded.should == [["foo/bar", nil], ["foo", nil]]
+      @loader.expects(:import).with("foo/bar",nil).returns([])
+      @loader.expects(:import).with("foo",nil).returns([])
+      @loader.try_load_fqname(:hostclass, "foo::bar") { |f| false }
     end
 
     it "should know when a given name has been loaded" do
-      @loader.expects(:import).with("file",nil)
-      @loader.try_load_fqname("file") { |f| true }
+      @loader.expects(:import).with("file",nil).returns([])
+      @loader.try_load_fqname(:hostclass, "file") { |f| true }
       @loader.should be_loaded("file")
     end
   end
@@ -55,7 +47,7 @@ describe Puppet::Parser::TypeLoader do
   describe "when importing" do
     before do
       Puppet::Parser::Files.stubs(:find_manifests).returns ["modname", %w{file}]
-      @loader.stubs(:parse_file)
+      @loader.stubs(:parse_file).returns(Puppet::Parser::AST::Hostclass.new(''))
     end
 
     it "should return immediately when imports are being ignored" do
@@ -86,13 +78,13 @@ describe Puppet::Parser::TypeLoader do
 
     it "should parse each found file" do
       Puppet::Parser::Files.expects(:find_manifests).returns ["modname", %w{/one}]
-      @loader.expects(:parse_file).with("/one")
+      @loader.expects(:parse_file).with("/one").returns(Puppet::Parser::AST::Hostclass.new(''))
       @loader.import("myfile")
     end
 
     it "should make each file qualified before attempting to parse it" do
       Puppet::Parser::Files.expects(:find_manifests).returns ["modname", %w{one}]
-      @loader.expects(:parse_file).with("/current/one")
+      @loader.expects(:parse_file).with("/current/one").returns(Puppet::Parser::AST::Hostclass.new(''))
       @loader.import("myfile", "/current/file")
     end
 
@@ -105,7 +97,7 @@ describe Puppet::Parser::TypeLoader do
 
     it "should not attempt to import files that have already been imported" do
       Puppet::Parser::Files.expects(:find_manifests).returns ["modname", %w{/one}]
-      @loader.expects(:parse_file).once
+      @loader.expects(:parse_file).once.returns(Puppet::Parser::AST::Hostclass.new(''))
       @loader.import("myfile")
 
       # This will fail if it tries to reimport the file.
@@ -116,7 +108,7 @@ describe Puppet::Parser::TypeLoader do
   describe "when parsing a file" do
     before do
       @parser = Puppet::Parser::Parser.new(@loader.environment)
-      @parser.stubs(:parse)
+      @parser.stubs(:parse).returns(Puppet::Parser::AST::Hostclass.new(''))
       @parser.stubs(:file=)
       Puppet::Parser::Parser.stubs(:new).with(@loader.environment).returns @parser
     end
@@ -128,7 +120,7 @@ describe Puppet::Parser::TypeLoader do
 
     it "should assign the parser its file and parse" do
       @parser.expects(:file=).with("/my/file")
-      @parser.expects(:parse)
+      @parser.expects(:parse).returns(Puppet::Parser::AST::Hostclass.new(''))
       @loader.parse_file("/my/file")
     end
   end
diff --git a/spec/unit/resource/type_collection_spec.rb b/spec/unit/resource/type_collection_spec.rb
index fc53e35..b8da3cf 100644
--- a/spec/unit/resource/type_collection_spec.rb
+++ b/spec/unit/resource/type_collection_spec.rb
@@ -135,21 +135,21 @@ describe Puppet::Resource::TypeCollection do
 
     describe "that need to be loaded" do
       it "should use the loader to load the files" do
-        @code.loader.expects(:try_load_fqname).with("ns::klass")
-        @code.loader.expects(:try_load_fqname).with("klass")
+        @code.loader.expects(:try_load_fqname).with(:hostclass, "ns::klass")
+        @code.loader.expects(:try_load_fqname).with(:hostclass, "klass")
         @code.find_hostclass(["ns"], "klass")
       end
 
       it "should downcase the name and downcase and array-fy the namespaces before passing to the loader" do
-        @code.loader.expects(:try_load_fqname).with("ns::klass")
-        @code.loader.expects(:try_load_fqname).with("klass")
+        @code.loader.expects(:try_load_fqname).with(:hostclass, "ns::klass")
+        @code.loader.expects(:try_load_fqname).with(:hostclass, "klass")
         @code.find_hostclass("Ns", "Klass")
       end
 
-      it "should attempt to find the type when the loader yields" do
-        @code.loader.expects(:try_load_fqname).yields
-        @code.expects(:hostclass).with("ns::klass").times(2).returns(false).then.returns(true)
-        @code.find_hostclass("ns", "klass")
+      it "should use the class returned by the loader" do
+        @code.loader.expects(:try_load_fqname).returns(:klass)
+        @code.expects(:hostclass).with("ns::klass").returns(false)
+        @code.find_hostclass("ns", "klass").should == :klass
       end
 
       it "should return nil if the name isn't found" do
@@ -159,8 +159,8 @@ describe Puppet::Resource::TypeCollection do
 
       it "already-loaded names at broader scopes should not shadow autoloaded names" do
         @code.add Puppet::Resource::Type.new(:hostclass, "bar")
-        @code.loader.expects(:try_load_fqname).with("foo::bar")
-        @code.find_hostclass("foo", "bar")
+        @code.loader.expects(:try_load_fqname).with(:hostclass, "foo::bar").returns(:foobar)
+        @code.find_hostclass("foo", "bar").should == :foobar
       end
     end
   end
diff --git a/spec/unit/resource/type_spec.rb b/spec/unit/resource/type_spec.rb
index ac9d381..29c13c5 100755
--- a/spec/unit/resource/type_spec.rb
+++ b/spec/unit/resource/type_spec.rb
@@ -322,7 +322,7 @@ describe Puppet::Resource::Type do
     end
 
     it "should set its module name in the scope if available" do
-      @type.module_name = "mymod"
+      @type.instance_eval { @module_name = "mymod" }
 
       @type.set_resource_parameters(@resource, @scope)
 
diff --git a/spec/unit/util/rdoc/parser_spec.rb b/spec/unit/util/rdoc/parser_spec.rb
index 79195e6..5dc083c 100755
--- a/spec/unit/util/rdoc/parser_spec.rb
+++ b/spec/unit/util/rdoc/parser_spec.rb
@@ -16,12 +16,17 @@ describe RDoc::Parser do
   end
 
   describe "when scanning files" do
+    before do
+      @environment = Puppet::Node::Environment.new("foo")
+    end
+
     it "should parse puppet files with the puppet parser" do
       @parser.stubs(:scan_top_level)
       parser = stub 'parser'
-      Puppet::Parser::Parser.expects(:new).returns(parser)
-      parser.expects(:parse)
+      Puppet::Parser::Parser.stubs(:new).returns(parser)
+      parser.expects(:parse).returns(Puppet::Parser::AST::Hostclass.new(''))
       parser.expects(:file=).with("module/manifests/init.pp")
+      parser.expects(:environment).returns(@environment)
 
       @parser.scan
     end
@@ -29,6 +34,8 @@ describe RDoc::Parser do
     it "should scan the ast for Puppet files" do
       parser = stub_everything 'parser'
       Puppet::Parser::Parser.stubs(:new).returns(parser)
+      parser.expects(:environment).returns(@environment)
+      parser.expects(:parse).returns(Puppet::Parser::AST::Hostclass.new(''))
 
       @parser.expects(:scan_top_level)
 
@@ -38,6 +45,8 @@ describe RDoc::Parser do
     it "should return a PuppetTopLevel to RDoc" do
       parser = stub_everything 'parser'
       Puppet::Parser::Parser.stubs(:new).returns(parser)
+      parser.expects(:environment).returns(@environment)
+      parser.expects(:parse).returns(Puppet::Parser::AST::Hostclass.new(''))
 
       @parser.expects(:scan_top_level)
 
@@ -47,8 +56,8 @@ describe RDoc::Parser do
 
   describe "when scanning top level entities" do
     before :each do
-      @resource_type_collection = stub_everything 'resource_type_collection'
-      @parser.ast = @resource_type_collection
+      @resource_type_collection = resource_type_collection = stub_everything('resource_type_collection')
+      @parser.instance_eval { @known_resource_types = resource_type_collection }
       @parser.stubs(:split_module).returns("module")
 
       @topcontainer = stub_everything 'topcontainer'
@@ -141,8 +150,8 @@ describe RDoc::Parser do
       @definition = stub_everything 'definition', :file => "module/manifests/init.pp", :type => :definition, :name => "mydef"
       @node = stub_everything 'node', :file => "module/manifests/init.pp", :type => :node, :name => "mynode"
 
-      @resource_type_collection = Puppet::Resource::TypeCollection.new("env")
-      @parser.ast = @resource_type_collection
+      @resource_type_collection = resource_type_collection = Puppet::Resource::TypeCollection.new("env")
+      @parser.instance_eval { @known_resource_types = resource_type_collection }
 
       @container = stub_everything 'container'
     end
diff --git a/test/language/functions.rb b/test/language/functions.rb
index 1d4ed82..081063e 100755
--- a/test/language/functions.rb
+++ b/test/language/functions.rb
@@ -451,7 +451,7 @@ class TestLangFunctions < Test::Unit::TestCase
       scope.function_include("nosuchclass")
     end
 
-    parser.newclass("myclass")
+    scope.known_resource_types.add Puppet::Resource::Type.new(:hostclass, "myclass", {})
 
     scope.compiler.expects(:evaluate_classes).with(%w{myclass otherclass}, scope, false).returns(%w{myclass otherclass})
 
diff --git a/test/language/parser.rb b/test/language/parser.rb
index 5a433c7..330dacb 100755
--- a/test/language/parser.rb
+++ b/test/language/parser.rb
@@ -39,9 +39,8 @@ class TestParser < Test::Unit::TestCase
     failers { |file|
       parser = mkparser
       Puppet.debug("parsing failer #{file}") if __FILE__ == $0
-      assert_raise(Puppet::ParseError, "Did not fail while parsing #{file}") {
-        parser.file = file
-        ast = parser.parse
+      assert_raise(Puppet::ParseError, Puppet::Error, "Did not fail while parsing #{file}") {
+        Puppet[:manifest] = file
         config = mkcompiler(parser)
         config.compile
         #ast.hostclass("").evaluate config.topscope
@@ -288,7 +287,7 @@ class TestParser < Test::Unit::TestCase
       ret = parser.parse
     }
 
-    ret.hostclass("").code.each do |obj|
+    ret.code.each do |obj|
       assert_instance_of(AST::Collection, obj)
     end
   end
@@ -362,12 +361,12 @@ file { "/tmp/yayness":
 
 
     assert_raise(Puppet::ParseError) {
-      parser.parse %{define mydef($schedule) {}}
+      parser.known_resource_types.import_ast(parser.parse(%{define mydef($schedule) {}}), '')
     }
 
     assert_nothing_raised {
-      parser.parse %{define adef($schedule = false) {}}
-      parser.parse %{define mydef($schedule = daily) {}}
+      parser.known_resource_types.import_ast(parser.parse(%{define adef($schedule = false) {}}), '')
+      parser.known_resource_types.import_ast(parser.parse(%{define mydef($schedule = daily) {}}), '')
     }
   end
 
@@ -379,12 +378,12 @@ file { "/tmp/yayness":
     str1 = %{if true { #{exec.call("true")} }}
     ret = nil
     assert_nothing_raised {
-      ret = parser.parse(str1).hostclass("").code[0]
+      ret = parser.parse(str1).code[0]
     }
     assert_instance_of(Puppet::Parser::AST::IfStatement, ret)
     parser = mkparser
     str2 = %{if true { #{exec.call("true")} } else { #{exec.call("false")} }}
-    ret = parser.parse(str2).hostclass("").code[0]
+    ret = parser.parse(str2).code[0]
     assert_instance_of(Puppet::Parser::AST::IfStatement, ret)
     assert_instance_of(Puppet::Parser::AST::Else, ret.else)
   end
@@ -393,23 +392,23 @@ file { "/tmp/yayness":
     parser = mkparser
 
     assert_nothing_raised {
-      parser.parse %{class myclass { class other {} }}
+      parser.known_resource_types.import_ast(parser.parse(%{class myclass { class other {} }}), '')
     }
     assert(parser.hostclass("myclass"), "Could not find myclass")
     assert(parser.hostclass("myclass::other"), "Could not find myclass::other")
 
     assert_nothing_raised {
-      parser.parse "class base {}
+      parser.known_resource_types.import_ast(parser.parse("class base {}
       class container {
         class deep::sub inherits base {}
-      }"
+      }"), '')
     }
     sub = parser.hostclass("container::deep::sub")
     assert(sub, "Could not find sub")
 
     # Now try it with a parent class being a fq class
     assert_nothing_raised {
-      parser.parse "class container::one inherits container::deep::sub {}"
+      parser.known_resource_types.import_ast(parser.parse("class container::one inherits container::deep::sub {}"), '')
     }
     sub = parser.hostclass("container::one")
     assert(sub, "Could not find one")
@@ -417,7 +416,7 @@ file { "/tmp/yayness":
 
     # Finally, try including a qualified class
     assert_nothing_raised("Could not include fully qualified class") {
-      parser.parse "include container::deep::sub"
+      parser.known_resource_types.import_ast(parser.parse("include container::deep::sub"), '')
     }
   end
 
@@ -426,20 +425,11 @@ file { "/tmp/yayness":
 
     # Make sure we put the top-level code into a class called "" in
     # the "" namespace
-    assert_nothing_raised do
-      out = parser.parse ""
-
-      assert_instance_of(Puppet::Resource::TypeCollection, out)
-      assert_nil(parser.hostclass(""), "Got a 'main' class when we had no code")
-    end
-
-    # Now try something a touch more complicated
     parser.initvars
     assert_nothing_raised do
-      out = parser.parse "Exec { path => '/usr/bin:/usr/sbin' }"
-      assert_instance_of(Puppet::Resource::TypeCollection, out)
-      assert_equal("", parser.hostclass("").name)
-      assert_equal("", parser.hostclass("").namespace)
+      parser.known_resource_types.import_ast(parser.parse("Exec { path => '/usr/bin:/usr/sbin' }"), '')
+      assert_equal("", parser.known_resource_types.hostclass("").name)
+      assert_equal("", parser.known_resource_types.hostclass("").namespace)
     end
   end
 
@@ -482,11 +472,12 @@ file { "/tmp/yayness":
 
       ret = nil
       assert_nothing_raised do
-        ret = parser.parse("#{at}file { '/tmp/testing': owner => root }")
+        parser.known_resource_types.import_ast(parser.parse("#{at}file { '/tmp/testing': owner => root }"), '')
+        ret = parser.known_resource_types
       end
 
       assert_instance_of(AST::ASTArray, ret.hostclass("").code)
-      resdef = ret.hostclass("").code[0]
+      resdef = ret.hostclass("").code[0][0]
       assert_instance_of(AST::Resource, resdef)
       assert_equal("/tmp/testing", resdef.title.value)
       # We always get an astarray back, so...
@@ -494,10 +485,11 @@ file { "/tmp/yayness":
 
       # Now let's try it with multiple resources in the same spec
       assert_nothing_raised do
-        ret = parser.parse("#{at}file { ['/tmp/1', '/tmp/2']: owner => root }")
+        parser.known_resource_types.import_ast(parser.parse("#{at}file { ['/tmp/1', '/tmp/2']: owner => root }"), '')
+        ret = parser.known_resource_types
       end
 
-      ret.hostclass("").code.each do |res|
+      ret.hostclass("").code[0].each do |res|
         assert_instance_of(AST::Resource, res)
         check.call(res, "multiresource")
       end
@@ -537,7 +529,7 @@ file { "/tmp/yayness":
         ret = parser.parse("File #{arrow}")
       end
 
-      coll = ret.hostclass("").code[0]
+      coll = ret.code[0]
       assert_instance_of(AST::Collection, coll)
       assert_equal(form, coll.form)
     end
@@ -560,7 +552,7 @@ file { "/tmp/yayness":
 
       res = nil
       assert_nothing_raised do
-        res = parser.parse(str).hostclass("").code[0]
+        res = parser.parse(str).code[0]
       end
 
       assert_instance_of(AST::Collection, res)
@@ -583,7 +575,7 @@ file { "/tmp/yayness":
 
       res = nil
       assert_nothing_raised do
-        res = parser.parse(str).hostclass("").code[0]
+        res = parser.parse(str).code[0]
       end
 
       assert_instance_of(AST::Collection, res)
@@ -607,7 +599,7 @@ file { "/tmp/yayness":
 
       res = nil
       assert_nothing_raised("Could not parse '#{test}'") do
-        res = parser.parse(str).hostclass("").code[0]
+        res = parser.parse(str).code[0]
       end
 
       assert_instance_of(AST::Collection, res)
@@ -624,15 +616,11 @@ file { "/tmp/yayness":
   def test_fully_qualified_definitions
     parser = mkparser
 
+    types = parser.known_resource_types
     assert_nothing_raised("Could not parse fully-qualified definition") {
-      parser.parse %{define one::two { }}
+      types.import_ast(parser.parse(%{define one::two { }}), '')
     }
     assert(parser.definition("one::two"), "Could not find one::two with no namespace")
-
-    # Now try using the definition
-    assert_nothing_raised("Could not parse fully-qualified definition usage") {
-      parser.parse %{one::two { yayness: }}
-    }
   end
 
   # #524
@@ -691,7 +679,7 @@ file { "/tmp/yayness":
       result = parser.parse %{$variable = undef}
     }
 
-    main = result.hostclass("").code
+    main = result.code
     children = main.children
     assert_instance_of(AST::VarDef, main.children[0])
     assert_instance_of(AST::Undef, main.children[0].value)
@@ -704,7 +692,8 @@ file { "/tmp/yayness":
     str = "file { '/tmp/yay': ensure => file }\nclass yay {}\nnode foo {}\ndefine bar {}\n"
     result = nil
     assert_nothing_raised("Could not parse") do
-      result = parser.parse(str)
+      parser.known_resource_types.import_ast(parser.parse(str), '')
+      result = parser.known_resource_types
     end
     assert_instance_of(Puppet::Resource::TypeCollection, result, "Did not get a ASTSet back from parsing")
 
@@ -734,12 +723,14 @@ file { "/tmp/yayness":
 
     result = nil
     assert_nothing_raised do
-      result = parser.newclass "Yayness"
+      parser.known_resource_types.import_ast(parser.parse("class yayness { }"), '')
+      result = parser.known_resource_types.hostclass('yayness')
     end
     assert_equal(result, parser.find_hostclass("", "yayNess"))
 
     assert_nothing_raised do
-      result = parser.newdefine "FunTest"
+      parser.known_resource_types.import_ast(parser.parse("define funtest { }"), '')
+      result = parser.known_resource_types.definition('funtest')
     end
     assert_equal(result, parser.find_definition("", "fUntEst"), "#{"fUntEst"} was not matched")
   end
diff --git a/test/language/scope.rb b/test/language/scope.rb
index cb5558a..d9c122a 100755
--- a/test/language/scope.rb
+++ b/test/language/scope.rb
@@ -163,7 +163,7 @@ class TestScope < Test::Unit::TestCase
     config = mkcompiler
 
     # Create a default source
-    parser.newclass("")
+    parser.known_resource_types.add Puppet::Resource::Type.new(:hostclass, "")
     config.topscope.source = parser.known_resource_types.hostclass("")
 
     # And a scope resource
@@ -175,12 +175,12 @@ class TestScope < Test::Unit::TestCase
     )
 
     # Create a top-level define
-    parser.newdefine "one", :arguments => [%w{arg}],
+    parser.known_resource_types.add Puppet::Resource::Type.new(:definition, "one", :arguments => [%w{arg}],
       :code => AST::ASTArray.new(
         :children => [
           resourcedef("file", "/tmp", {"owner" => varref("arg")})
         ]
-      )
+      ))
 
     # create a resource that calls our third define
     obj = resourcedef("one", "boo", {"arg" => "parentfoo"})
diff --git a/test/rails/railsparameter.rb b/test/rails/railsparameter.rb
index 9f6fc1c..77ce339 100755
--- a/test/rails/railsparameter.rb
+++ b/test/rails/railsparameter.rb
@@ -22,7 +22,7 @@ class TestRailsParameter < Test::Unit::TestCase
 
     # Now create a source
     parser = mkparser
-    source = parser.newclass "myclass"
+    source = parser.known_resource_types.add Puppet::Resource::Type.new(:hostclass, "myclass")
 
     host = Puppet::Rails::Host.new(:name => "myhost")
 

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list