Skip to content

yex.value.Tokenlist

yex.value.Tokenlist(value=None) #

Bases: yex.value.value.Value

A sequence of Tokens.

Attributes:

Name Type Description
_value list

the Tokens we represent. Only instances of yex.parse.Token are allowed here.

Source code in yex/value/tokenlist.py
19
20
21
22
23
24
25
26
27
def __init__(self,
        value = None):

    super().__init__()

    if value is None:
        self._value = []
    else:
        self.__setstate__(state=value)

push_to(tokens) #

Pushes the contents of this Tokenlist onto a parser.

Parameters:

Name Type Description Default
tokens yex.parse.Parser

where to push it

required
Source code in yex/value/tokenlist.py
141
142
143
144
145
146
147
148
149
def push_to(self, tokens: 'yex.parse.Parser'):
    """
    Pushes the contents of this Tokenlist onto a parser.

    Args:
        tokens: where to push it
    """
    for t in reversed(self._value):
        tokens.push(t)