pub enum SemanticError {
UnsupportedVersion,
DuplicateRegisterDeclaration,
WrongNumberOfParameters,
WrongNumberOfTargets,
UnknownIdentifier,
IndexedRegisterInGateDecl,
SameTargetUsedTwice,
InvalidTargetDimensions,
IndexOutOfBounds,
OpaqueIsNotSupported,
}
Expand description
The different errors that can occur when running semantic analysis on an AST.
Variants§
UnsupportedVersion
Only openqasm 2.0 is supported, so the first line has to be: OPENQASM 2.0;
DuplicateRegisterDeclaration
Two registers have been defined with the same name.
WrongNumberOfParameters
An operation was applied with the wrong number of parameters.
WrongNumberOfTargets
An operation was applied with the wrong number of qubits.
UnknownIdentifier
An identifier was used which had not been previously defined.
IndexedRegisterInGateDecl
Inside of a gate declaration you are only allowed to use the parameters and arguments defined in the gate declaration. The arguments are not allowed to be indexed inside the gate definition, otherwise this error is returned.
SameTargetUsedTwice
An operation was applied to some qubits which contained the same qubit several times.
InvalidTargetDimensions
An operation can be called on entire registers or on single qubits. When more than one of the arguments specify an entire register then all these registers have to have the same size. Otherwise this error is returned.
IndexOutOfBounds
A register was indexed outside of its range [0..size)
OpaqueIsNotSupported
An opaque gate is one which doesn’t have a definition. This is currently not supported.