public interface DelimiterProcessor
_ and *.
Note that implementations of this need to be thread-safe, the same instance may be used by multiple parsers.
| Modifier and Type | Method and Description |
|---|---|
boolean |
canBeCloser(String before,
String after,
boolean leftFlanking,
boolean rightFlanking,
boolean beforeIsPunctuation,
boolean afterIsPunctuation,
boolean beforeIsWhitespace,
boolean afterIsWhiteSpace)
Decide whether this delimiter can be a close delimiter
|
boolean |
canBeOpener(String before,
String after,
boolean leftFlanking,
boolean rightFlanking,
boolean beforeIsPunctuation,
boolean afterIsPunctuation,
boolean beforeIsWhitespace,
boolean afterIsWhiteSpace)
Decide whether this delimiter can be an open delimiter
|
char |
getClosingCharacter() |
int |
getDelimiterUse(DelimiterRun opener,
DelimiterRun closer)
Determine how many (if any) of the delimiter characters should be used.
|
int |
getMinLength() |
char |
getOpeningCharacter() |
void |
process(Delimiter opener,
Delimiter closer,
int delimitersUsed)
Process the matched delimiters, e.g.
|
boolean |
skipNonOpenerCloser()
Whether to skip delimiters that cannot be openers or closers
|
com.vladsch.flexmark.ast.Node |
unmatchedDelimiterNode(InlineParser inlineParser,
DelimiterRun delimiter)
Allow delimiter processor to substitute unmatched delimiters by custom nodes
|
char getOpeningCharacter()
char getClosingCharacter()
int getMinLength()
int getDelimiterUse(DelimiterRun opener, DelimiterRun closer)
This allows implementations to decide how many characters to use based on the properties of the delimiter runs. An implementation can also return 0 when it doesn't want to allow this particular combination of delimiter runs.
opener - the opening delimiter runcloser - the closing delimiter runvoid process(Delimiter opener, Delimiter closer, int delimitersUsed)
Note that removal of the delimiter from the delimiter nodes and unlinking them is done by the caller.
opener - the delimiter with text node that contained the opening delimitercloser - the delimiter with text node that contained the closing delimiterdelimitersUsed - the number of delimiters that were usedcom.vladsch.flexmark.ast.Node unmatchedDelimiterNode(InlineParser inlineParser, DelimiterRun delimiter)
inlineParser - inline parser instancedelimiter - delimiter run that was not matchedboolean canBeOpener(String before, String after, boolean leftFlanking, boolean rightFlanking, boolean beforeIsPunctuation, boolean afterIsPunctuation, boolean beforeIsWhitespace, boolean afterIsWhiteSpace)
before - string before delimiter or '\n' if noneafter - string after delimiter or '\n' if noneleftFlanking - is left flanking delimiterrightFlanking - is right flanking delimiterbeforeIsPunctuation - is punctuation beforeafterIsPunctuation - is punctuation afterbeforeIsWhitespace - is whitespace beforeafterIsWhiteSpace - is whitespace afterboolean canBeCloser(String before, String after, boolean leftFlanking, boolean rightFlanking, boolean beforeIsPunctuation, boolean afterIsPunctuation, boolean beforeIsWhitespace, boolean afterIsWhiteSpace)
before - string before delimiter or '\n' if noneafter - string after delimiter or '\n' if noneleftFlanking - is left flanking delimiterrightFlanking - is right flanking delimiterbeforeIsPunctuation - is punctuation beforeafterIsPunctuation - is punctuation afterbeforeIsWhitespace - is whitespace beforeafterIsWhiteSpace - is whitespace afterboolean skipNonOpenerCloser()
Copyright © 2018. All rights reserved.