BlockParser class

Maintains the internal state needed to parse a series of lines into blocks of Markdown suitable for further inline parsing.

Constructors

BlockParser(List<Line> lines, Document document, {int offset = 0})
BlockParser.be(List<Line> lines, Document document, List<BlockSyntax> blockSyntaxes, {int offset = 0})

Properties

blockSyntaxes List<BlockSyntax>
The enabled block syntaxes.
final
current Line
Gets the current line.
no setter
currentSyntax BlockSyntax?
The BlockSyntax which is running now. The value is null until we found the first matched BlockSyntax.
no setter
document Document
The Markdown document this parser is parsing.
final
encounteredBlankLine bool
Whether the parser has encountered a blank line between two block-level elements.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
isDone bool
no setter
lines List<Line>
final
linesToConsume List<Line>
The lines from _start to _pos (inclusive), it works as a buffer for some blocks, for example: When the ParagraphSyntax parsing process is interrupted by the SetextHeaderSyntax, so this structure is not a paragraph but a setext heading, then the ParagraphSyntax.parse does not have to retreat the reading position, it only needs to return null, the SetextHeaderSyntax will pick up the lines in linesToConsume.
no setter
next Line?
Gets the line after the current one or null if there is none.
no setter
offset int
Line number of the first line.
getter/setter pair
parentSyntax BlockSyntax?
The parent BlockSyntax when it is running inside a nested syntax.
no setter
pos int
no setter
previousSyntax BlockSyntax?
The BlockSyntax which is running before the currentSyntax.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
setextHeadingDisabled bool
Whether the SetextHeadingSyntax is disabled temporarily.
no setter

Methods

advance() → void
Advances the reading position by one line.
matches(RegExp regex) bool
Gets whether or not the current line matches the given pattern.
matchesNext(RegExp regex) bool
Gets whether or not the next line matches the given pattern.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parseLines({BlockSyntax? parentSyntax, bool disabledSetextHeading = false}) List<Node>
peek(int linesAhead) Line?
Gets the line that is linesAhead lines ahead of the current one, or null if there is none.
retreat() → void
Retreats the reading position by one line.
retreatBy(int count) → void
Retreats the reading position by count lines.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

standardBlockSyntaxes → const List<BlockSyntax>
The collection of built-in block parsers.