A DNS master file format tokenizer.
A token is a (type, value) tuple, where
| Method Summary |
| |
__init__(self,
f,
filename)
Initialize a tokenizer instance. |
| |
__iter__(self)
|
| (int, string) tuple
|
get(self,
want_leading,
want_comment)
Get the next token. |
| string
|
get_eol(self)
Read the next token and raise an exception if it isn't EOL or EOF. |
| int
|
get_int(self)
Read the next token and interpret it as an integer. |
| dns.name.Name object
|
get_name(self,
origin)
Read the next token and interpret it as a DNS name. |
| string
|
get_string(self,
origin)
Read the next token and interpret it as a string. |
| int
|
get_uint16(self)
Read the next token and interpret it as a 16-bit unsigned integer. |
| int
|
get_uint32(self)
Read the next token and interpret it as a 32-bit unsigned integer. |
| int
|
get_uint8(self)
Read the next token and interpret it as an 8-bit unsigned integer. |
| (int, string)
|
next(self)
Return the next item in an iteration. |
| int
|
skip_whitespace(self)
Consume input until a non-whitespace character is encountered. |
| |
unget(self,
token)
Unget a token. |
| (string, int) tuple. The first item is the filename of the
input, the second is the current line number.
|
where(self)
Return the current location in the input. |
| string
|
_get_char(self)
Read a character from input. |
| |
_unget_char(self,
c)
Unget a character. |
| Inherited from object |
| |
__delattr__(...)
x.__delattr__('name') <==> del x.name |
| |
__getattribute__(...)
x.__getattribute__('name') <==> x.name |
| |
__hash__(x)
x.__hash__() <==> hash(x) |
| |
__new__(T,
S,
...)
T.__new__(S, ...) -> a new object with type S, a subtype of T |
| |
__reduce__(...)
helper for pickle |
| |
__reduce_ex__(...)
helper for pickle |
| |
__repr__(x)
x.__repr__() <==> repr(x) |
| |
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value |
| |
__str__(x)
x.__str__() <==> str(x) |
| Instance Variable Summary |
| dict |
delimiters: The current delimiter dictionary. |
| bool |
eof: This variable is true if the tokenizer has encountered EOF. |
| file |
file: The file to tokenize |
| string |
filename: A filename that will be returned by the where method. |
| int |
line_number: The current line number |
| int |
multiline: The current multiline level. |
| bool |
quoting: This variable is true if the tokenizer is currently reading a quoted
string. |
| string |
ungotten_char: The most recently ungotten character, or None. |
| (int, string) token tuple |
ungotten_token: The most recently ungotten token, or None. |