File: //home/arjun/projects/env/lib64/python3.10/site-packages/tinycss2/__pycache__/nth.cpython-310.pyc
o
we�
� @ sF d dl Z ddlmZmZ dd� Zdd� Zdd � Zd
d� Ze �d�Z dS )
� N� )�_next_significant�_to_token_iteratorc C s
t | dd�}t|�}|du rdS |j}|dkr!|jr!t|d|j�S |dkrU|jrU|j}|dkr5t||j�S |dkr@t||jd �S t �
|�}|rSt||jt|�d
���S dS |dkr�|j
}|dkrft|d
d�S |dkrpt|d
d
�S |dkryt|d
�S |dkr�t|d �S |dkr�t|d
d �S |dkr�t|d d �S |d dkr�t �
|d
d� �}|r�t|d t|�d
���S dS t �
|�}|r�t|d
t|�d
���S dS |dkr�t|�}|jdk�r|j
}|dkr�t|d
�S |dkr�t|d
d �S t �
|�}|�rt|d
t|�d
���S dS dS dS )aF Parse `<An+B> <https://drafts.csswg.org/css-syntax-3/#anb>`_,
as found in `:nth-child()
<https://drafts.csswg.org/selectors/#nth-child-pseudo>`_
and related Selector pseudo-classes.
Although tinycss2 does not include a full Selector parser,
this bit of syntax is included as it is particularly tricky to define
on top of a CSS tokenizer.
:type input: :obj:`str` or :term:`iterable`
:param input: A string or an iterable of :term:`component values`.
:returns:
A ``(a, b)`` tuple of integers, or :obj:`None` if the input is invalid.
T)�
skip_commentsN�numberr � dimension�nzn-���r �ident�even� �oddz-nz-n-�-�+)r r �type�
is_integer� parse_end� int_value�
lower_unit�parse_b�parse_signless_b�N_DASH_DIGITS_RE�match�int�group�lower_value�next)�input�tokens�token�
token_type�unitr r
� r"