OpenQuizz
Une application de gestion des contenus pédagogiques
|
Public Member Functions | |
def | __init__ (self, generator, name, filename) |
def | __iter__ (self) |
def | __bool__ (self) |
def | eos (self) |
def | push (self, token) |
def | look (self) |
def | skip (self, n=1) |
def | next_if (self, expr) |
def | skip_if (self, expr) |
def | __next__ (self) |
def | close (self) |
def | expect (self, expr) |
Data Fields | |
name | |
filename | |
closed | |
current | |
A token stream is an iterable that yields :class:`Token`\\s. The parser however does not iterate over it but calls :meth:`next` to go one token ahead. The current active token is stored as :attr:`current`.
def __init__ | ( | self, | |
generator, | |||
name, | |||
filename | |||
) |
def __bool__ | ( | self | ) |
def __iter__ | ( | self | ) |
def __next__ | ( | self | ) |
Go one token ahead and return the old one. Use the built-in :func:`next` instead of calling this directly.
def close | ( | self | ) |
Close the stream.
def eos | ( | self | ) |
Are we at the end of the stream?
def expect | ( | self, | |
expr | |||
) |
Expect a given token type and return it. This accepts the same argument as :meth:`jinja2.lexer.Token.test`.
def look | ( | self | ) |
Look at the next token.
def next_if | ( | self, | |
expr | |||
) |
Perform the token test and return the token if it matched. Otherwise the return value is `None`.
def push | ( | self, | |
token | |||
) |
Push a token back to the stream.
def skip | ( | self, | |
n = 1 |
|||
) |
Got n tokens ahead.
def skip_if | ( | self, | |
expr | |||
) |
Like :meth:`next_if` but only returns `True` or `False`.
closed |
current |
filename |
name |