�
��g
� �b � d Z ddlZddlmZ ddlmZ ej dej � � Zd� Z d� Z
dS )z5
A few practical conventions common to all printers.
� N)�Iterable)�
Derivativez^([^\W\d_]+)(\d+)$c � � | s| g g fS d}d}g }g }|t | � � k �rN|dz }| ||dz � dk r|dz
}| � d|� � }|dk rt | � � }| � d|� � }|dk rt | � � }t ||� � }| ||� } |}|�| }n�| � d� � r|� | dd� � � nu| � d� � r|� | dd� � � nB| � d� � r|� | dd� � � nt d� � �|t | � � k ��Nt � |� � }
|
r-|
� � � \ }}|� d|� � |||fS ) a| Split a symbol name into a name, superscripts and subscripts
The first part of the symbol name is considered to be its actual
'name', followed by super- and subscripts. Each superscript is
preceded with a "^" character or by "__". Each subscript is preceded
by a "_" character. The three return values are the actual name, a
list with superscripts and a list with subscripts.
Examples
========
>>> from sympy.printing.conventions import split_super_sub
>>> split_super_sub('a_x^1')
('a', ['1'], ['x'])
>>> split_super_sub('var_sub1__sup_sub2')
('var', ['sup'], ['sub1', 'sub2'])
r N� � �__�^�_zThis should never happen.)
�len�find�min�
startswith�append�RuntimeError�_name_with_digits_p�match�groups�insert)�text�pos�name�supers�subs�start�pos_hat�pos_usc�pos_next�part�m�subs �j/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/sympy/printing/conventions.py�split_super_subr"