finesse.script.spec.KatSpec

Overview

class finesse.script.spec.KatSpec[source]

Bases: object

KatScript language specification.

This defines the available KatScript elements, commands, and analyses that the parser recognises. These directives are mapped by this object to adapter classes to convert between KatScript and Finesse objects.

Additional directives can be registered at runtime using register_element(), register_command(), and register_analysis(). These adapters will remain for the rest of the lifetime of the object.

Supported KatScript keywords, constants, operators, and functions are not modifiable by users.

This class should not normally be instantiated by user code; the shared instance in KATSPEC should instead be used.

Properties

KatSpec.directives

All top level parser directives.

KatSpec.function_directives

All top level function-style parser directives.

KatSpec.reserved_names

All reserved names.

Methods

KatSpec.__init__()

KatSpec.register_analysis(adapter, **kwargs)

Add parser and generator support for an analysis.

KatSpec.register_command(adapter, **kwargs)

Add parser and generator support for a command.

KatSpec.register_element(adapter, **kwargs)

Add parser and generator support for a model element such as a component or detector.

KatSpec.type_descriptor(_type[, default])

Get a descriptor for a type that's suitable for use in user feedback.