# Path: mistletoe/span_token.py
# def tokenize_inner(content):
# def add_token(token_cls, position=1):
# def remove_token(token_cls):
# def reset_tokens():
#     def __init__(self, match):
#     def __contains__(self, text):
#     def find(cls, string):
#     def __new__(self, match):
#     def find(cls, string):
#     def __init__(self, match):
#     def find(cls, string):
#     def __init__(self, match):
#     def __init__(self, match):
#     def __init__(self, match):
#     def __init__(self, match):
#     def strip(cls, string):
#     def __init__(self, match):
#     def __init__(self, content):
# class SpanToken:
# class CoreTokens(SpanToken):
# class Strong(SpanToken):
# class Emphasis(SpanToken):
# class InlineCode(SpanToken):
# class Strikethrough(SpanToken):
# class Image(SpanToken):
# class Link(SpanToken):
# class AutoLink(SpanToken):
# class EscapeSequence(SpanToken):
# class LineBreak(SpanToken):
# class RawText(SpanToken):
# class HTMLSpan(SpanToken):
# class XWikiBlockMacroStart(SpanToken):
# class XWikiBlockMacroEnd(SpanToken):
# 
# Path: mistletoe/core_tokens.py
# def find_core_tokens(string, root):
# def find_link_image(string, offset, delimiters, matches, root=None):
# def process_emphasis(string, stack_bottom, delimiters, matches):
# def match_link_image(string, offset, delimiter, root=None):
# def match_link_dest(string, offset):
# def match_link_title(string, offset):
# def match_link_label(string, offset, root=None):
# def is_link_label(text, root):
# def normalize_label(text):
# def next_closer(curr_pos, delimiters):
# def matching_opener(curr_pos, delimiters, bottom):
# def is_opener(start, end, string):
# def is_closer(start, end, string):
# def is_left_delimiter(start, end, string):
# def is_right_delimiter(start, end, string):
# def preceded_by(start, string, charset):
# def succeeded_by(end, string, charset):
# def is_control_char(char):
# def follows(string, index, char):
# def shift_whitespace(string, index):
# def deactivate_delimiters(delimiters, index, delimiter_type):
#     def __init__(self, start, end, string):
#     def remove(self, n, left=True):
#     def closed_by(self, other):
#     def __repr__(self):
#     def __init__(self, start, end, *fields):
#     def start(self, n=0):
#     def end(self, n=0):
#     def group(self, n=0):
#     def __repr__(self):
# class Delimiter:
# class MatchObj:


import re
import sys
import mistletoe.block_tokenizer as tokenizer
from itertools import zip_longest
from mistletoe import span_token
from mistletoe.core_tokens import (
        is_link_label,
        follows,
        shift_whitespace,
        whitespace,
        is_control_char,
        normalize_label,
)
    def start(cls, line):
        return line.lstrip().startswith('[')

    @classmethod
    def read(cls, lines):
        line_buffer = []
        next_line = lines.peek()
        while next_line is not None and next_line.strip() != '':
            line_buffer.append(next(lines))
            next_line = lines.peek()
        string = ''.join(line_buffer)
        offset = 0
        matches = []
        while offset < len(string) - 1:
            match_info = cls.match_reference(lines, string, offset)
            if match_info is None:
                break
            offset, match = match_info
            matches.append(match)
        cls.append_footnotes(matches, _root_node)
        return matches or None

    @classmethod
    def match_reference(cls, lines, string, offset):
        match_info = cls.match_link_label(string, offset)
        if not match_info:
            cls.backtrack(lines, string, offset)
            return None
        _, label_end, label = match_info


# Path: mistletoe/span_token.py
# def tokenize_inner(content):
# def add_token(token_cls, position=1):
# def remove_token(token_cls):
# def reset_tokens():
#     def __init__(self, match):
#     def __contains__(self, text):
#     def find(cls, string):
#     def __new__(self, match):
#     def find(cls, string):
#     def __init__(self, match):
#     def find(cls, string):
#     def __init__(self, match):
#     def __init__(self, match):
#     def __init__(self, match):
#     def __init__(self, match):
#     def strip(cls, string):
#     def __init__(self, match):
#     def __init__(self, content):
# class SpanToken:
# class CoreTokens(SpanToken):
# class Strong(SpanToken):
# class Emphasis(SpanToken):
# class InlineCode(SpanToken):
# class Strikethrough(SpanToken):
# class Image(SpanToken):
# class Link(SpanToken):
# class AutoLink(SpanToken):
# class EscapeSequence(SpanToken):
# class LineBreak(SpanToken):
# class RawText(SpanToken):
# class HTMLSpan(SpanToken):
# class XWikiBlockMacroStart(SpanToken):
# class XWikiBlockMacroEnd(SpanToken):
# 
# Path: mistletoe/core_tokens.py
# def find_core_tokens(string, root):
# def find_link_image(string, offset, delimiters, matches, root=None):
# def process_emphasis(string, stack_bottom, delimiters, matches):
# def match_link_image(string, offset, delimiter, root=None):
# def match_link_dest(string, offset):
# def match_link_title(string, offset):
# def match_link_label(string, offset, root=None):
# def is_link_label(text, root):
# def normalize_label(text):
# def next_closer(curr_pos, delimiters):
# def matching_opener(curr_pos, delimiters, bottom):
# def is_opener(start, end, string):
# def is_closer(start, end, string):
# def is_left_delimiter(start, end, string):
# def is_right_delimiter(start, end, string):
# def preceded_by(start, string, charset):
# def succeeded_by(end, string, charset):
# def is_control_char(char):
# def follows(string, index, char):
# def shift_whitespace(string, index):
# def deactivate_delimiters(delimiters, index, delimiter_type):
#     def __init__(self, start, end, string):
#     def remove(self, n, left=True):
#     def closed_by(self, other):
#     def __repr__(self):
#     def __init__(self, start, end, *fields):
#     def start(self, n=0):
#     def end(self, n=0):
#     def group(self, n=0):
#     def __repr__(self):
# class Delimiter:
# class MatchObj:


# Path: mistletoe/block_token.py
import re
import sys
import mistletoe.block_tokenizer as tokenizer
from itertools import zip_longest
from mistletoe import span_token
from mistletoe.core_tokens import (
        is_link_label,
        follows,
        shift_whitespace,
        whitespace,
        is_control_char,
        normalize_label,
)

    def start(cls, line):
        return line.lstrip().startswith('[')

    @classmethod
    def read(cls, lines):
        line_buffer = []
        next_line = lines.peek()
        while next_line is not None and next_line.strip() != '':
            line_buffer.append(next(lines))
            next_line = lines.peek()
        string = ''.join(line_buffer)
        offset = 0
        matches = []
        while offset < len(string) - 1:
            match_info = cls.match_reference(lines, string, offset)
            if match_info is None:
                break
            offset, match = match_info
            matches.append(match)
        cls.append_footnotes(matches, _root_node)
        return matches or None

    @classmethod
    def match_reference(cls, lines, string, offset):
        match_info = cls.match_link_label(string, offset)
        if not match_info:
            cls.backtrack(lines, string, offset)
            return None
        _, label_end, label = match_info


        if not follows(string, label_end-1, ':'):