lib/infoboxer/parser.rb in infoboxer-0.2.7 vs lib/infoboxer/parser.rb in infoboxer-0.2.8

- old
+ new

@@ -1,8 +1,10 @@ # encoding: utf-8 + require 'ostruct' require 'procme' +require 'logger' module Infoboxer class Parser class ParsingError < RuntimeError end @@ -45,16 +47,17 @@ else fail(ArgumentError, "Can't coerce site traits from #{traits.inspect}") end end end - + include Tree def initialize(context) @context = context @re = OpenStruct.new(make_regexps) + @logger = Logger.new(STDOUT).tap { |l| l.level = Logger::FATAL } end require_relative 'parser/inline' include Parser::Inline @@ -63,9 +66,13 @@ private require_relative 'parser/util' include Parser::Util + + def log(msg) + @logger.info "#{msg} | #{@context.lineno}:#{@context.colno}: #{@context.current}" + end end end require_relative 'parser/context'