From f7d9b83a83bf43b13846c4b621794257f04832bb Mon Sep 17 00:00:00 2001 From: luke Date: Wed, 21 Sep 2005 22:40:31 +0000 Subject: I am still somewhat in mid-change, but I have made the biggest changes to making nodes work correctly. The core code works, but I still need to fix my various test cases git-svn-id: https://reductivelabs.com/svn/puppet/trunk@697 980ebf18-57e1-0310-9a29-db15c13687c0 --- lib/puppet/parser/parser.rb | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) (limited to 'lib/puppet/parser/parser.rb') diff --git a/lib/puppet/parser/parser.rb b/lib/puppet/parser/parser.rb index b636b7b37..6115dee4b 100644 --- a/lib/puppet/parser/parser.rb +++ b/lib/puppet/parser/parser.rb @@ -8,6 +8,7 @@ require 'racc/parser' require 'puppet' +require 'puppet/parsedfile' require 'puppet/parser/lexer' require 'puppet/parser/ast' #require 'puppet/parser/interpreter' @@ -31,23 +32,27 @@ module Puppet class Parser < Racc::Parser -module_eval <<'..end grammar.ra modeval..idea8fcb8472', 'grammar.ra', 606 -attr_writer :stack -attr_reader :file +module_eval <<'..end grammar.ra modeval..id859845cfb5', 'grammar.ra', 607 +attr_reader :file, :files def file=(file) - if self.stack.include?(file) + unless FileTest.exists?(file) + raise Puppet::Error, "Could not find file %s" % file + end + if @files.detect { |f| f.file == file } raise Puppet::ImportError.new("Import loop detected") else + @files << Puppet::ParsedFile.new(file) @lexer.file = file end end def initialize @lexer = Puppet::Parser::Lexer.new() - if Puppet[:debug] - @yydebut = true - end + @files = [] + #if Puppet[:debug] + # @yydebug = true + #end end def on_error(token,value,stack) @@ -116,26 +121,14 @@ def parse end end -def stack - if defined? @stack and ! @stack.nil? - if @lexer.file - return [@stack,@lexer.file].flatten - else - return @stack - end - else - if @lexer.file - return [@lexer.file] - else - return [] - end - end +def reparse? + return @files.detect { |file| file.changed? } end def string=(string) @lexer.string = string end -..end grammar.ra modeval..idea8fcb8472 +..end grammar.ra modeval..id859845cfb5 ##### racc 1.4.4 generates ### -- cgit