diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-09-19 04:03:01 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-09-19 04:03:01 +0000 |
| commit | 94762e1ef4d935d3c1a0c2621e7be7230da21c07 (patch) | |
| tree | 09952b41736b7d84713026d103b5a1c6e028aa6b /lib/puppet/parser/parser.rb | |
| parent | 176d483efa052754f38ab15f1592a630da8d6cb7 (diff) | |
| download | puppet-94762e1ef4d935d3c1a0c2621e7be7230da21c07.tar.gz puppet-94762e1ef4d935d3c1a0c2621e7be7230da21c07.tar.xz puppet-94762e1ef4d935d3c1a0c2621e7be7230da21c07.zip | |
Trying to fix a bug where files other than site.pp do not get noticed for reparsing
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1621 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/parser/parser.rb')
| -rw-r--r-- | lib/puppet/parser/parser.rb | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/lib/puppet/parser/parser.rb b/lib/puppet/parser/parser.rb index 41c119c2c..a79f18b0e 100644 --- a/lib/puppet/parser/parser.rb +++ b/lib/puppet/parser/parser.rb @@ -29,7 +29,7 @@ module Puppet class Parser < Racc::Parser -module_eval <<'..end grammar.ra modeval..idab2f060823', 'grammar.ra', 603 +module_eval <<'..end grammar.ra modeval..id1e49212871', 'grammar.ra', 603 require 'puppet/parser/functions' attr_reader :file @@ -91,20 +91,23 @@ def initialize #end end +# Add a new file to be checked when we're checking to see if we should be +# reparsed. +def newfile(*files) + files.each do |file| + unless file.is_a? Puppet::LoadedFile + file = Puppet::LoadedFile.new(file) + end + @files << file + end +end + def on_error(token,value,stack) #on '%s' at '%s' in\n'%s'" % [token,value,stack] #error = "line %s: parse error after '%s'" % # [@lexer.line,@lexer.last] error = "Syntax error at '%s'" % [value] - #if Puppet[:debug] - #puts stack.inspect - #puts stack.class - #end - #if @lexer.file - # error += (" in '%s'" % @lexer.file) - #end - except = Puppet::ParseError.new(error) except.line = @lexer.line if @lexer.file @@ -135,33 +138,27 @@ def parse(string = nil) # and this is a framework error except.line ||= @lexer.line except.file ||= @lexer.file - #if Puppet[:debug] - # puts except.stack - #end raise except rescue Puppet::DevError => except except.line ||= @lexer.line except.file ||= @lexer.file - #if Puppet[:debug] - # puts except.stack - #end raise except rescue => except error = Puppet::DevError.new(except.message) error.line = @lexer.line error.file = @lexer.file error.set_backtrace except.backtrace - #if Puppet[:debug] - # puts caller - #end raise error end end +# See if any of the files have changed. def reparse? - @files.detect { |file| - file.changed? - } + if file = @files.detect { |file| file.changed? } + return file.stamp + else + return false + end end def string=(string) @@ -175,7 +172,7 @@ end # $Id$ -..end grammar.ra modeval..idab2f060823 +..end grammar.ra modeval..id1e49212871 ##### racc 1.4.5 generates ### |
