module Bromlife
Constants
- LIBBROMLIFE_VERSION
- VERSION
Public Class Methods
Source
# File lib/bromlife.rb, line 29 def self.dom_parse(input) parser = Parser.new(input) result = [] current = result loop do event = parser.next event => [type, subtype, str, label] case [type, subtype] in [:left, :vocab | :word | :label | :ignored] \ | [:right, :vocab | :word | :label | :ignored] \ | [:body, :label | :ignored] # nop in [:body, :normal] current << str in [:left, :normal] elem = Element.new(label:, parent: current) current << elem current = elem in [:right, :normal] current = current.parent end end result end
It returns an array of nodes. The node is either String or an Bromlife::Element.