diff options
| author | Luke Kanies <luke@madstop.com> | 2008-10-31 16:01:28 -0500 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2008-10-31 16:01:28 -0500 |
| commit | e76cac7df102389b7ee487be4031caf0e7e2ab04 (patch) | |
| tree | 0b9bd8d260613a5b41d9c72fa984065e5cb2d5f4 /lib/puppet/parser | |
| parent | 801b8a643d353176675023adaa25f26d0ec67403 (diff) | |
| parent | f0635179b60f5cf30d1f7070f4c3c998ad5131c0 (diff) | |
| download | puppet-e76cac7df102389b7ee487be4031caf0e7e2ab04.tar.gz puppet-e76cac7df102389b7ee487be4031caf0e7e2ab04.tar.xz puppet-e76cac7df102389b7ee487be4031caf0e7e2ab04.zip | |
Merge branch '0.24.x'
Conflicts:
CHANGELOG
Diffstat (limited to 'lib/puppet/parser')
| -rw-r--r-- | lib/puppet/parser/ast/astarray.rb | 3 | ||||
| -rw-r--r-- | lib/puppet/parser/ast/hostclass.rb | 7 | ||||
| -rw-r--r-- | lib/puppet/parser/lexer.rb | 5 | ||||
| -rw-r--r-- | lib/puppet/parser/parser_support.rb | 6 |
4 files changed, 17 insertions, 4 deletions
diff --git a/lib/puppet/parser/ast/astarray.rb b/lib/puppet/parser/ast/astarray.rb index 8f09aa922..0fccbca75 100644 --- a/lib/puppet/parser/ast/astarray.rb +++ b/lib/puppet/parser/ast/astarray.rb @@ -30,10 +30,9 @@ class Puppet::Parser::AST items << child end } - rets = items.flatten.collect { |child| child.safeevaluate(scope) - } + }.flatten return rets.reject { |o| o.nil? } end diff --git a/lib/puppet/parser/ast/hostclass.rb b/lib/puppet/parser/ast/hostclass.rb index 7f89f8151..4f5c4797c 100644 --- a/lib/puppet/parser/ast/hostclass.rb +++ b/lib/puppet/parser/ast/hostclass.rb @@ -56,7 +56,12 @@ class Puppet::Parser::AST::HostClass < Puppet::Parser::AST::Definition # Don't create a subscope for the top-level class, since it already # has its own scope. - scope = subscope(scope, resource) unless resource.title == :main + unless resource.title == :main + scope = subscope(scope, resource) + + scope.setvar("title", resource.title) + scope.setvar("name", resource.name) + end # Add the parent scope namespaces to our own. if pnames diff --git a/lib/puppet/parser/lexer.rb b/lib/puppet/parser/lexer.rb index 9226434da..dd6c29d9f 100644 --- a/lib/puppet/parser/lexer.rb +++ b/lib/puppet/parser/lexer.rb @@ -157,6 +157,11 @@ class Puppet::Parser::Lexer TOKENS.add_token :COMMENT, %r{#.*}, :skip => true + TOKENS.add_token :MLCOMMENT, %r{/\*(.*?)\*/}m do |lexer, value| + lexer.line += value.count("\n") + [nil,nil] + end + TOKENS.add_token :RETURN, "\n", :skip => true, :incr_line => true, :skip_text => true TOKENS.add_token :SQUOTE, "'" do |lexer, value| diff --git a/lib/puppet/parser/parser_support.rb b/lib/puppet/parser/parser_support.rb index 853d6aa86..1583973a7 100644 --- a/lib/puppet/parser/parser_support.rb +++ b/lib/puppet/parser/parser_support.rb @@ -291,10 +291,14 @@ class Puppet::Parser::Parser if tmp == "" tmp = "main" end - + Puppet.debug addcontext("Adding code to %s" % tmp) # Else, add our code to it. if other.code and code + # promote if neededcodes to ASTArray so that we can append code + # ASTArray knows how to evaluate its members. + other.code = ast AST::ASTArray, :children => [other.code] unless other.code.is_a?(AST::ASTArray) + code = ast AST::ASTArray, :children => [code] unless code.is_a?(AST::ASTArray) other.code.children += code.children else other.code ||= code |
