3
[_ð]  ã               @   s   d Z ddlZdd„ ZdS )zDNS GENERATE range conversion.é    Nc             C   sô   d}d}d}| r(| d dkr(t jjdƒ‚xj| D ]b}|dkrT|dkrTt|ƒ}d}d}q.|dkrnt|ƒ}d}d}q.|jƒ r€||7 }q.t jjd	| ƒ‚q.W |dkr¦t jjƒ ‚|dkr¶t|ƒ}|dkrÆt|ƒ}|dksÒt‚|dksÞt‚||ksêt‚|||fS )zÜConvert the text form of a range in a ``$GENERATE`` statement to an
    integer.

    *text*, a ``str``, the textual range in ``$GENERATE`` form.

    Returns a tuple of three ``int`` values ``(start, stop, step)``.
    é   Ú r   ú-z!Start cannot be a negative numberé   ú/é   zCould not parse %sé   )r   r   )ÚdnsÚ	exceptionÚSyntaxErrorÚintÚisdigitÚAssertionError)ÚtextÚstepÚcurÚstateÚcÚstartÚstop© r   ú//tmp/pip-build-yz_zf6az/dnspython/dns/grange.pyÚ	from_text   s6    



r   )Ú__doc__r	   r   r   r   r   r   Ú<module>   s   