class
Crst::Parser
- Crst::Parser
- Reference
- Object
Overview
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
Defined in:
crst/parser.crConstructors
-
.new(input : String, config : Config = Config.new)
Initialize the parser with RST input text and configuration
Instance Method Summary
- #depth : Int32
- #depth=(depth : Int32)
-
#parse : Document
Parse the input text and return the root Document node
-
#parse_block(lines : Array(String), line_offset : Int32 = 0) : Array(Node)
delegate to BlockParser
-
#parse_directive(reader : LineReader, name : String, arguments : Array(String), line_offset : Int32) : Node
delegate to DirectiveParser
-
#parse_explicit_markup(reader : LineReader, line_offset : Int32) : Node
delegate to ExplicitMarkupParser
- #section_levels : Array(Char)
- #section_levels=(section_levels : Array(Char))
-
#section_start?(reader : LineReader) : Bool
delegate to SectionParser
- #try_parse_section(reader : LineReader, document : Document) : Bool
Constructor Detail
Initialize the parser with RST input text and configuration
Instance Method Detail
Parse the input text and return the root Document node
Returns a Document containing all parsed nodes
delegate to BlockParser
def parse_directive(reader : LineReader, name : String, arguments : Array(String), line_offset : Int32) : Node
#
delegate to DirectiveParser
delegate to ExplicitMarkupParser