Module: Bai2::Parser
- Defined in:
- lib/bai2/parser.rb
Defined Under Namespace
Classes: ParseNode
Class Method Summary collapse
-
.parse(data, options) ⇒ Object
Parsing is a two-step process:.
Class Method Details
.parse(data, options) ⇒ Object
Parsing is a two-step process:
-
Build a tree
-
Parse the tree
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/bai2/parser.rb', line 29 def parse(data, ) # split records, handle stupid DOS-format files, instantiate records records = data.split("\n").map(&:strip).map {|l| Record.new(l, options: ) } # merge continuations records = merge_continuations(records) # build the tree root = parse_tree(records) root end |