class Asciidoctor::Parser

Internal: Methods to parse lines of AsciiDoc into an object hierarchy representing the structure of the document. All methods are class methods and should be invoked from the Parser class. The main entry point is ::next_block. No Parser instances shall be discovered running around. (Any attempt to instantiate a Parser will be futile).

The object hierarchy created by the Parser consists of zero or more Section and Block objects. Section objects may be nested and a Section object contains zero or more Block objects. Block objects may be nested, but may only contain other Block objects. Block objects which represent lists may contain zero or more ListItem objects.

Examples

# Create a Reader for the AsciiDoc lines and retrieve the next block from it.
# Parser.next_block requires a parent, so we begin by instantiating an empty Document.

doc = Document.new
reader = Reader.new lines
block = Parser.next_block(reader, doc)
block.class
# => Asciidoctor::Block