lib/nagios_parser/object/parser.rb in nagios_parser-1.2.1 vs lib/nagios_parser/object/parser.rb in nagios_parser-1.2.2

- old
+ new

@@ -30,10 +30,11 @@ when scanner.scan(/\s+/) # ignore whitespace when scanner.scan(/#[^\n]*/) # ignore comments when scanner.scan(/.*;[^\n]*/) + # ignore inline comments r = scanner.matched.sub(/(.*);[^\n]*/, '\1') scanner.string = r + scanner.rest scanner.reset when scanner.scan(/define/) result << [:DEFINE, nil] @@ -49,10 +50,10 @@ result << [:KEY, match.chomp.gsub(/\s+$/, '')] when (inside and match = scanner.scan(/\d+$/)) result << [:VALUE, match.to_i] when (inside and match = scanner.scan(/[^\n\}]+/)) # Make sure to ignore inline comments starting with ';'. - result << [:VALUE, match.first.gsub(/\s+$/, '')] + result << [:VALUE, match.gsub(/\s+$/, '')] else raise "Can't tokenize <#{scanner.peek(10)}>" end end