Ë
    mƒc¿5  ã                   ó~   — d dl mZmZmZmZ d dlmZ dd„Zd„ Zdd„Z	dd„Z
d„ Zd„ Zdd	„Zdd
„Zdd„Zdd„Zd„ Zd„ Zy)é   )ÚAtRuleÚDeclarationÚ
ParseErrorÚQualifiedRule)Úparse_component_value_listc                 óP   — 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_commentss     ú1/usr/lib/python3/dist-packages/tinycss2/parser.pyÚ_to_token_iteratorr      s$   € ô �%œÔÜ*¨5°-Ó@ˆÜ�‹;Ðó    c                 ó6   — | D ]  }|j                   dvsŒ|c S  y)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Útokens     r   Ú_next_significantr      s%   € ð ò ˆØ�:‰:Ð6Ò6ØŠLñr   c                 ó²   — t        | |«      }t        |«      }t        |«      }|€t        dddd«      S |�"t        |j                  |j                  dd«      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`.

    r   ÚemptyúInput is emptyúextra-inputzGot more than one token)r   r   r   Úsource_lineÚsource_column)r   r   r   ÚfirstÚseconds        r   Úparse_one_component_valuer!   "   sk   € ô    }Ó5€FÜ˜fÓ%€EÜ˜vÓ&€FØ€}Ü˜!˜Q Ð)9Ó:Ð:ØÐÜØ×Ñ × 4Ñ 4°mØ%ó'ð 	'ð ˆr   c                 óh   — t        | |«      }t        |«      }|€t        dddd«      S t        ||«      S )a?  Parse a single :diagram:`declaration`.

    This is used e.g. for a declaration in an `@supports
    <https://drafts.csswg.org/css-conditional/#at-supports>`_ test.

    :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 :class:`~tinycss2.ast.Declaration`
        or :class:`~tinycss2.ast.ParseError`.

    Any whitespace or comment before the ``:`` colon is dropped.

    r   r   r   )r   r   r   Ú_parse_declaration)r   r   r   Úfirst_tokens       r   Úparse_one_declarationr%   >   s?   € ô"    }Ó5€FÜ# FÓ+€KØÐÜ˜!˜Q Ð)9Ó:Ð:Ü˜k¨6Ó2Ð2r   c           	      ó¬  — | }|j                   dk7  r/t        |j                  |j                  dd|j                   z  «      S t	        |«      }|€"t        |j                  |j                  dd«      S |dk7  r/t        |j                  |j                  dd|j                   z  «      S g }d}t        |«      D ][  \  }}|dk(  r
|d	k(  rd
}|}n6|d
k(  r!|j                   dk(  r|j                  dk(  rd}n|j                   dvrd}|j                  |«       Œ] |dk(  r|d…= t        |j                  |j                  |j                  |j                  ||dk(  «      S )a§  Parse a declaration.

    Consume :obj:`tokens` until the end of the declaration or the first error.

    :type first_token: :term:`component value`
    :param first_token: The first component value of the rule.
    :type tokens: :term:`iterator`
    :param tokens: An iterator yielding :term:`component values`.
    :returns:
        A :class:`~tinycss2.ast.Declaration`
        or :class:`~tinycss2.ast.ParseError`.

    ÚidentÚinvalidz.Expected <ident> for declaration name, got %s.Nz,Expected ':' after declaration name, got EOFú:z,Expected ':' after declaration name, got %s.Úvalueú!ÚbangÚ	importantr   )
