mimiqcircuits.qasm.exceptions

Exceptions

DuplicateRegisterError

Raised when the OpenQASM source declares the same register name twice.

ParseError(message[, token, parser_state])

Raised when the OpenQASM source is not valid syntax, uses an unsupported version, or includes a file that cannot be found.

QASMArgumentError

Raised when the parsed input is not a program or declares an unsupported opaque gate.

QASMError

Base class for the errors raised when reading or writing OpenQASM.

QASMSerializationError

Raised when a circuit cannot be written as OpenQASM 2.0.

QASMStructureError

Raised when an OpenQASM statement is well formed but cannot be interpreted, for example an unknown operation, an invalid target, or an if condition other than equality.

QASMVersionError

Raised when the OpenQASM version is not 2.0.

TokenError(message[, token, position])

Raised when the OpenQASM source contains text that is not a valid token.

UndefinedGateError

Raised when the OpenQASM source calls a gate that is not declared.

UndefinedRegisterError

Raised when the OpenQASM source uses a register that is not declared.

exception QASMError[source]

Bases: Exception

Base class for the errors raised when reading or writing OpenQASM.

exception TokenError(message, token=None, position=None)[source]

Bases: QASMError

Raised when the OpenQASM source contains text that is not a valid token.

exception ParseError(message, token=None, parser_state=None)[source]

Bases: QASMError

Raised when the OpenQASM source is not valid syntax, uses an unsupported version, or includes a file that cannot be found.

exception QASMSerializationError[source]

Bases: QASMError

Raised when a circuit cannot be written as OpenQASM 2.0.

exception QASMArgumentError[source]

Bases: QASMError

Raised when the parsed input is not a program or declares an unsupported opaque gate.

exception UndefinedGateError[source]

Bases: QASMError

Raised when the OpenQASM source calls a gate that is not declared.

exception DuplicateRegisterError[source]

Bases: QASMError

Raised when the OpenQASM source declares the same register name twice.

exception UndefinedRegisterError[source]

Bases: QASMError

Raised when the OpenQASM source uses a register that is not declared.

exception QASMStructureError[source]

Bases: QASMError

Raised when an OpenQASM statement is well formed but cannot be interpreted, for example an unknown operation, an invalid target, or an if condition other than equality.

exception QASMVersionError[source]

Bases: QASMError

Raised when the OpenQASM version is not 2.0.