@token('<STR_LIT>')<EOL>def tokenize_math(text):
if text.startswith('<STR_LIT:$>') and (<EOL>text.position == <NUM_LIT:0> or text.peek(-<NUM_LIT:1>) != '<STR_LIT:\\>' or text.endswith(r'<STR_LIT:\\>')):<EOL><INDENT>starter = '<STR_LIT>' if text.startswith('<STR_LIT>') else '<STR_LIT:$>'<EOL>return TokenWithPosition(text.forward(len(starter)), text.position)<EOL><DEDENT>
r"""Prevents math from being tokenized.

    :param Buffer text: iterator over line, with current position

    >>> b = Buffer(r'$\min_x$ \command')
    >>> tokenize_math(b)
    '$'
    >>> b = Buffer(r'$$\min_x$$ \command')
    >>> tokenize_math(b)
    '$$'