Edit File: tokenizer.pyc
� FHSc�����������@���s����d��Z��d�d�l�Z�d�d�l�Z�d�d�l�Z�d�d�l�Z�d�d�l�Z�i�e�d�6e�d�6e�d�6e�d�6e�d�6e�d�6e�d �6Z�i�e�d �6Z �d �Z �d�Z�d�Z�d �Z �d�Z�d�Z�d�Z�d�e�j�j�f�d�������YZ�d�e�f�d�������YZ�d�e�f�d�������YZ�d�S(���s���Tokenize DNS master file formati����Nt��� s��� s��� t���;t���(t���)t���"i����i���i���i���i���i���i���t���UngetBufferFullc�����������B���s���e��Z�d��Z�RS(���sR���Raised when an attempt is made to unget a token when the unget buffer is full.(���t���__name__t ���__module__t���__doc__(����(����(����s3���/usr/lib64/python2.7/site-packages/dns/tokenizer.pyR���,���s���t���Tokenc�����������B���s����e��Z�d��Z�d�e�d���Z�d����Z�d����Z�d����Z�d����Z�d����Z �d����Z �d ����Z�d ����Z�d����Z �d����Z�d ����Z�d����Z�d����Z�d����Z�d����Z�RS(���s����A DNS master file format token. @ivar ttype: The token type @type ttype: int @ivar value: The token value @type value: string @ivar has_escape: Does the token value contain escapes? @type has_escape: bool t����c���������C���s���|�|��_��|�|��_�|�|��_�d�S(���s��Initialize a token instance. @param ttype: The token type @type ttype: int @param value: The token value @type value: string @param has_escape: Does the token value contain escapes? @type has_escape: bool N(���t���ttypet���valuet ���has_escape(���t���selfR���R���R ���(����(����s3���/usr/lib64/python2.7/site-packages/dns/tokenizer.pyt���__init__<���s���� c���������C���s ���|��j��t�k�S(���N(���R���t���EOF(���R���(����(����s3���/usr/lib64/python2.7/site-packages/dns/tokenizer.pyt���is_eofJ���s����c���������C���s ���|��j��t�k�S(���N(���R���t���EOL(���R���(����(����s3���/usr/lib64/python2.7/site-packages/dns/tokenizer.pyt���is_eolM���s����c���������C���s ���|��j��t�k�S(���N(���R���t ���WHITESPACE(���R���(����(����s3���/usr/lib64/python2.7/site-packages/dns/tokenizer.pyt ���is_whitespaceP���s����c���������C���s ���|��j��t�k�S(���N(���R���t ���IDENTIFIER(���R���(����(����s3���/usr/lib64/python2.7/site-packages/dns/tokenizer.pyt ���is_identifierS���s����c���������C���s ���|��j��t�k�S(���N(���R���t ���QUOTED_STRING(���R���(����(����s3���/usr/lib64/python2.7/site-packages/dns/tokenizer.pyt���is_quoted_stringV���s����c���������C���s ���|��j��t�k�S(���N(���R���t���COMMENT(���R���(����(����s3���/usr/lib64/python2.7/site-packages/dns/tokenizer.pyt ���is_commentY���s����c���������C���s ���|��j��t�k�S(���N(���R���t ���DELIMITER(���R���(����(����s3���/usr/lib64/python2.7/site-packages/dns/tokenizer.pyt���is_delimiter\���s����c���������C���s���|��j��t�k�p�|��j��t�k�S(���N(���R���R���R���(���R���(����(����s3���/usr/lib64/python2.7/site-packages/dns/tokenizer.pyt ���is_eol_or_eof_���s����c���������C���s5���t��|�t���s�t�S|��j�|�j�k�o4�|��j�|�j�k�S(���N(���t ���isinstanceR ���t���FalseR���R���(���R���t���other(����(����s3���/usr/lib64/python2.7/site-packages/dns/tokenizer.pyt���__eq__b���s����c���������C���s5���t��|�t���s�t�S|��j�|�j�k�p4�|��j�|�j�k�S(���N(���R���R ���t���TrueR���R���(���R���R!���(����(����s3���/usr/lib64/python2.7/site-packages/dns/tokenizer.pyt���__ne__h���s����c���������C���s���d�|��j��|��j�f�S(���Ns���%d "%s"(���R���R���(���R���(����(����s3���/usr/lib64/python2.7/site-packages/dns/tokenizer.pyt���__str__n���s����c���������C���su��|��j��s �|��Sd�}�t�|��j���}�d�}�x:|�|�k��rd|��j�|�}�|�d�7}�|�d�k�rW|�|�k�ru�t�j�j���n��|��j�|�}�|�d�7}�|�j����rW|�|�k�r��t�j�j���n��|��j�|�}�|�d�7}�|�|�k�r��t�j�j���n��|��j�|�}�|�d�7}�|�j����o|�j����s#t�j�j���n��t�t �|���d�t �|���d�t �|�����}�qWn��|�|�7}�q+�Wt �|��j�|���S(���NR ���i����i���s���\id���i ���(���R ���t���lenR���t���dnst ���exceptiont ���UnexpectedEndt���isdigitt���SyntaxErrort���chrt���intR ���R���(���R���t ���unescapedt���lt���it���ct���c2t���c3(����(����s3���/usr/lib64/python2.7/site-packages/dns/tokenizer.pyt���unescapeq���s6���� 4c���������C���s���d�S(���Ni���(����(���R���(����(����s3���/usr/lib64/python2.7/site-packages/dns/tokenizer.pyt���__len__����s����c���������C���s���t��|��j�|��j�f���S(���N(���t���iterR���R���(���R���(����(����s3���/usr/lib64/python2.7/site-packages/dns/tokenizer.pyt���__iter__����s����c���������C���s0���|�d�k�r�|��j��S|�d�k�r&�|��j�St���d��S(���Ni����i���(���R���R���t ���IndexError(���R���R0���(����(����s3���/usr/lib64/python2.7/site-packages/dns/tokenizer.pyt���__getitem__����s ����(���R���R���R���R ���R���R���R���R���R���R���R���R���R���R"���R$���R%���R4���R5���R7���R9���(����(����(����s3���/usr/lib64/python2.7/site-packages/dns/tokenizer.pyR ���1���s"��� t ���Tokenizerc�����������B���s����e��Z�d��Z�e�j�d�d���Z�d����Z�d����Z�d����Z �d����Z �e�e�d���Z�d����Z �d����Z�d ����Z�d ����Z�d����Z�d����Z�d ����Z�d�d���Z�d�d���Z�d�d���Z�d����Z�d����Z�RS(���s���A DNS master file format tokenizer. A token is a (type, value) tuple, where I{type} is an int, and I{value} is a string. The valid types are EOF, EOL, WHITESPACE, IDENTIFIER, QUOTED_STRING, COMMENT, and DELIMITER. @ivar file: The file to tokenize @type file: file @ivar ungotten_char: The most recently ungotten character, or None. @type ungotten_char: string @ivar ungotten_token: The most recently ungotten token, or None. @type ungotten_token: (int, string) token tuple @ivar multiline: The current multiline level. This value is increased by one every time a '(' delimiter is read, and decreased by one every time a ')' delimiter is read. @type multiline: int @ivar quoting: This variable is true if the tokenizer is currently reading a quoted string. @type quoting: bool @ivar eof: This variable is true if the tokenizer has encountered EOF. @type eof: bool @ivar delimiters: The current delimiter dictionary. @type delimiters: dict @ivar line_number: The current line number @type line_number: int @ivar filename: A filename that will be returned by the L{where} method. @type filename: string c���������C���s����t��|�t���r6�t�j�|���}�|�d�k�rc�d�}�qc�n-�|�d�k�rc�|�t�j�k�rZ�d�}�qc�d�}�n��|�|��_�d�|��_�d�|��_ �d�|��_ �t�|��_�t�|��_ �t�|��_�d�|��_�|�|��_�d�S(���s���Initialize a tokenizer instance. @param f: The file to tokenize. The default is sys.stdin. This parameter may also be a string, in which case the tokenizer will take its input from the contents of the string. @type f: file or string @param filename: the name of the filename that the L{where} method will return. @type filename: string s���<string>s���<stdin>s���<file>i����i���N(���R���t���strt ���cStringIOt���StringIOt���Nonet���syst���stdint���filet ���ungotten_chart���ungotten_tokent ���multilineR ���t���quotingt���eoft���_DELIMITERSt ���delimiterst���line_numbert���filename(���R���t���fRJ���(����(����s3���/usr/lib64/python2.7/site-packages/dns/tokenizer.pyR�������s"���� c���������C���s����|��j��d�k�rl�|��j�r!�d�}�q~�|��j�j�d���}�|�d�k�rK�t�|��_�q~�|�d�k�r~�|��j�d�7_�q~�n�|��j��}�d�|��_��|�S(���s<���Read a character from input. @rtype: string R ���i���s��� N(���RB���R>���RF���RA���t���readR#���RI���(���R���R1���(����(����s3���/usr/lib64/python2.7/site-packages/dns/tokenizer.pyt ���_get_char����s���� c���������C���s���|��j��|��j�f�S(���s����Return the current location in the input. @rtype: (string, int) tuple. The first item is the filename of the input, the second is the current line number. (���RJ���RI���(���R���(����(����s3���/usr/lib64/python2.7/site-packages/dns/tokenizer.pyt���where����s����c���������C���s%���|��j��d�k �r�t���n��|�|��_��d�S(���sE��Unget a character. The unget buffer for characters is only one character large; it is an error to try to unget a character when the unget buffer is not empty. @param c: the character to unget @type c: string @raises UngetBufferFull: there is already an ungotten char N(���RB���R>���R���(���R���R1���(����(����s3���/usr/lib64/python2.7/site-packages/dns/tokenizer.pyt���_unget_char����s���� c���������C���so���d�}�xb�t��rj�|��j����}�|�d�k�r]�|�d�k�r]�|�d�k�sI�|��j�r]�|��j�|���|�Sn��|�d�7}�q �Wd�S(���s(��Consume input until a non-whitespace character is encountered. The non-whitespace character is then ungotten, and the number of whitespace characters consumed is returned. If the tokenizer is in multiline mode, then newlines are whitespace. @rtype: int i����R����s��� s��� i���N(���R#���RM���RD���RO���(���R���t���skippedR1���(����(����s3���/usr/lib64/python2.7/site-packages/dns/tokenizer.pyt���skip_whitespace��s���� c��� ������C���s���|��j��d�k �rZ�|��j��}�d�|��_��|�j����r:�|�rW�|�SqZ�|�j����rS�|�rW�|�SqZ�|�Sn��|��j����}�|�r��|�d�k�r��t�t�d���Sd�}�t�}�t�}�x�t �rA|��j ����}�|�d�k�s��|�|��j�k�r�|�d�k�r��|��j�r��t �j�j���n��|�d�k�r�|�t�k�r�|�d�k�r.|��j�d�7_�|��j����q��q�|�d�k�rw|��j�d�k�sXt �j�j���n��|��j�d�8_�|��j����q��q�|�d�k�r�|��j�s�t �|��_�t�|��_�t�}�q��q�t�|��_�t�|��_�|��j����q��q�|�d�k�r�t�t�d���S|�d �k�r�x6�|��j ����}�|�d�k�s|�d�k�rPn��|�|�7}�q�W|�rJ|��j�|���t�t�|���S|�d�k�r~|��j�rtt �j�j�d �����n��t�t���S|��j�r�|��j����d�}�q��q�t�t�d���Sq�|�}�t�}�n �|��j�|���Png|��j�r�|�d�k�r�|��j ����}�|�d�k�r t �j�j���n��|�j����r�|��j ����}�|�d�k�r<t �j�j���n��|��j ����} �|�d�k�rct �j�j���n��|�j����ox| �j����s�t �j�j���n��t�t�|���d�t�|���d �t�| �����}�q�q4|�d�k�r4t �j�j�d�����q4nR�|�d�k�r4|�|�7}�t �}�|��j ����}�|�d�k�s"|�d�k�r4t �j�j���q4n��|�|�7}�q��W|�d�k�r�|�t�k�r�|��j�rxt �j�j�d �����n��t�}�n��t�|�|�|���S(���s��Get the next token. @param want_leading: If True, return a WHITESPACE token if the first character read is whitespace. The default is False. @type want_leading: bool @param want_comment: If True, return a COMMENT token if the first token read is a comment. The default is False. @type want_comment: bool @rtype: Token object @raises dns.exception.UnexpectedEnd: input ended prematurely @raises dns.exception.SyntaxError: input was badly formed i����R����R ���R���i���R���R���s��� R���s���unbalanced parenthesess���\id���i ���s���newline in quoted stringN(���RC���R>���R���R���RQ���R ���R���R���R ���R#���RM���RH���RE���R'���R(���R)���R���RD���R+���t���_QUOTING_DELIMITERSRG���R���RO���R���R���R���R*���R,���R-���( ���R���t���want_leadingt���want_commentt���tokenRP���R���R ���R1���R2���R3���(����(����s3���/usr/lib64/python2.7/site-packages/dns/tokenizer.pyt���get��s����� 4 c���������C���s%���|��j��d�k �r�t���n��|�|��_��d�S(���s@��Unget a token. The unget buffer for tokens is only one token large; it is an error to try to unget a token when the unget buffer is not empty. @param token: the token to unget @type token: Token object @raises UngetBufferFull: there is already an ungotten token N(���RC���R>���R���(���R���RU���(����(����s3���/usr/lib64/python2.7/site-packages/dns/tokenizer.pyt���unget���s���� c���������C���s%���|��j�����}�|�j����r!�t���n��|�S(���sL���Return the next item in an iteration. @rtype: (int, string) (���RV���R���t ���StopIteration(���R���RU���(����(����s3���/usr/lib64/python2.7/site-packages/dns/tokenizer.pyt���next���s���� c���������C���s���|��S(���N(����(���R���(����(����s3���/usr/lib64/python2.7/site-packages/dns/tokenizer.pyR7������s����c���������C���sd���|��j�����j����}�|�j����s3�t�j�j�d�����n��|�j�j����sW�t�j�j�d�����n��t�|�j���S(���s|���Read the next token and interpret it as an integer. @raises dns.exception.SyntaxError: @rtype: int s���expecting an identifiers���expecting an integer( ���RV���R4���R���R'���R(���R+���R���R*���R-���(���R���RU���(����(����s3���/usr/lib64/python2.7/site-packages/dns/tokenizer.pyt���get_int���s����c���������C���sA���|��j�����}�|�d�k��s$�|�d�k�r=�t�j�j�d�|�����n��|�S(���s����Read the next token and interpret it as an 8-bit unsigned integer. @raises dns.exception.SyntaxError: @rtype: int i����i����s#���%d is not an unsigned 8-bit integer(���RZ���R'���R(���R+���(���R���R���(����(����s3���/usr/lib64/python2.7/site-packages/dns/tokenizer.pyt ���get_uint8���s����c���������C���sA���|��j�����}�|�d�k��s$�|�d�k�r=�t�j�j�d�|�����n��|�S(���s����Read the next token and interpret it as a 16-bit unsigned integer. @raises dns.exception.SyntaxError: @rtype: int i����i����s$���%d is not an unsigned 16-bit integer(���RZ���R'���R(���R+���(���R���R���(����(����s3���/usr/lib64/python2.7/site-packages/dns/tokenizer.pyt ���get_uint16���s����c���������C���s����|��j�����j����}�|�j����s3�t�j�j�d�����n��|�j�j����sW�t�j�j�d�����n��t�|�j���}�|�d�k��s~�|�d�k�r��t�j�j�d�|�����n��|�S(���s����Read the next token and interpret it as a 32-bit unsigned integer. @raises dns.exception.SyntaxError: @rtype: int s���expecting an identifiers���expecting an integeri����l��������s$���%d is not an unsigned 32-bit integer( ���RV���R4���R���R'���R(���R+���R���R*���t���long(���R���RU���R���(����(����s3���/usr/lib64/python2.7/site-packages/dns/tokenizer.pyt ���get_uint32���s����c���������C���sF���|��j�����j����}�|�j����p'�|�j����s?�t�j�j�d�����n��|�j�S(���s}���Read the next token and interpret it as a string. @raises dns.exception.SyntaxError: @rtype: string s���expecting a string(���RV���R4���R���R���R'���R(���R+���R���(���R���t���originRU���(����(����s3���/usr/lib64/python2.7/site-packages/dns/tokenizer.pyt ���get_string���s����c���������C���s:���|��j�����j����}�|�j����s3�t�j�j�d�����n��|�j�S(���s����Read the next token and raise an exception if it is not an identifier. @raises dns.exception.SyntaxError: @rtype: string s���expecting an identifier(���RV���R4���R���R'���R(���R+���R���(���R���R_���RU���(����(����s3���/usr/lib64/python2.7/site-packages/dns/tokenizer.pyt���get_identifier���s����c���������C���sC���|��j�����}�|�j����s-�t�j�j�d�����n��t�j�j�|�j�|���S(���s����Read the next token and interpret it as a DNS name. @raises dns.exception.SyntaxError: @rtype: dns.name.Name objects���expecting an identifier(���RV���R���R'���R(���R+���t���namet ���from_textR���(���R���R_���RU���(����(����s3���/usr/lib64/python2.7/site-packages/dns/tokenizer.pyt���get_name��s����c���������C���sD���|��j�����}�|�j����s=�t�j�j�d�|�j�|�j�f�����n��|�j�S(���s����Read the next token and raise an exception if it isn't EOL or EOF. @raises dns.exception.SyntaxError: @rtype: string s ���expected EOL or EOF, got %d "%s"(���RV���R���R'���R(���R+���R���R���(���R���RU���(����(����s3���/usr/lib64/python2.7/site-packages/dns/tokenizer.pyt���get_eol��s����%c���������C���sF���|��j�����j����}�|�j����s3�t�j�j�d�����n��t�j�j�|�j���S(���Ns���expecting an identifier( ���RV���R4���R���R'���R(���R+���t���ttlRc���R���(���R���RU���(����(����s3���/usr/lib64/python2.7/site-packages/dns/tokenizer.pyt���get_ttl��s����N(���R���R���R���R?���R@���R>���R���RM���RN���RO���RQ���R ���RV���RW���RY���R7���RZ���R[���R\���R^���R`���Ra���Rd���Re���Rg���(����(����(����s3���/usr/lib64/python2.7/site-packages/dns/tokenizer.pyR:�������s&��� z (���R���R<���R?���t ���dns.exceptionR'���t���dns.namet���dns.ttlR#���RG���RR���R���R���R���R���R���R���R���R(���t���DNSExceptionR���t���objectR ���R:���(����(����(����s3���/usr/lib64/python2.7/site-packages/dns/tokenizer.pyt���<module>���s0��� m