r   r   r   r   r   Ú	enumerateÚlower_valueÚappendr   r*   )	r$   r   ÚnameÚcolonr*   ÚstateÚir   Úbang_positions	            r   r#   r#   V   sw  € ð €DØ‡y�y�GÒÜ˜$×*Ñ*¨D×,>Ñ,>À	ØJØ ŸI™Iñ&ó'ð 	'ô ˜fÓ%€EØ€}Ü˜$×*Ñ*¨D×,>Ñ,>À	ØHóJð 	Jà	�#ŠÜ˜%×+Ñ+¨U×-@Ñ-@À)ØHØ!ŸJ™Jñ'ó(ð 	(ð €EØ€EÜ˜fÓ%ò 	‰ˆˆ5Ø�GÒ ¨¢ØˆEØ‰MØ�fŠ_ §¡¨wÒ!6Ø×%Ñ%¨Ò4Ø‰EØ�Z‰ZÐ8Ñ8ØˆEØ�‰�UÕð	ð �ÒØ�-‘.Ð!ä�t×'Ñ'¨×);Ñ);¸T¿Z¹ZØ×'Ñ'¨°¸Ñ0DóFð Fr   c                 ón   — g }|D ]  }|dk(  r n|j                  |«       Œ t        | t        |«      «      S )z=Like :func:`_parse_declaration`, but stop at the first ``;``.ú;)r0   r#   r   )r$   r   Úother_declaration_tokensr   s       r   Ú_consume_declaration_in_listr9   ‡   sD   € à!ÐØò /ˆØ�CŠ<ÙØ ×'Ñ'¨Õ.ð/ô ˜k¬4Ð0HÓ+IÓJÐJr   c                 óX  — t        | |«      }g }|D ]–  }|j                  dk(  r|rŒ|j                  |«       Œ'|j                  dk(  r|rŒ9|j                  |«       ŒK|j                  dk(  r|j                  t        ||«      «       Œv|dk7  sŒ||j                  t	        ||«      «       Œ˜ |S )uM  Parse a :diagram:`declaration list` (which may also contain at-rules).

    This is used e.g. for the :attr:`~tinycss2.ast.QualifiedRule.content`
    of a style rule or ``@page`` rule,
    or for the ``style`` attribute of an HTML element.

    In contexts that donâ€™t expect any at-rule,
    all :class:`~tinycss2.ast.AtRule` objects
    should simply be rejected as invalid.

    :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:
        Ignore CSS comments at the top-level of the list.
        If the input is a string, ignore all comments.
    :type skip_whitespace: :obj:`bool`
    :param skip_whitespace:
        Ignore whitespace at the top-level of the list.
        Whitespace is still preserved
        in the :attr:`~tinycss2.ast.Declaration.value` of declarations
        and the :attr:`~tinycss2.ast.AtRule.prelude`
        and :attr:`~tinycss2.ast.AtRule.content` of at-rules.
    :returns:
        A list of
        :class:`~tinycss2.ast.Declaration`,
        :class:`~tinycss2.ast.AtRule`,
        :class:`~tinycss2.ast.Comment` (if ``skip_comments`` is false),
        :class:`~tinycss2.ast.WhitespaceToken`
        (if ``skip_whitespace`` is false),
        and :class:`~tinycss2.ast.ParseError` objects

    r   r   ú
