Skip to content

MKLinkScanner

Description

Used internally during parsing to scan links.

Methods

Name Parameters Returns
Constructor
ParseLinkDestination chars() As MKCharacter, pos As Integer, data As Dictionary Boolean
ParseLinkLabel chars() As MKCharacter, pos As Integer, data As Dictionary Boolean
ParseLinkTitle chars() As MKCharacter, startPos As Integer, data As Dictionary Boolean

Method Descriptions

Constructor()

Private to prevent instantation.


ParseLinkDestination(chars() As MKCharacter, pos As Integer, data As Dictionary) As Boolean This method is shared.

Tries to parse a link destination in chars beginning at pos. If able it returns True, updates pos to the character immediately after the destination and populates data.

Sets data.Value("linkDestination") to the link destination (if found). Sets data.Value("linkDestinationLength") to the length of the destination. Note that pos is passed ByRef.

A "link destination" consists of either:

  1. = 0 characters between an opening < and a closing > that contains no line endings or unescaped < or > characters, or

  2. 0 characters that does not start with <, does not include ASCII control characters or space character, and includes parentheses only if: (a) they are backslash-escaped (b) they are part of a balanced pair of unescaped parentheses. At least 3 levels must be supported.


ParseLinkLabel(chars() As MKCharacter, pos As Integer, data As Dictionary) As Boolean This method is shared.

Tries to parse a link label in chars beginning at pos. If able it returns True, updates pos to the end of the label and populates data.

Sets data.Value("linkLabel") to the link label (if found). Sets data.Value("linkLabelStart") to the original pos value. Sets data.Value("linkLabelLength") to the length of the trimmed label before any Sets data.Value("linkLabelStartChar") to the starting character of the label. consecutive internal whitespace is collapsed. Note that pos is passed ByRef.

A "link label" begins with a left bracket ([) and ends with the first right bracket (]) that is not backslash-escaped. Between these brackets there must be at least one character that is not a space, tab, or line ending. Unescaped square bracket characters are not allowed inside the opening and closing square brackets of link labels. A link label can have at most 999 characters inside the square brackets.


ParseLinkTitle(chars() As MKCharacter, startPos As Integer, data As Dictionary) As Boolean This method is shared.

Tries to parse a link title in chars beginning at pos. If able it returns True, updates pos to the end of the link title (the delimiter) and populates data.

Sets data.Value("linkTitle") to the link title (if found). Sets data.Value("linkTitleLength") to the absolute length of the link title (if found). Sets data.Value("linkTitleStart") to the original value of pos. Sets data.Value("linkTitleValid") to False if there is a link title but it is invalid. Note that pos is passed ByRef.

A "link title" consists of either:

  1. = 0 characters between " characters, including a " character only if it is backslash-escaped.

  2. = 0 characters between ' characters, including a ' character only if it is backslash-escaped

  3. = 0 characters between matching parentheses, including a ( or ) only if it's backslash-escaped.