1 --- acoc_ori 2010-10-07 16:03:29.089119182 -0300
2 +++ acoc 2010-10-07 16:05:52.657578887 -0300
5 include Term::ANSIColor
7 -class Config < Hash; end
9 + class Config < Hash; end
12 - attr_accessor :flags, :specs
14 + attr_accessor :flags, :specs
16 - def initialize(flags)
17 - @flags = flags || ""
19 + def initialize(flags)
20 + @flags = flags || ""
27 - attr_reader :regex, :flags, :colours
29 + attr_reader :regex, :flags, :colours
31 - def initialize(regex, flags, colours)
35 + def initialize(regex, flags, colours)
44 # get configuration data
46 def parse_config(*files)
48 + @cmd = Acoc::Config.new
53 next unless file && FileTest::file?(file) && FileTest::readable?(file)
56 - f = File.open(file) do |f|
57 + fo = File.open(file) do |f|
58 while line = f.gets do
59 next if line =~ /^(#|$)/ # skip blank lines and comments
62 if @cmd.has_key?(invocation)
63 @cmd[invocation].flags += flags unless flags.nil?
65 - @cmd[invocation] = Program.new(flags)
66 + @cmd[invocation] = Acoc::Program.new(flags)
68 prog.sub!(%r(/\w+), '')
74 - @cmd[prog].specs << Rule.new(Regexp.new(regex), flags, colours)
75 + @cmd[prog].specs << Acoc::Rule.new(Regexp.new(regex), flags, colours)
82 # act on only the first match unless the /a flag was given
83 - break if matched && ! @cmd[prog].flags.include?('a')
84 + return if matched && ! @cmd[prog].flags.include?('a')
86 # get a pattern and attribute set pairing for this command
87 @cmd[prog].specs.each do |spec|