lib/kramdown/parser/base.rb in kramdown-1.2.0 vs lib/kramdown/parser/base.rb in kramdown-1.3.0

- old
+ new

@@ -5,18 +5,20 @@ # # This file is part of kramdown which is licensed under the MIT. #++ # +require 'kramdown/utils/string_scanner' + module Kramdown module Parser # == \Base class for parsers # # This class serves as base class for parsers. It provides common methods that can/should be - # used by all parsers, especially by those using StringScanner for parsing. + # used by all parsers, especially by those using StringScanner(Kramdown) for parsing. # # A parser object is used as a throw-away object, i.e. it is only used for storing the needed # state information during parsing. Therefore one can't instantiate a parser object directly but # only use the Base::parse method. # @@ -47,10 +49,10 @@ # The @root element, the @warnings array and @text_type (specifies the default type for newly # created text nodes) are automatically initialized. def initialize(source, options) @source = source @options = Kramdown::Options.merge(options) - @root = Element.new(:root, nil, nil, :encoding => (source.encoding rescue nil)) + @root = Element.new(:root, nil, nil, :encoding => (source.encoding rescue nil), :location => 1) @warnings = [] @text_type = :text end private_class_method(:new, :allocate)