DelimiterProcessor

Custom delimiter processor for additional delimiters besides {@code _} and {@code *}. <p> Note that implementations of this need to be thread-safe, the same instance may be used by multiple parsers.

Members

Functions

getClosingCharacter
char getClosingCharacter()

@return the character that marks the the ending of a delimited node, must not clash with any built-in special characters. Note that for a symmetric delimiter such as "*", this is the same as the opening.

getDelimiterUse
int getDelimiterUse(DelimiterRun opener, DelimiterRun closer)

Determine how many (if any) of the delimiter characters should be used. <p> 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.

getMinLength
int getMinLength()

Minimum number of delimiter characters that are needed to activate this. Must be at least 1.

getOpeningCharacter
char getOpeningCharacter()

@return the character that marks the beginning of a delimited node, must not clash with any built-in special characters

process
void process(Text opener, Text closer, int delimiterUse)

Process the matched delimiters, e.g. by wrapping the nodes between opener and closer in a new node, or appending a new node after the opener. <p> Note that removal of the delimiter from the delimiter nodes and unlinking them is done by the caller.

Meta