Parsing Individual Values

In a config file there are several places where individual values are parsed. To convert values from the input strings to an appropriate Python type and to restrict the allowed values, the ValueParser class is used.

class yosys_mau.config_parser.ValueParser

Bases: Generic[T]

A parser for a single value.

abstract parse(input)

Parse a value.

Parameters:

input (str)

Return type:

T

class yosys_mau.config_parser.IntValue(min=None, max=None)

Bases: ValueParser[int]

A parser for an integer value.

Parameters:
  • min (int | None)

  • max (int | None)

min: int | None = None

Minimum value (inclusive).

max: int | None = None

Maximum value (inclusive).

class yosys_mau.config_parser.StrValue(allow_empty=False)

Bases: ValueParser[str]

A parser for a string value.

Parameters:

allow_empty (bool)

class yosys_mau.config_parser.BoolValue

Bases: ValueParser[bool]

A parser for a boolean value using "on" and "off" for True and False.

class yosys_mau.config_parser.EnumValue(*values)

Bases: ValueParser[str]

A parser for a fixed set of values.

Parameters:

values (str) – The allowed values.