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 class
TableBlockParser.Factory
private static class
TableBlockParser.TableCellInfo
-
Field Summary
Fields Modifier and Type Field Description private TableBlock
block
private boolean
canHaveLazyContinuationLines
private java.util.List<TableBlockParser.TableCellInfo>
columns
private java.util.List<SourceLine>
rowLines
-
Constructor Summary
Constructors Modifier Constructor Description private
TableBlockParser(java.util.List<TableBlockParser.TableCellInfo> columns, SourceLine headerLine)
-
Method Summary
All Methods Static 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.boolean
canHaveLazyContinuationLines()
Return true if the block can have lazy continuation lines.private static TableCell.Alignment
getAlignment(boolean left, boolean right)
Block
getBlock()
private TableCell
parseCell(SourceLine cell, int column, InlineParser inlineParser)
void
parseInlines(InlineParser inlineParser)
private static java.util.List<TableBlockParser.TableCellInfo>
parseSeparator(java.lang.CharSequence s)
private static java.util.List<SourceLine>
split(SourceLine line)
BlockContinue
tryContinue(ParserState state)
-
Methods inherited from class org.commonmark.parser.block.AbstractBlockParser
addSourceSpan, canContain, closeBlock, 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: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
-
parseInlines
public void parseInlines(InlineParser inlineParser)
- Specified by:
parseInlines
in interfaceBlockParser
- Overrides:
parseInlines
in 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)
-
-