type

DelimiterProcessor

src @Js
const mixin DelimiterProcessor

Custom delimiter processor for additional delimiters besides _ and *.

Note that implementations of this need to be thread-safe, the same instance may be used by multiple parsers.

methods

closingChar

The character that marks the ending of a delimited node, must not clas with any built-in special characters.

minLen

Minimum number of delimiter characters that are needed to activate this.

openingChar

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

process

Process the delimiter runs.

Slot Details

closingChar

src abstract Int closingChar()

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

minLen

src abstract Int minLen()

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

openingChar

src abstract Int openingChar()

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

process

src abstract Int process(Delimiter openingRun, Delimiter closingRun)

Process the delimiter runs.

The processor can examine the runs and the nodes and decide if it wants to process or not. If not, it should not change any nodes and return 0. If yes, it should do the processing (wrapping nodes, etc.) and then return how many delimiters were used.

Note that removal (unlinking) of the used delimiter Text nodes is done by the caller.

Returns how many delimiters were used; must not be greater than the length of either opener or closer