APIdia Launch Partner
Top Description Methods
jdk.internal.org.commonmark.parser.block

public Interface BlockParser

Known Direct Implementers
jdk.internal.org.commonmark.parser.block.AbstractBlockParser
Imports
jdk.internal.org.commonmark.node.Block, .SourceSpan, jdk.internal.org.commonmark.parser.InlineParser, .SourceLine

Parser for a specific block node.

Implementations should subclass AbstractBlockParser instead of implementing this directly.

Method Summary

Modifier and TypeMethod and Description
public void
addLine(SourceLine line)

Add the part of a line that belongs to this block parser to parse (i.e. without any container block markers).

public void
addSourceSpan(SourceSpan sourceSpan)

Add a source span of the currently parsed block.

public boolean
canContain(Block childBlock)

public boolean
canHaveLazyContinuationLines()

Return true if the block can have lazy continuation lines.

public void
public Block
public boolean
isContainer()

Return true if the block that is parsed is a container (contains other blocks), or false if it's a leaf.

public void
parseInlines(InlineParser inlineParser)

public BlockContinue
tryContinue(ParserState parserState)

Method Detail

addLineback to summary
public void addLine(SourceLine line)

Add the part of a line that belongs to this block parser to parse (i.e. without any container block markers). Note that the line will only include a SourceLine#getSourceSpan() if source spans are enabled for inlines.

addSourceSpanback to summary
public void addSourceSpan(SourceSpan sourceSpan)

Add a source span of the currently parsed block. The default implementation in AbstractBlockParser adds it to the block. Unless you have some complicated parsing where you need to check source positions, you don't need to override this.

Since
0.16.0
canContainback to summary
public boolean canContain(Block childBlock)
canHaveLazyContinuationLinesback to summary
public boolean canHaveLazyContinuationLines()

Return true if the block can have lazy continuation lines.

Lazy continuation lines are lines that were rejected by this tryContinue(ParserState) but didn't match any other block parsers either.

If true is returned here, those lines will get added via addLine(SourceLine). For false, the block is closed instead.

closeBlockback to summary
public void closeBlock()
getBlockback to summary
public Block getBlock()
isContainerback to summary
public boolean isContainer()

Return true if the block that is parsed is a container (contains other blocks), or false if it's a leaf.

parseInlinesback to summary
public void parseInlines(InlineParser inlineParser)
tryContinueback to summary
public BlockContinue tryContinue(ParserState parserState)