Method: Markascend::LineUnit#parse

Defined in:
lib/markascend/line_unit.rb

#parse(out = nil) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/markascend/line_unit.rb', line 5

def parse out=nil
  @out = []
  @src = ::StringScanner.new line
  parsers = env.line_units
  while parsers.any?{|p| send p}
  end

  if out
    @out.each do |token|
      out << token
    end
  else
    @out.join
  end
end