File: //home/arjun/projects/env/lib/python3.10/site-packages/tinycss2/__pycache__/parser.cpython-310.pyc
o
we�5 � @ s� d dl mZmZmZmZ d dlmZ ddd�Zdd� Zddd �Z dd
d�Z
dd
� Zdd� Zddd�Z
ddd�Zddd�Zddd�Zdd� Zdd� ZdS )� )�AtRule�Declaration�
ParseError�
QualifiedRule)�parse_component_value_listFc C s t | t�r
t| |�} t| �S )aq Iterate component values out of string or component values iterable.
:type input: :obj:`str` or :term:`iterable`
:param input: A string or an iterable of :term:`component values`.
:type skip_comments: :obj:`bool`
:param skip_comments: If the input is a string, ignore all CSS comments.
:returns: An iterator yielding :term:`component values`.
)�
isinstance�strr �iter)�input�
skip_comments� r �H/home/arjun/projects/env/lib/python3.10/site-packages/tinycss2/parser.py�_to_token_iterator s
r c C s | D ]}|j dvr
| S qdS )z�Return the next significant (neither whitespace or comment) token.
:type tokens: :term:`iterator`
:param tokens: An iterator yielding :term:`component values`.
:returns: A :term:`component value`, or :obj:`None`.
��
whitespace�commentN)�type)�tokens�tokenr r r
�_next_significant s
��r c C sN t | |�}t|�}t|�}|du rtdddd�S |dur%t|j|jdd�S |S )a� Parse a single :diagram:`component value`.
This is used e.g. for an attribute value
referred to by ``attr(foo length)``.
:type input: :obj:`str` or :term:`iterable`
:param input: A string or an iterable of :term:`component values`.
:type skip_comments: :obj:`bool`
:param skip_comments: If the input is a string, ignore all CSS comments.
:returns:
A :term:`component value` (that is neither whitespace or comment),
or a :class:`~tinycss2.ast.ParseError`.
Nr �empty�Input is empty�extra-inputzGot more than one token)r r r �source_line�
source_column)r
r r �first�secondr r r
�parse_one_component_value"