GitHub

API reference for Element.

A leading position of values of type; an optional one may be missing (it is then missing from the output too).

Attributes

AttributeTypeDescription
typeAST
optionalbool = False

Functions

__init__

__init__(type, optional=False) -> None
ParameterTypeDescription
typeAST
optionalbool = False

optional_when_encoded

optional_when_encoded() -> bool

Whether the position may be missing from the encoded input (it is optional, or a decoding default fills it).

Returns bool

def optional_when_encoded(self) -> bool:
    """Whether the position may be missing from the encoded input (it is
    optional, or a decoding default fills it)."""
    return encoded_optional(self.type, optional=self.optional)