Skip to content

\inputlineno

yex.keyword.Inputlineno(value=None, **kwargs) #

Bases: yex.control.NumberParameter

The current line in the input file.

You can't write to this:

The moving finger writes, and having writ
Moves on; nor all your piety nor wit
Shall lure it back to cancel half a line,
Nor all your tears wash out a word of it.
Source code in yex/control/parameter.py
75
76
77
78
79
80
81
82
83
84
85
86
87
88
def __init__(self, value=None, **kwargs):

    super().__init__(**kwargs)

    if value is not None:
        self._value = value
    elif self.do_not_initialise:
        pass
    elif isinstance(self.initial_value, self.our_type):
        self._value = self.initial_value
    elif isinstance(self.our_type, tuple):
        self._value = self.our_type[0](self.initial_value)
    else:
        self._value = self.our_type(self.initial_value)

update(n) #

Sets the line number.

This is used by yex.parse.source.Source to keep the line number correct. We're not doing this via the value property because it shouldn't be generally accessible in the way other parameters' values are.

Parameters:

Name Type Description Default
n `int`

The line number.

required
Source code in yex/keyword/parameter.py
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
def update(self, n):
    """
    Sets the line number.

    This is used by `yex.parse.source.Source` to keep the line number
    correct. We're not doing this via the `value` property because
    it shouldn't be generally accessible in the way other parameters'
    values are.

    Args:
        n (`int`): The line number.
    """
    self._value = n
    logger.debug("%s: line number is now %s",
            self, n)