in lib/rdoc/markup/parser.rb [335:398]
def parse parent, indent = 0
p :parse_start => indent if @debug
until @tokens.empty? do
type, data, column, = get
case type
when :BREAK then
parent << RDoc::Markup::BlankLine.new
skip :NEWLINE, false
next
when :NEWLINE then
parent << RDoc::Markup::BlankLine.new
skip :NEWLINE, false
next
end
if column < indent then
unget
break
elsif column > indent then
unget
parent << build_verbatim(indent)
next
end
case type
when :HEADER then
parent << build_heading(data)
when :RULE then
parent << RDoc::Markup::Rule.new(data)
skip :NEWLINE
when :TEXT then
unget
parse_text parent, indent
when :BLOCKQUOTE then
type, _, column = get
if type == :NEWLINE
type, _, column = get
end
unget if type
bq = RDoc::Markup::BlockQuote.new
p :blockquote_start => [data, column] if @debug
parse bq, column
p :blockquote_end => indent if @debug
parent << bq
when *LIST_TOKENS then
unget
parent << build_list(indent)
else
type, data, column, line = @current_token
raise ParseError, "Unhandled token #{type} (#{data.inspect}) at #{line}:#{column}"
end
end
p :parse_end => indent if @debug
parent
end