at-keywordr7   )r   r   r0   Ú_consume_at_ruler9   ©r   r   Úskip_whitespacer   Úresultr   s         r   Úparse_declaration_listr@   ‘   sŸ   € ôD    }Ó5€FØ€FØò 
GˆØ�:‰:˜Ò%Ú"Ø—‘˜eÕ$Ø�Z‰Z˜9Ò$Ú Ø—‘˜eÕ$Ø�Z‰Z˜<Ò'Ø�M‰MÔ*¨5°&Ó9Õ:Ø�c‹\Ø�M‰MÔ6°u¸fÓEÕFð
Gð €Mr   c                 óä   — t        | |«      }t        |«      }|€t        dddd«      S t        ||«      }t        |«      }|�/t        |j                  |j
                  dd|j                  z  «      S |S )a¬  Parse a single :diagram:`qualified rule` or :diagram:`at-rule`.

    This would be used e.g. by `insertRule()
    <https://drafts.csswg.org/cssom/#dom-cssstylesheet-insertrule>`_
    in an implementation of CSSOM.

    :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 :class:`~tinycss2.ast.QualifiedRule`,
        :class:`~tinycss2.ast.AtRule`,
        or :class:`~tinycss2.ast.ParseError` objects.

    Any whitespace or comment before or after the rule is dropped.

    r   r   r   r   z4Expected a single rule, got %s after the first rule.)r   r   r   Ú_consume_ruler   r   r   )r   r   r   r   ÚruleÚnexts         r   Úparse_one_rulerE   Ã   s‚   € ô(    }Ó5€FÜ˜fÓ%€EØ€}Ü˜!˜Q Ð)9Ó:Ð:ä˜ Ó'€DÜ˜VÓ$€DØÐÜØ×Ñ˜d×0Ñ0°-ØBÀTÇYÁYÑNóPð 	Pð €Kr   c                 óö   — t        | |«      }g }|D ]e  }|j                  dk(  r|rŒ|j                  |«       Œ'|j                  dk(  r|rŒ9|j                  |«       ŒK|j                  t        ||«      «       Œg |S )a§  Parse a non-top-level :diagram:`rule list`.

    This is used for parsing the :attr:`~tinycss2.ast.AtRule.content`
    of nested rules like ``@media``.
    This differs from :func:`parse_stylesheet` in that
    top-level ``<!--`` and ``-->`` tokens are not ignored.

    :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:
        Ignore CSS comments at the top-level of the list.
        If the input is a string, ignore all comments.
    :type skip_whitespace: :obj:`bool`
    :param skip_whitespace:
        Ignore whitespace at the top-level of the list.
        Whitespace is still preserved
        in the :attr:`~tinycss2.ast.QualifiedRule.prelude`
        and the :attr:`~tinycss2.ast.QualifiedRule.content` of rules.
    :returns:
        A list of
        :class:`~tinycss2.ast.QualifiedRule`,
        :class:`~tinycss2.ast.AtRule`,
        :class:`~tinycss2.ast.Comment` (if ``skip_comments`` is false),
        :class:`~tinycss2.ast.WhitespaceToken`
        (if ``skip_whitespace`` is false),
        and :class:`~tinycss2.ast.ParseError` objects.

    r   r   ©r   r   r0   rB   r=   s         r   Úparse_rule_listrH   å   st   € ô<    }Ó5€FØ€FØò 8ˆØ�:‰:˜Ò%Ú"Ø—‘˜eÕ$Ø�Z‰Z˜9Ò$Ú Ø—‘˜eÕ$à�M‰Mœ-¨¨vÓ6Õ7ð8ð €Mr   c                 ó   — t        | |«      }g }|D ]j  }|j                  dk(  r|rŒ|j                  |«       Œ'|j                  dk(  r|rŒ9|j                  |«       ŒK|dvsŒP|j                  t        ||«      «       Œl |S )a²  Parse :diagram:`stylesheet` from text.

    This is used e.g. for a ``<style>`` HTML element.

    This differs from :func:`parse_rule_list` in that
    top-level ``<!--`` and ``-->`` tokens are ignored.
    This is a legacy quirk for the ``<style>`` HTML element.

    :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:
        Ignore CSS comments at the top-level of the stylesheet.
        If the input is a string, ignore all comments.
    :type skip_whitespace: :obj:`bool`
    :param skip_whitespace:
        Ignore whitespace at the top-level of the stylesheet.
        Whitespace is still preserved
        in the :attr:`~tinycss2.ast.QualifiedRule.prelude`
        and the :attr:`~tinycss2.ast.QualifiedRule.content` of rules.
    :returns:
        A list of
        :class:`~tinycss2.ast.QualifiedRule`,
        :class:`~tinycss2.ast.AtRule`,
        :class:`~tinycss2.ast.Comment` (if ``skip_comments`` is false),
        :class:`~tinycss2.ast.WhitespaceToken`
        (if ``skip_whitespace`` is false),
        and :class:`~tinycss2.ast.ParseError` objects.

    r   r   )z<!--z-->rG   r=   s         r   Úparse_stylesheetrJ     s|   € ô>    }Ó5€FØ€FØò 8ˆØ�:‰:˜Ò%Ú"Ø—‘˜eÕ$Ø�Z‰Z˜9Ò$Ú Ø—‘˜eÕ$Ø˜/Ò)Ø�M‰Mœ-¨¨vÓ6Õ7ð8ð €Mr   c                 ód  — | j                   dk(  rt        | |«      S | j                   dk(  rg }| }nV| g}|D ]&  }|j                   dk(  r|} n;|j                  |«       Œ( t        |d   j                  |d   j
                  dd«      S t        | j                  | j
                  ||j                  «      S )aÈ  Parse a qualified rule or at-rule.

    Consume just enough of :obj:`tokens` for this rule.

    :type first_token: :term:`component value`
    :param first_token: The first component value of the rule.
    :type tokens: :term:`iterator`
    :param tokens: An iterator yielding :term:`component values`.
    :returns:
        A :class:`~tinycss2.ast.QualifiedRule`,
        :class:`~tinycss2.ast.AtRule`,
        or :class:`~tinycss2.ast.ParseError`.

    r;   ú{} blockéÿÿÿÿr(   z1EOF reached before {} block for a qualified rule.)r   r<   r0   r   r   r   r   Úcontent)r$   r   ÚpreludeÚblockr   s        r   rB   rB   >  sÆ   € ð ×Ñ˜<Ò'Ü ¨VÓ4Ð4Ø×Ñ˜:Ò%ØˆØ‰à�-ˆØò 	EˆEØ�z‰z˜ZÒ'Ø�ÙØ�N‰N˜5Õ!ð		Eô Ø˜‘×'Ñ'¨°©×)BÑ)BÀIØCóEð Eô ˜×0Ñ0°+×2KÑ2KØ  %§-¡-ó1ð 1r   c                 óò   — g }d}|D ]7  }|j                   dk(  r|j                  } n|dk(  r n|j                  |«       Œ9 t        | j                  | j
                  | j                  | j                  ||«      S )a•  Parse an at-rule.

    Consume just enough of :obj:`tokens` for this rule.

    :type at_keyword: :class:`AtKeywordToken`
    :param at_keyword: The at-rule keyword token starting this rule.
    :type tokens: :term:`iterator`
    :param tokens: An iterator yielding :term:`component values`.
    :returns:
        A :class:`~tinycss2.ast.QualifiedRule`,
        or :class:`~tinycss2.ast.ParseError`.

    NrL   r7   )r   rN   r0   r   r   r   r*   r/   )Ú
at_keywordr   rO   rN   r   s        r   r<   r<   a  s�   € ð €GØ€GØò ˆØ�:‰:˜Ò#Ø—m‘mˆGÙØ�cŠ\ÙØ�‰�uÕðô �*×(Ñ(¨*×*BÑ*BØ×"Ñ" J×$:Ñ$:¸GÀWóNð Nr   N)F)FF)Úastr   r   r   r   Ú	tokenizerr   r   r   r!   r%   r#   r9   r@   rE   rH   rJ   rB   r<   © r   r   ú<module>rV      sS   ðß ?Ó ?Ý 1óò 
óó83ò0.FòbKó/ódóD)óX*òZ 1óFNr   