Package org.commonmark.parser.block
Class AbstractBlockParser
java.lang.Object
org.commonmark.parser.block.AbstractBlockParser
- All Implemented Interfaces:
BlockParser
- Direct Known Subclasses:
BlockQuoteParser,DocumentBlockParser,FencedCodeBlockParser,FootnoteBlockParser,HeadingParser,HtmlBlockParser,IndentedCodeBlockParser,ListBlockParser,ListItemParser,ParagraphParser,TableBlockParser,ThematicBreakParser,YamlFrontMatterBlockParser
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLine(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) booleanReturn true if the block can have lazy continuation lines.voidList<DefinitionMap<?>> Return definitions parsed by this parser.booleanReturn true if the block that is parsed is a container (contains other blocks), or false if it's a leaf.voidparseInlines(InlineParser inlineParser) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.commonmark.parser.block.BlockParser
getBlock, tryContinue
-
Constructor Details
-
AbstractBlockParser
public AbstractBlockParser()
-
-
Method Details
-
isContainer
public boolean isContainer()Description copied from interface:BlockParserReturn true if the block that is parsed is a container (contains other blocks), or false if it's a leaf.- Specified by:
isContainerin interfaceBlockParser
-
canHaveLazyContinuationLines
public boolean canHaveLazyContinuationLines()Description copied from interface:BlockParserReturn true if the block can have lazy continuation lines.Lazy continuation lines are lines that were rejected by this
BlockParser.tryContinue(ParserState)but didn't match any other block parsers either.If true is returned here, those lines will get added via
BlockParser.addLine(SourceLine). For false, the block is closed instead.- Specified by:
canHaveLazyContinuationLinesin interfaceBlockParser
-
canContain
- Specified by:
canContainin interfaceBlockParser
-
addLine
Description copied from interface:BlockParserAdd 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.- Specified by:
addLinein interfaceBlockParser
-
addSourceSpan
Description copied from interface:BlockParserAdd 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.- Specified by:
addSourceSpanin interfaceBlockParser
-
getDefinitions
Description copied from interface:BlockParserReturn 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).- Specified by:
getDefinitionsin interfaceBlockParser
-
closeBlock
public void closeBlock()- Specified by:
closeBlockin interfaceBlockParser
-
parseInlines
- Specified by:
parseInlinesin interfaceBlockParser
-