FandocParser translate fandoc text into an in-memory representation of the document.
See docLib::Fandoc for usage.
Slots
-
private DocElem blockquote()
-
private Void consume()
Consume the current line and advance to the next line
-
private Str? cur
-
private Int curIndent
-
private Int curLine
-
private Int curStart
-
private LineType? curt
-
private Void err(Str msg, Int line, Err? cause := null)
Log an error
-
private Void errReport(FandocErr err)
Log an error
- errsSource
-
FandocErr[] errs := FandocErr[,]
List of errors detected
-
internal Str filename := ""
-
private DocElem heading()
-
static private Bool isOrderedListMark(Str line, Int i)
Return if line starting at index i is an ordered list item:
number* "." sp (digits) letter "." sp (a-z | A-Z single letter only) roman* "." sp (ivx | IVX combos)
-
private Int lineIndex
-
private Str[]? lines
-
private DocElem listItems(DocElem list, LineType listType, Int listIndent)
- mainSource
-
private Int numLines
-
private DocElem ol()
-
private DocElem para()
- parseSource
-
Doc parse(Str filename, InStream in, Bool close := true)
Parse the document from the specified in stream into an in-memory tree structure. If close is true, the stream is guaranteed to be closed.
- parseHeaderSource
-
Bool parseHeader := true
If true, then leading lines starting with
**
are parsed as header - parseStrSource
-
Parse a string into its in-memory document tree structure.
-
private Str? peek
-
private Int peekIndent
-
private Int peekStart
-
private LineType? peekt
-
private DocElem pre()
-
private DocElem preExplicit()
-
private Void readLines(InStream in, Bool close)
Read all the lines into memory and close stream if required.
- silentSource
-
Bool silent := false
If not silent, then errors are dumped to stdout
-
private Void skipBlankLines()
Skip any blank lines
-
private DocElem topBlock()
-
private DocElem ul()