Class: XmlUtils::TreeParser

Inherits:
Object
  • Object
show all
Defined in:
lib/xmlutils/tree_parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(source, document = nil) ⇒ TreeParser

Returns a new instance of TreeParser.



20
21
22
23
24
# File 'lib/xmlutils/tree_parser.rb', line 20

def initialize(source, document = nil)
  @tokens = Tokenizer.new(source).tokenize
  @pos = 0
  @document = document || Document.new
end

Instance Method Details

#parseObject



26
27
28
29
30
31
# File 'lib/xmlutils/tree_parser.rb', line 26

def parse
  while current_token && current_token.type != :eof
    parse_node(@document)
  end
  @document
end