diff options
Diffstat (limited to 'lib/puppet/parser')
-rw-r--r-- | lib/puppet/parser/grammar.ra | 12 | ||||
-rw-r--r-- | lib/puppet/parser/parser.rb | 56 |
2 files changed, 44 insertions, 24 deletions
diff --git a/lib/puppet/parser/grammar.ra b/lib/puppet/parser/grammar.ra index 6ed4fd4d5..13a3729c6 100644 --- a/lib/puppet/parser/grammar.ra +++ b/lib/puppet/parser/grammar.ra @@ -454,7 +454,17 @@ import: IMPORT quotedtext { :line => @lexer.line ) Dir.chdir(dir) { - Dir.glob(val[1]).each { |file| + # We can't interpolate at this point since we don't have any + # scopes set up. Warn the user if they use a variable reference + pat = val[1].value + if pat.index("$") + Puppet.warning( + "The import of #{pat} contains a variable reference;" + + " variables are not interpolated for imports " + + "in file #{@lexer.file} at line #{@lexer.line}" + ) + end + Dir.glob(pat).each { |file| parser = Puppet::Parser::Parser.new() parser.files = self.files Puppet.debug("importing '%s'" % file) diff --git a/lib/puppet/parser/parser.rb b/lib/puppet/parser/parser.rb index b1031e637..110e4df82 100644 --- a/lib/puppet/parser/parser.rb +++ b/lib/puppet/parser/parser.rb @@ -1,6 +1,6 @@ # # DO NOT MODIFY!!!! -# This file is automatically generated by racc 1.4.4 +# This file is automatically generated by racc 1.4.5 # from racc grammer file "grammar.ra". # @@ -29,7 +29,7 @@ module Puppet class Parser < Racc::Parser -module_eval <<'..end grammar.ra modeval..id0599241196', 'grammar.ra', 703 +module_eval <<'..end grammar.ra modeval..id5d9241e836', 'grammar.ra', 713 attr_reader :file attr_accessor :files @@ -144,9 +144,9 @@ def string=(string) end # $Id$ -..end grammar.ra modeval..id0599241196 +..end grammar.ra modeval..id5d9241e836 -##### racc 1.4.4 generates ### +##### racc 1.4.5 generates ### racc_reduce_table = [ 0, 0, :racc_error, @@ -1137,7 +1137,7 @@ module_eval <<'.,.,', 'grammar.ra', 440 # reduce 70 omitted -module_eval <<'.,.,', 'grammar.ra', 478 +module_eval <<'.,.,', 'grammar.ra', 488 def _reduce_71( val, _values, result ) # importing files # yuk, i hate keywords @@ -1152,7 +1152,17 @@ module_eval <<'.,.,', 'grammar.ra', 478 :line => @lexer.line ) Dir.chdir(dir) { - Dir.glob(val[1]).each { |file| + # We can't interpolate at this point since we don't have any + # scopes set up. Warn the user if they use a variable reference + pat = val[1].value + if pat.index("$") + Puppet.warning( + "The import of #{pat} contains a variable reference;" + + " variables are not interpolated for imports " + + "in file #{@lexer.file} at line #{@lexer.line}" + ) + end + Dir.glob(pat).each { |file| parser = Puppet::Parser::Parser.new() parser.files = self.files Puppet.debug("importing '%s'" % file) @@ -1177,7 +1187,7 @@ module_eval <<'.,.,', 'grammar.ra', 478 end .,., -module_eval <<'.,.,', 'grammar.ra', 489 +module_eval <<'.,.,', 'grammar.ra', 499 def _reduce_72( val, _values, result ) result = AST::CompDef.new( :name => AST::Name.new(:value => val[1], :line => @lexer.line), @@ -1191,7 +1201,7 @@ module_eval <<'.,.,', 'grammar.ra', 489 end .,., -module_eval <<'.,.,', 'grammar.ra', 502 +module_eval <<'.,.,', 'grammar.ra', 512 def _reduce_73( val, _values, result ) result = AST::CompDef.new( :name => AST::Name.new(:value => val[1], :line => @lexer.line), @@ -1209,7 +1219,7 @@ module_eval <<'.,.,', 'grammar.ra', 502 end .,., -module_eval <<'.,.,', 'grammar.ra', 519 +module_eval <<'.,.,', 'grammar.ra', 529 def _reduce_74( val, _values, result ) #:args => val[2], args = { @@ -1228,7 +1238,7 @@ module_eval <<'.,.,', 'grammar.ra', 519 end .,., -module_eval <<'.,.,', 'grammar.ra', 536 +module_eval <<'.,.,', 'grammar.ra', 546 def _reduce_75( val, _values, result ) args = { :name => AST::Name.new(:value => val[1], :line => @lexer.line), @@ -1250,7 +1260,7 @@ module_eval <<'.,.,', 'grammar.ra', 536 end .,., -module_eval <<'.,.,', 'grammar.ra', 557 +module_eval <<'.,.,', 'grammar.ra', 567 def _reduce_76( val, _values, result ) unless val[1].instance_of?(AST::ASTArray) val[1] = AST::ASTArray.new( @@ -1274,7 +1284,7 @@ module_eval <<'.,.,', 'grammar.ra', 557 end .,., -module_eval <<'.,.,', 'grammar.ra', 580 +module_eval <<'.,.,', 'grammar.ra', 590 def _reduce_77( val, _values, result ) unless val[1].instance_of?(AST::ASTArray) val[1] = AST::ASTArray.new( @@ -1304,7 +1314,7 @@ module_eval <<'.,.,', 'grammar.ra', 580 # reduce 78 omitted -module_eval <<'.,.,', 'grammar.ra', 594 +module_eval <<'.,.,', 'grammar.ra', 604 def _reduce_79( val, _values, result ) if val[0].instance_of?(AST::ASTArray) result = val[0] @@ -1320,7 +1330,7 @@ module_eval <<'.,.,', 'grammar.ra', 594 end .,., -module_eval <<'.,.,', 'grammar.ra', 602 +module_eval <<'.,.,', 'grammar.ra', 612 def _reduce_80( val, _values, result ) result = AST::ASTArray.new( :line => @lexer.line, @@ -1333,14 +1343,14 @@ module_eval <<'.,.,', 'grammar.ra', 602 # reduce 81 omitted -module_eval <<'.,.,', 'grammar.ra', 607 +module_eval <<'.,.,', 'grammar.ra', 617 def _reduce_82( val, _values, result ) result = val[1] result end .,., -module_eval <<'.,.,', 'grammar.ra', 618 +module_eval <<'.,.,', 'grammar.ra', 628 def _reduce_83( val, _values, result ) if val[1].instance_of?(AST::ASTArray) result = val[1] @@ -1357,7 +1367,7 @@ module_eval <<'.,.,', 'grammar.ra', 618 # reduce 84 omitted -module_eval <<'.,.,', 'grammar.ra', 632 +module_eval <<'.,.,', 'grammar.ra', 642 def _reduce_85( val, _values, result ) if val[0].instance_of?(AST::ASTArray) val[0].push(val[2]) @@ -1373,7 +1383,7 @@ module_eval <<'.,.,', 'grammar.ra', 632 end .,., -module_eval <<'.,.,', 'grammar.ra', 640 +module_eval <<'.,.,', 'grammar.ra', 650 def _reduce_86( val, _values, result ) result = AST::CompArgument.new( :line => @lexer.line, @@ -1384,7 +1394,7 @@ module_eval <<'.,.,', 'grammar.ra', 640 end .,., -module_eval <<'.,.,', 'grammar.ra', 647 +module_eval <<'.,.,', 'grammar.ra', 657 def _reduce_87( val, _values, result ) result = AST::CompArgument.new( :line => @lexer.line, @@ -1397,7 +1407,7 @@ module_eval <<'.,.,', 'grammar.ra', 647 # reduce 88 omitted -module_eval <<'.,.,', 'grammar.ra', 656 +module_eval <<'.,.,', 'grammar.ra', 666 def _reduce_89( val, _values, result ) result = AST::Name.new( :value => val[1], @@ -1408,7 +1418,7 @@ module_eval <<'.,.,', 'grammar.ra', 656 end .,., -module_eval <<'.,.,', 'grammar.ra', 665 +module_eval <<'.,.,', 'grammar.ra', 675 def _reduce_90( val, _values, result ) name = val[0].sub(/^\$/,'') result = AST::Variable.new( @@ -1420,7 +1430,7 @@ module_eval <<'.,.,', 'grammar.ra', 665 end .,., -module_eval <<'.,.,', 'grammar.ra', 677 +module_eval <<'.,.,', 'grammar.ra', 687 def _reduce_91( val, _values, result ) if val[1].instance_of?(AST::ASTArray) result = val[1] @@ -1441,7 +1451,7 @@ module_eval <<'.,.,', 'grammar.ra', 677 # reduce 94 omitted -module_eval <<'.,.,', 'grammar.ra', 682 +module_eval <<'.,.,', 'grammar.ra', 692 def _reduce_95( val, _values, result ) result = nil result |