diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2005-09-21 22:40:31 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2005-09-21 22:40:31 +0000 |
commit | f7d9b83a83bf43b13846c4b621794257f04832bb (patch) | |
tree | 465e13c7c8db27a805d04914a2f25da8713f5478 /lib/puppet/parser/parser.rb | |
parent | 03f57330ef06d6afd6b5f011f1764c4420f7d3dd (diff) | |
download | puppet-f7d9b83a83bf43b13846c4b621794257f04832bb.tar.gz puppet-f7d9b83a83bf43b13846c4b621794257f04832bb.tar.xz puppet-f7d9b83a83bf43b13846c4b621794257f04832bb.zip |
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
Diffstat (limited to 'lib/puppet/parser/parser.rb')
-rw-r--r-- | lib/puppet/parser/parser.rb | 37 |
1 files changed, 15 insertions, 22 deletions
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 ### |