Package org.commonmark.internal
Class ParagraphParser
- java.lang.Object
-
- org.commonmark.parser.block.AbstractBlockParser
-
- org.commonmark.internal.ParagraphParser
-
- All Implemented Interfaces:
BlockParser
public class ParagraphParser extends AbstractBlockParser
-
-
Field Summary
Fields Modifier and Type Field Description private Paragraph
block
private LinkReferenceDefinitionParser
linkReferenceDefinitionParser
-
Constructor Summary
Constructors Constructor Description ParagraphParser()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addLine(SourceLine line)
Add the part of a line that belongs to this block parser to parse (i.e.void
addSourceSpan(SourceSpan sourceSpan)
Add a source span of the currently parsed block.boolean
canHaveLazyContinuationLines()
Return true if the block can have lazy continuation lines.void
closeBlock()
Block
getBlock()
java.util.List<DefinitionMap<?>>
getDefinitions()
Return definitions parsed by this parser.SourceLines
getParagraphLines()
void
parseInlines(InlineParser inlineParser)
BlockContinue
tryContinue(ParserState state)
-
Methods inherited from class org.commonmark.parser.block.AbstractBlockParser
canContain, isContainer
-
-
-
-
Field Detail
-
block
private final Paragraph block
-
linkReferenceDefinitionParser
private final LinkReferenceDefinitionParser linkReferenceDefinitionParser
-
-
Method Detail
-
canHaveLazyContinuationLines
public boolean canHaveLazyContinuationLines()
Description copied from interface:BlockParser
Return 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:
canHaveLazyContinuationLines
in interfaceBlockParser
- Overrides:
canHaveLazyContinuationLines
in classAbstractBlockParser
-
getBlock
public Block getBlock()
-
tryContinue
public BlockContinue tryContinue(ParserState state)
-
addLine
public void addLine(SourceLine line)
Description copied from interface:BlockParser
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.- Specified by:
addLine
in interfaceBlockParser
- Overrides:
addLine
in classAbstractBlockParser
-
addSourceSpan
public void addSourceSpan(SourceSpan sourceSpan)
Description copied from interface:BlockParser
Add a source span of the currently parsed block. The default implementation inAbstractBlockParser
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.- Specified by:
addSourceSpan
in interfaceBlockParser
- Overrides:
addSourceSpan
in classAbstractBlockParser
-
getDefinitions
public java.util.List<DefinitionMap<?>> getDefinitions()
Description copied from interface:BlockParser
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)
.- Specified by:
getDefinitions
in interfaceBlockParser
- Overrides:
getDefinitions
in classAbstractBlockParser
-
closeBlock
public void closeBlock()
- Specified by:
closeBlock
in interfaceBlockParser
- Overrides:
closeBlock
in classAbstractBlockParser
-
parseInlines
public void parseInlines(InlineParser inlineParser)
- Specified by:
parseInlines
in interfaceBlockParser
- Overrides:
parseInlines
in classAbstractBlockParser
-
getParagraphLines
public SourceLines getParagraphLines()
-
-