Class TableBlockParser
- java.lang.Object
-
- org.commonmark.parser.block.AbstractBlockParser
-
- org.commonmark.ext.gfm.tables.internal.TableBlockParser
-
- All Implemented Interfaces:
BlockParser
public class TableBlockParser extends AbstractBlockParser
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTableBlockParser.Factoryprivate static classTableBlockParser.TableCellInfo
-
Field Summary
Fields Modifier and Type Field Description private TableBlockblockprivate booleancanHaveLazyContinuationLinesprivate java.util.List<TableBlockParser.TableCellInfo>columnsprivate java.util.List<SourceLine>rowLines
-
Constructor Summary
Constructors Modifier Constructor Description privateTableBlockParser(java.util.List<TableBlockParser.TableCellInfo> columns, SourceLine headerLine)
-
Method Summary
All Methods Static Methods Instance Methods Concrete 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.booleancanHaveLazyContinuationLines()Return true if the block can have lazy continuation lines.private static TableCell.AlignmentgetAlignment(boolean left, boolean right)BlockgetBlock()private TableCellparseCell(SourceLine cell, int column, InlineParser inlineParser)voidparseInlines(InlineParser inlineParser)private static java.util.List<TableBlockParser.TableCellInfo>parseSeparator(java.lang.CharSequence s)private static java.util.List<SourceLine>split(SourceLine line)BlockContinuetryContinue(ParserState state)-
Methods inherited from class org.commonmark.parser.block.AbstractBlockParser
addSourceSpan, canContain, closeBlock, getDefinitions, isContainer
-
-
-
-
Field Detail
-
block
private final TableBlock block
-
rowLines
private final java.util.List<SourceLine> rowLines
-
columns
private final java.util.List<TableBlockParser.TableCellInfo> columns
-
canHaveLazyContinuationLines
private boolean canHaveLazyContinuationLines
-
-
Constructor Detail
-
TableBlockParser
private TableBlockParser(java.util.List<TableBlockParser.TableCellInfo> columns, SourceLine headerLine)
-
-
Method Detail
-
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- Overrides:
canHaveLazyContinuationLinesin classAbstractBlockParser
-
getBlock
public Block getBlock()
-
tryContinue
public BlockContinue tryContinue(ParserState state)
-
addLine
public void addLine(SourceLine line)
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- Overrides:
addLinein classAbstractBlockParser
-
parseInlines
public void parseInlines(InlineParser inlineParser)
- Specified by:
parseInlinesin interfaceBlockParser- Overrides:
parseInlinesin classAbstractBlockParser
-
parseCell
private TableCell parseCell(SourceLine cell, int column, InlineParser inlineParser)
-
split
private static java.util.List<SourceLine> split(SourceLine line)
-
parseSeparator
private static java.util.List<TableBlockParser.TableCellInfo> parseSeparator(java.lang.CharSequence s)
-
getAlignment
private static TableCell.Alignment getAlignment(boolean left, boolean right)
-
-