Package org.commonmark.parser.block
Interface BlockParser
-
- All Known Implementing Classes:
AbstractBlockParser,BlockQuoteParser,DocumentBlockParser,FencedCodeBlockParser,FootnoteBlockParser,HeadingParser,HtmlBlockParser,IndentedCodeBlockParser,ListBlockParser,ListItemParser,ParagraphParser,TableBlockParser,ThematicBreakParser,YamlFrontMatterBlockParser
public interface BlockParserParser for a specific block node.Implementations should subclass
AbstractBlockParserinstead of implementing this directly.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddLine(SourceLine line)Add the part of a line that belongs to this block parser to parse (i.e.voidaddSourceSpan(SourceSpan sourceSpan)Add a source span of the currently parsed block.booleancanContain(Block childBlock)booleancanHaveLazyContinuationLines()Return true if the block can have lazy continuation lines.voidcloseBlock()BlockgetBlock()java.util.List<DefinitionMap<?>>getDefinitions()Return definitions parsed by this parser.booleanisContainer()Return true if the block that is parsed is a container (contains other blocks), or false if it's a leaf.voidparseInlines(InlineParser inlineParser)BlockContinuetryContinue(ParserState parserState)
-
-
-
Method Detail
-
isContainer
boolean isContainer()
Return true if the block that is parsed is a container (contains other blocks), or false if it's a leaf.
-
canHaveLazyContinuationLines
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.
-
canContain
boolean canContain(Block childBlock)
-
getBlock
Block getBlock()
-
tryContinue
BlockContinue tryContinue(ParserState parserState)
-
addLine
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 aSourceLine.getSourceSpan()if source spans are enabled for inlines.
-
addSourceSpan
void addSourceSpan(SourceSpan sourceSpan)
Add a source span of the currently parsed block. The default implementation inAbstractBlockParseradds 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
-
getDefinitions
java.util.List<DefinitionMap<?>> getDefinitions()
Return definitions parsed by this parser. The definitions returned here can later be accessed during inline parsing viaInlineParserContext.getDefinition(java.lang.Class<D>, java.lang.String).
-
closeBlock
void closeBlock()
-
parseInlines
void parseInlines(InlineParser inlineParser)
-
-