class

Crst::Parser

Inherits Reference < Object

Main parser class for reStructuredText documents

This class handles the parsing of RST text into an abstract syntax tree (AST) composed of Node objects. The parsing is done line by line, recognizing various RST constructs.

Example:

parser = Crst::Parser.new("Hello World")
doc = parser.parse

Constructors

new(input : String, config : Config = Config.new)

Initialize the parser with RST input text and configuration

Source

Instance methods

depth
Source
depth=(depth : Int32)
Source
parse

Parse the input text and return the root Document node

Returns a Document containing all parsed nodes

Source
parse_block(lines : Array(String), line_offset : Int32 = 0, allow_sections : Bool = true) : Array(Node)

delegate to BlockParser

Source
parse_directive(reader : LineReader, name : String, arguments : Array(String), line_offset : Int32) : Node

delegate to DirectiveParser

Source
parse_explicit_markup(reader : LineReader, line_offset : Int32) : Node

delegate to ExplicitMarkupParser

Source
section_levels
Source
section_levels=(section_levels : Array(Char))
Source
section_start?(reader : LineReader) : Bool

delegate to SectionParser

Source
try_parse_section(reader : LineReader, document : Document, line_offset : Int32 = 0) : Bool
Source