public class InlineParserImpl extends Object implements InlineParser, ParagraphPreProcessor
| Modifier and Type | Field and Description |
|---|---|
protected com.vladsch.flexmark.ast.Node |
block |
protected ArrayList<com.vladsch.flexmark.util.sequence.BasedSequence> |
currentText |
protected BitSet |
customCharacters |
protected Map<Character,CharacterNodeFactory> |
customSpecialCharacterFactoryMap |
protected ArrayList<com.vladsch.flexmark.ast.Node> |
customSpecialCharacterNodes |
protected BitSet |
delimiterCharacters |
protected Map<Character,DelimiterProcessor> |
delimiterProcessors |
protected com.vladsch.flexmark.ast.Document |
document |
protected int |
index |
protected List<InlineParserExtensionFactory> |
inlineParserExtensionFactories |
protected Map<Character,List<InlineParserExtension>> |
inlineParserExtensions |
protected com.vladsch.flexmark.util.sequence.BasedSequence |
input |
protected Delimiter |
lastDelimiter
Top delimiter (emphasis, strong emphasis or custom emphasis).
|
protected List<LinkRefProcessor> |
linkRefProcessors |
protected LinkRefProcessorData |
linkRefProcessorsData |
protected Parsing |
myParsing |
protected InlineParserOptions |
options |
protected BitSet |
originalSpecialCharacters |
protected ReferenceRepository |
referenceRepository
Link references by ID, needs to be built up using parseReference before calling parse.
|
protected BitSet |
specialCharacters |
| Constructor and Description |
|---|
InlineParserImpl(com.vladsch.flexmark.util.options.DataHolder options,
BitSet specialCharacters,
BitSet delimiterCharacters,
Map<Character,DelimiterProcessor> delimiterProcessors,
LinkRefProcessorData linkRefProcessorsData,
List<InlineParserExtensionFactory> inlineParserExtensionFactories) |
| Modifier and Type | Method and Description |
|---|---|
void |
appendNode(com.vladsch.flexmark.ast.Node node) |
Text |
appendSeparateText(com.vladsch.flexmark.util.sequence.BasedSequence text) |
void |
appendText(com.vladsch.flexmark.util.sequence.BasedSequence text) |
void |
appendText(com.vladsch.flexmark.util.sequence.BasedSequence text,
int beginIndex,
int endIndex) |
static BitSet |
calculateDelimiterCharacters(com.vladsch.flexmark.util.options.DataHolder options,
Set<Character> characters) |
static Map<Character,DelimiterProcessor> |
calculateDelimiterProcessors(com.vladsch.flexmark.util.options.DataHolder options,
List<DelimiterProcessor> delimiterProcessors) |
static Map<Character,List<InlineParserExtensionFactory>> |
calculateInlineParserExtensions(com.vladsch.flexmark.util.options.DataHolder options,
List<InlineParserExtensionFactory> extensionFactories) |
static LinkRefProcessorData |
calculateLinkRefProcessors(com.vladsch.flexmark.util.options.DataHolder options,
List<LinkRefProcessorFactory> linkRefProcessors) |
static BitSet |
calculateSpecialCharacters(com.vladsch.flexmark.util.options.DataHolder options,
BitSet delimiterCharacters) |
protected Object |
clone() |
protected static void |
collapseLinkRefChildren(com.vladsch.flexmark.ast.Node node,
Boolean isTentative) |
protected static boolean |
containsLinkRefs(com.vladsch.flexmark.util.sequence.BasedSequence nodeChars,
com.vladsch.flexmark.ast.Node next,
Boolean isDefined) |
void |
finalizeDocument(com.vladsch.flexmark.ast.Document document) |
boolean |
flushTextNode() |
com.vladsch.flexmark.ast.Node |
getBlock() |
ArrayList<com.vladsch.flexmark.util.sequence.BasedSequence> |
getCurrentText() |
com.vladsch.flexmark.ast.Document |
getDocument() |
int |
getIndex() |
com.vladsch.flexmark.util.sequence.BasedSequence |
getInput() |
Bracket |
getLastBracket() |
Delimiter |
getLastDelimiter() |
InlineParserOptions |
getOptions() |
Parsing |
getParsing() |
void |
initializeDocument(Parsing parsing,
com.vladsch.flexmark.ast.Document document) |
com.vladsch.flexmark.util.sequence.BasedSequence |
match(Pattern re)
If RE matches at current index in the input, advance index and return the match; otherwise return null.
|
Matcher |
matcher(Pattern re)
If RE matches at current index in the input, advance index and return the match; otherwise return null.
|
com.vladsch.flexmark.util.sequence.BasedSequence[] |
matchWithGroups(Pattern re)
If RE matches at current index in the input, advance index and return the match; otherwise return null.
|
void |
mergeIfNeeded(Text first,
Text last) |
void |
mergeTextNodes(com.vladsch.flexmark.ast.Node fromNode,
com.vladsch.flexmark.ast.Node toNode) |
void |
moveNodes(com.vladsch.flexmark.ast.Node fromNode,
com.vladsch.flexmark.ast.Node toNode) |
boolean |
nonIndentSp()
Parse zero or more non-indent spaces
|
void |
parse(com.vladsch.flexmark.util.sequence.BasedSequence content,
com.vladsch.flexmark.ast.Node block)
Parse content in block into inline children, using reference map to resolve references.
|
boolean |
parseAutolink()
Attempt to parse an autolink (URL or email in pointy brackets).
|
protected boolean |
parseBackslash()
Parse a backslash-escaped special character, adding either the escaped character, a hard line break
(if the backslash is followed by a newline), or a literal backslash to the block's children.
|
protected boolean |
parseBackticks()
Attempt to parse backticks, adding either a backtick code span or a literal sequence of backticks.
|
protected boolean |
parseBang()
If next character is [, and ! delimiter to delimiter stack and add a text node to block's children.
|
protected boolean |
parseCloseBracket()
Try to match close bracket against an opening in the delimiter stack.
|
List<com.vladsch.flexmark.ast.Node> |
parseCustom(com.vladsch.flexmark.util.sequence.BasedSequence input,
com.vladsch.flexmark.ast.Node node,
BitSet customCharacters,
Map<Character,CharacterNodeFactory> nodeFactoryMap) |
protected boolean |
parseDelimiters(DelimiterProcessor delimiterProcessor,
char delimiterChar)
Attempt to parse delimiters like emphasis, strong emphasis or custom delimiters.
|
boolean |
parseEntity()
Attempt to parse an entity, return Entity object if successful.
|
boolean |
parseHtmlInline()
Attempt to parse inline HTML.
|
protected boolean |
parseInline()
Parse the next inline element in subject, advancing input index.
|
com.vladsch.flexmark.util.sequence.BasedSequence |
parseLinkDestination()
Attempt to parse link destination,
|
int |
parseLinkLabel()
Attempt to parse a link label
|
com.vladsch.flexmark.util.sequence.BasedSequence |
parseLinkTitle()
Attempt to parse link title (sans quotes),
|
boolean |
parseNewline()
Parse a newline.
|
protected boolean |
parseOpenBracket()
Add open bracket to delimiter stack and add a text node to block's children.
|
protected int |
parseReference(com.vladsch.flexmark.ast.Block block,
com.vladsch.flexmark.util.sequence.BasedSequence s)
Attempt to parse a reference definition, modifying the internal reference map.
|
protected boolean |
parseString()
Parse a run of ordinary characters, or a single character with a special meaning in markdown, as a plain string.
|
char |
peek() |
char |
peek(int ahead) |
int |
preProcessBlock(Paragraph block,
ParserState state)
Process Paragraph Content on closing of the paragraph block to removeIndex non-text lines.
|
void |
processDelimiters(Delimiter stackBottom) |
void |
removeDelimiter(Delimiter delim) |
void |
removeDelimiterAndNode(Delimiter delim)
Remove the delimiter and the corresponding text node.
|
void |
removeDelimiterKeepNode(Delimiter delim)
Remove the delimiter but keep the corresponding node as text.
|
void |
removeDelimitersBetween(Delimiter opener,
Delimiter closer) |
protected com.vladsch.flexmark.internal.InlineParserImpl.DelimiterData |
scanDelimiters(DelimiterProcessor delimiterProcessor,
char delimiterChar)
Scan a sequence of characters with code delimiterChar, and return information about the number of delimiters
and whether they are positioned such that they can open and/or close emphasis or strong emphasis.
|
void |
setIndex(int index) |
boolean |
sp()
Parse zero or more spaces
|
boolean |
spnl()
Parse zero or more space characters, including at most one newline and zero or more spaces.
|
boolean |
spnlUrl()
Parse zero or more space characters, including at one newline.
|
com.vladsch.flexmark.util.sequence.BasedSequence |
toEOL()
Parse to end of line, including EOL
|
protected final BitSet originalSpecialCharacters
protected final BitSet delimiterCharacters
protected final Map<Character,DelimiterProcessor> delimiterProcessors
protected final LinkRefProcessorData linkRefProcessorsData
protected List<LinkRefProcessor> linkRefProcessors
protected Map<Character,List<InlineParserExtension>> inlineParserExtensions
protected List<InlineParserExtensionFactory> inlineParserExtensionFactories
protected BitSet specialCharacters
protected BitSet customCharacters
protected Map<Character,CharacterNodeFactory> customSpecialCharacterFactoryMap
protected ArrayList<com.vladsch.flexmark.ast.Node> customSpecialCharacterNodes
protected ReferenceRepository referenceRepository
protected com.vladsch.flexmark.ast.Node block
protected com.vladsch.flexmark.util.sequence.BasedSequence input
protected int index
protected Delimiter lastDelimiter
protected ArrayList<com.vladsch.flexmark.util.sequence.BasedSequence> currentText
protected com.vladsch.flexmark.ast.Document document
protected final InlineParserOptions options
protected Parsing myParsing
public InlineParserImpl(com.vladsch.flexmark.util.options.DataHolder options,
BitSet specialCharacters,
BitSet delimiterCharacters,
Map<Character,DelimiterProcessor> delimiterProcessors,
LinkRefProcessorData linkRefProcessorsData,
List<InlineParserExtensionFactory> inlineParserExtensionFactories)
public static Map<Character,List<InlineParserExtensionFactory>> calculateInlineParserExtensions(com.vladsch.flexmark.util.options.DataHolder options, List<InlineParserExtensionFactory> extensionFactories)
public void initializeDocument(Parsing parsing, com.vladsch.flexmark.ast.Document document)
initializeDocument in interface InlineParserpublic void finalizeDocument(com.vladsch.flexmark.ast.Document document)
finalizeDocument in interface InlineParserpublic ArrayList<com.vladsch.flexmark.util.sequence.BasedSequence> getCurrentText()
public static BitSet calculateDelimiterCharacters(com.vladsch.flexmark.util.options.DataHolder options, Set<Character> characters)
public static BitSet calculateSpecialCharacters(com.vladsch.flexmark.util.options.DataHolder options, BitSet delimiterCharacters)
public static Map<Character,DelimiterProcessor> calculateDelimiterProcessors(com.vladsch.flexmark.util.options.DataHolder options, List<DelimiterProcessor> delimiterProcessors)
public static LinkRefProcessorData calculateLinkRefProcessors(com.vladsch.flexmark.util.options.DataHolder options, List<LinkRefProcessorFactory> linkRefProcessors)
public com.vladsch.flexmark.util.sequence.BasedSequence getInput()
getInput in interface InlineParserpublic int getIndex()
getIndex in interface InlineParserpublic void setIndex(int index)
setIndex in interface InlineParserpublic Delimiter getLastDelimiter()
getLastDelimiter in interface InlineParserpublic Bracket getLastBracket()
getLastBracket in interface InlineParserpublic com.vladsch.flexmark.ast.Document getDocument()
getDocument in interface InlineParserpublic InlineParserOptions getOptions()
getOptions in interface InlineParserpublic Parsing getParsing()
getParsing in interface InlineParserpublic com.vladsch.flexmark.ast.Node getBlock()
getBlock in interface InlineParserpublic List<com.vladsch.flexmark.ast.Node> parseCustom(com.vladsch.flexmark.util.sequence.BasedSequence input, com.vladsch.flexmark.ast.Node node, BitSet customCharacters, Map<Character,CharacterNodeFactory> nodeFactoryMap)
parseCustom in interface InlineParserpublic void parse(com.vladsch.flexmark.util.sequence.BasedSequence content,
com.vladsch.flexmark.ast.Node block)
parse in interface InlineParsercontent - the content to parse as inlineblock - the node to append resulting nodes to (as children)public void mergeTextNodes(com.vladsch.flexmark.ast.Node fromNode,
com.vladsch.flexmark.ast.Node toNode)
mergeTextNodes in interface InlineParserpublic void mergeIfNeeded(Text first, Text last)
mergeIfNeeded in interface InlineParserpublic int preProcessBlock(Paragraph block, ParserState state)
ParagraphPreProcessorThis is used by extensions to take leading lines from a paragraph and convert them to other blocks by Default leading lines that define references are removed and Reference nodes are inserted before.
preProcessBlock in interface ParagraphPreProcessorblock - paragraph node to processstate - parser statepublic void moveNodes(com.vladsch.flexmark.ast.Node fromNode,
com.vladsch.flexmark.ast.Node toNode)
moveNodes in interface InlineParserprotected int parseReference(com.vladsch.flexmark.ast.Block block,
com.vladsch.flexmark.util.sequence.BasedSequence s)
block - the block whose text is being parsed for referencess - sequence of the blocks characters0 if nonepublic void appendText(com.vladsch.flexmark.util.sequence.BasedSequence text)
public void appendText(com.vladsch.flexmark.util.sequence.BasedSequence text,
int beginIndex,
int endIndex)
appendText in interface InlineParserpublic void appendNode(com.vladsch.flexmark.ast.Node node)
appendNode in interface InlineParserpublic Text appendSeparateText(com.vladsch.flexmark.util.sequence.BasedSequence text)
appendSeparateText in interface InlineParserpublic boolean flushTextNode()
flushTextNode in interface InlineParserprotected boolean parseInline()
public com.vladsch.flexmark.util.sequence.BasedSequence match(Pattern re)
match in interface InlineParserre - pattern to matchpublic com.vladsch.flexmark.util.sequence.BasedSequence[] matchWithGroups(Pattern re)
matchWithGroups in interface InlineParserre - pattern to matchpublic Matcher matcher(Pattern re)
matcher in interface InlineParserre - pattern to matchpublic char peek()
peek in interface InlineParser'\0' in case there are no more characters.public char peek(int ahead)
peek in interface InlineParserpublic boolean spnl()
spnl in interface InlineParserpublic boolean nonIndentSp()
nonIndentSp in interface InlineParserpublic boolean sp()
sp in interface InlineParserpublic boolean spnlUrl()
spnlUrl in interface InlineParserpublic com.vladsch.flexmark.util.sequence.BasedSequence toEOL()
toEOL in interface InlineParserpublic boolean parseNewline()
parseNewline in interface InlineParserprotected boolean parseBackslash()
protected boolean parseBackticks()
protected boolean parseDelimiters(DelimiterProcessor delimiterProcessor, char delimiterChar)
delimiterProcessor - delimiter processor instancedelimiterChar - delimiter character being processedprotected boolean parseOpenBracket()
protected boolean parseBang()
protected boolean parseCloseBracket()
Also handles custom link ref processing
protected static boolean containsLinkRefs(com.vladsch.flexmark.util.sequence.BasedSequence nodeChars,
com.vladsch.flexmark.ast.Node next,
Boolean isDefined)
protected static void collapseLinkRefChildren(com.vladsch.flexmark.ast.Node node,
Boolean isTentative)
public com.vladsch.flexmark.util.sequence.BasedSequence parseLinkDestination()
parseLinkDestination in interface InlineParserpublic com.vladsch.flexmark.util.sequence.BasedSequence parseLinkTitle()
parseLinkTitle in interface InlineParserpublic int parseLinkLabel()
parseLinkLabel in interface InlineParserpublic boolean parseAutolink()
parseAutolink in interface InlineParserpublic boolean parseHtmlInline()
parseHtmlInline in interface InlineParserpublic boolean parseEntity()
parseEntity in interface InlineParserprotected boolean parseString()
protected Object clone() throws CloneNotSupportedException
clone in class ObjectCloneNotSupportedExceptionprotected com.vladsch.flexmark.internal.InlineParserImpl.DelimiterData scanDelimiters(DelimiterProcessor delimiterProcessor, char delimiterChar)
delimiterProcessor - delimiter processor instancedelimiterChar - delimiter character being scannednullpublic void processDelimiters(Delimiter stackBottom)
processDelimiters in interface InlineParserpublic void removeDelimitersBetween(Delimiter opener, Delimiter closer)
removeDelimitersBetween in interface InlineParserpublic void removeDelimiterAndNode(Delimiter delim)
removeDelimiterAndNode in interface InlineParserdelim - delimiter to removepublic void removeDelimiterKeepNode(Delimiter delim)
removeDelimiterKeepNode in interface InlineParserdelim - delimiter being processedpublic void removeDelimiter(Delimiter delim)
removeDelimiter in interface InlineParserCopyright © 2018. All rights reserved.