Extending the Declarative Config Parsing API¶
Writing custom SectionParsers¶
- class yosys_mau.config_parser.ConfigParser
See
ConfigParserfor the user API.- sections(name=None, unprocessed_only=False)¶
Returns all sections or all sections with a given name.
- Parameters:
- Return type:
- mark_as_processed(section)¶
Marks a given section as processed.
Sections that are marked as unprocessed at the end of parsing generate an error.
- Parameters:
section (ConfigSection | Iterable[ConfigSection])
- Return type:
None
- class yosys_mau.config_parser.SectionParser
- config_parser: ConfigParser¶
The parser for the config file containing the section being parsed.
- attr_name: str¶
The name of the attribute in the config parser class that this section parser was assigned to.
- property result: T¶
See
SectionParserfor the user API.
- class yosys_mau.config_parser.SectionContentsParser
See
SectionContentsParserfor the user API.This part of the API is needed to invoke a section content parser on a custom set of sections and to redirect the result (see
ArgSectionfor an example).- arg_sections: list[ConfigSection] | None = None¶
Set to override the sections considered by
SectionParser.matching_sections().
Writing custom OptionParsers¶
- class yosys_mau.config_parser.ConfigOptions
See
ConfigOptionsfor the user API.- options(name=None, unprocessed_only=False)¶
Returns all options or all options with a given name.
- mark_as_processed(section)¶
Marks a given section as processed.
Sections that are marked as unprocessed at the end of parsing generate an error.
- Parameters:
section (ConfigCommand | Iterable[ConfigCommand])
- Return type:
None
- class yosys_mau.config_parser.OptionParser
- config_options: ConfigOptions¶
The parser for the options section containing the option being parsed.
- attr_name: str¶
The name of the attribute in the config options class that this option parser is associated with.
- property result: T¶
See
OptionParserfor the user API.