q-sharp-ts
Version:
A parser for Q# language features, implemented in TypeScript.
422 lines (421 loc) • 17.8 kB
JavaScript
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.BadApplicationError = exports.BadUseError = exports.BadStructError = exports.UnsupportedTypeError = exports.UninitializedVariableError = exports.MixedTypesError = exports.UninitializedInstanceError = exports.BadIdentifierError = exports.BadFormatError = exports.BadImportError = exports.BadEquivalenceError = exports.BadPinError = exports.BadChainError = exports.BadDeclarationError = exports.UndeclaredVariableError = exports.UndeclaredQubitError = exports.BadUseFunctionError = exports.BadIndexError = exports.BadConditionStructureError = exports.BadLoopError = exports.BadArrayError = exports.BadIntError = exports.BadIteratorError = exports.BadConjugationError = exports.BadOperationNameError = exports.BadFunctionNameError = exports.BadFunctionError = exports.WrongQuoteError = exports.BadBindingError = exports.BadParameterError = exports.BadArgumentError = void 0;
/** Class representing a bad argument exception. */
var BadArgumentError = /** @class */ (function (_super) {
__extends(BadArgumentError, _super);
function BadArgumentError(message) {
var _newTarget = this.constructor;
var _this = _super.call(this, message) || this;
Object.setPrototypeOf(_this, _newTarget.prototype);
_this.name = BadArgumentError.name;
return _this;
}
return BadArgumentError;
}(Error));
exports.BadArgumentError = BadArgumentError;
/** Class representing a mixed types exception. */
var MixedTypesError = /** @class */ (function (_super) {
__extends(MixedTypesError, _super);
function MixedTypesError(message) {
var _newTarget = this.constructor;
var _this = _super.call(this, message) || this;
Object.setPrototypeOf(_this, _newTarget.prototype);
_this.name = MixedTypesError.name;
return _this;
}
return MixedTypesError;
}(Error));
exports.MixedTypesError = MixedTypesError;
/** Class representing an unsupported type exception. */
var UnsupportedTypeError = /** @class */ (function (_super) {
__extends(UnsupportedTypeError, _super);
function UnsupportedTypeError(message) {
var _newTarget = this.constructor;
var _this = _super.call(this, message) || this;
Object.setPrototypeOf(_this, _newTarget.prototype);
_this.name = UnsupportedTypeError.name;
return _this;
}
return UnsupportedTypeError;
}(Error));
exports.UnsupportedTypeError = UnsupportedTypeError;
/** Class representing a bad parameter exception. */
var BadParameterError = /** @class */ (function (_super) {
__extends(BadParameterError, _super);
function BadParameterError(message) {
var _newTarget = this.constructor;
var _this = _super.call(this, message) || this;
Object.setPrototypeOf(_this, _newTarget.prototype);
_this.name = BadParameterError.name;
return _this;
}
return BadParameterError;
}(Error));
exports.BadParameterError = BadParameterError;
/** Class representing a bad gate applicaiton exception. */
var BadApplicationError = /** @class */ (function (_super) {
__extends(BadApplicationError, _super);
function BadApplicationError(message) {
var _newTarget = this.constructor;
var _this = _super.call(this, message) || this;
Object.setPrototypeOf(_this, _newTarget.prototype);
_this.name = BadApplicationError.name;
return _this;
}
return BadApplicationError;
}(Error));
exports.BadApplicationError = BadApplicationError;
/** Class representing a bad use exception. */
var BadUseError = /** @class */ (function (_super) {
__extends(BadUseError, _super);
function BadUseError(message) {
var _newTarget = this.constructor;
var _this = _super.call(this, message) || this;
Object.setPrototypeOf(_this, _newTarget.prototype);
_this.name = BadUseError.name;
return _this;
}
return BadUseError;
}(Error));
exports.BadUseError = BadUseError;
/** Class representing a bad struct exception. */
var BadStructError = /** @class */ (function (_super) {
__extends(BadStructError, _super);
function BadStructError(message) {
var _newTarget = this.constructor;
var _this = _super.call(this, message) || this;
Object.setPrototypeOf(_this, _newTarget.prototype);
_this.name = BadStructError.name;
return _this;
}
return BadStructError;
}(Error));
exports.BadStructError = BadStructError;
/** Class representing a bad Function exception. */
var BadFunctionError = /** @class */ (function (_super) {
__extends(BadFunctionError, _super);
function BadFunctionError(message) {
var _newTarget = this.constructor;
var _this = _super.call(this, message) || this;
Object.setPrototypeOf(_this, _newTarget.prototype);
_this.name = BadFunctionError.name;
return _this;
}
return BadFunctionError;
}(Error));
exports.BadFunctionError = BadFunctionError;
/** Class representing a bad Conjugation exception. */
var BadConjugationError = /** @class */ (function (_super) {
__extends(BadConjugationError, _super);
function BadConjugationError(message) {
var _newTarget = this.constructor;
var _this = _super.call(this, message) || this;
Object.setPrototypeOf(_this, _newTarget.prototype);
_this.name = BadConjugationError.name;
return _this;
}
return BadConjugationError;
}(Error));
exports.BadConjugationError = BadConjugationError;
/** Class representing a bad Function name exception. */
var BadFunctionNameError = /** @class */ (function (_super) {
__extends(BadFunctionNameError, _super);
function BadFunctionNameError(message) {
var _newTarget = this.constructor;
var _this = _super.call(this, message) || this;
Object.setPrototypeOf(_this, _newTarget.prototype);
_this.name = BadFunctionNameError.name;
return _this;
}
return BadFunctionNameError;
}(Error));
exports.BadFunctionNameError = BadFunctionNameError;
/** Class representing a bad Operation name exception. */
var BadOperationNameError = /** @class */ (function (_super) {
__extends(BadOperationNameError, _super);
function BadOperationNameError(message) {
var _newTarget = this.constructor;
var _this = _super.call(this, message) || this;
Object.setPrototypeOf(_this, _newTarget.prototype);
_this.name = BadOperationNameError.name;
return _this;
}
return BadOperationNameError;
}(Error));
exports.BadOperationNameError = BadOperationNameError;
/** Class representing a bad Function usage exception. */
var BadUseFunctionError = /** @class */ (function (_super) {
__extends(BadUseFunctionError, _super);
function BadUseFunctionError(message) {
var _newTarget = this.constructor;
var _this = _super.call(this, message) || this;
Object.setPrototypeOf(_this, _newTarget.prototype);
_this.name = BadUseFunctionError.name;
return _this;
}
return BadUseFunctionError;
}(Error));
exports.BadUseFunctionError = BadUseFunctionError;
/** Class representing an uninitialized Function exception. */
var UninitializedInstanceError = /** @class */ (function (_super) {
__extends(UninitializedInstanceError, _super);
function UninitializedInstanceError(message) {
var _newTarget = this.constructor;
var _this = _super.call(this, message) || this;
Object.setPrototypeOf(_this, _newTarget.prototype);
_this.name = UninitializedInstanceError.name;
return _this;
}
return UninitializedInstanceError;
}(Error));
exports.UninitializedInstanceError = UninitializedInstanceError;
/** Class representing an uninitialized variable exception. */
var UninitializedVariableError = /** @class */ (function (_super) {
__extends(UninitializedVariableError, _super);
function UninitializedVariableError(message) {
var _newTarget = this.constructor;
var _this = _super.call(this, message) || this;
Object.setPrototypeOf(_this, _newTarget.prototype);
_this.name = UninitializedVariableError.name;
return _this;
}
return UninitializedVariableError;
}(Error));
exports.UninitializedVariableError = UninitializedVariableError;
/** Class representing a wrong quote exception. */
var WrongQuoteError = /** @class */ (function (_super) {
__extends(WrongQuoteError, _super);
function WrongQuoteError(message) {
var _newTarget = this.constructor;
var _this = _super.call(this, message) || this;
Object.setPrototypeOf(_this, _newTarget.prototype);
_this.name = WrongQuoteError.name;
return _this;
}
return WrongQuoteError;
}(Error));
exports.WrongQuoteError = WrongQuoteError;
/** Class representing a bad array exception. */
var BadArrayError = /** @class */ (function (_super) {
__extends(BadArrayError, _super);
function BadArrayError(message) {
var _newTarget = this.constructor;
var _this = _super.call(this, message) || this;
Object.setPrototypeOf(_this, _newTarget.prototype);
_this.name = BadArrayError.name;
return _this;
}
return BadArrayError;
}(Error));
exports.BadArrayError = BadArrayError;
/** Class representing a bad register index exception. */
var BadIndexError = /** @class */ (function (_super) {
__extends(BadIndexError, _super);
function BadIndexError(message) {
var _newTarget = this.constructor;
var _this = _super.call(this, message) || this;
Object.setPrototypeOf(_this, _newTarget.prototype);
_this.name = BadIndexError.name;
return _this;
}
return BadIndexError;
}(Error));
exports.BadIndexError = BadIndexError;
/** Class representing a bad declaration exception. */
var BadDeclarationError = /** @class */ (function (_super) {
__extends(BadDeclarationError, _super);
function BadDeclarationError(message) {
var _newTarget = this.constructor;
var _this = _super.call(this, message) || this;
Object.setPrototypeOf(_this, _newTarget.prototype);
_this.name = BadDeclarationError.name;
return _this;
}
return BadDeclarationError;
}(Error));
exports.BadDeclarationError = BadDeclarationError;
/** Class representing a bad integer exception. */
var BadIntError = /** @class */ (function (_super) {
__extends(BadIntError, _super);
function BadIntError(message) {
var _newTarget = this.constructor;
var _this = _super.call(this, message) || this;
Object.setPrototypeOf(_this, _newTarget.prototype);
_this.name = BadIntError.name;
return _this;
}
return BadIntError;
}(Error));
exports.BadIntError = BadIntError;
/** Class representing a bad chain exception. */
var BadChainError = /** @class */ (function (_super) {
__extends(BadChainError, _super);
function BadChainError(message) {
var _newTarget = this.constructor;
var _this = _super.call(this, message) || this;
Object.setPrototypeOf(_this, _newTarget.prototype);
_this.name = BadChainError.name;
return _this;
}
return BadChainError;
}(Error));
exports.BadChainError = BadChainError;
/** Class representing a bad binding exception. */
var BadBindingError = /** @class */ (function (_super) {
__extends(BadBindingError, _super);
function BadBindingError(message) {
var _newTarget = this.constructor;
var _this = _super.call(this, message) || this;
Object.setPrototypeOf(_this, _newTarget.prototype);
_this.name = BadBindingError.name;
return _this;
}
return BadBindingError;
}(Error));
exports.BadBindingError = BadBindingError;
/** Class representing a bad pin exception. */
var BadPinError = /** @class */ (function (_super) {
__extends(BadPinError, _super);
function BadPinError(message) {
var _newTarget = this.constructor;
var _this = _super.call(this, message) || this;
Object.setPrototypeOf(_this, _newTarget.prototype);
_this.name = BadPinError.name;
return _this;
}
return BadPinError;
}(Error));
exports.BadPinError = BadPinError;
/** Class representing a bad import exception. */
var BadImportError = /** @class */ (function (_super) {
__extends(BadImportError, _super);
function BadImportError(message) {
var _newTarget = this.constructor;
var _this = _super.call(this, message) || this;
Object.setPrototypeOf(_this, _newTarget.prototype);
_this.name = BadImportError.name;
return _this;
}
return BadImportError;
}(Error));
exports.BadImportError = BadImportError;
/** Class representing a bad equivalence exception. */
var BadEquivalenceError = /** @class */ (function (_super) {
__extends(BadEquivalenceError, _super);
function BadEquivalenceError(message) {
var _newTarget = this.constructor;
var _this = _super.call(this, message) || this;
Object.setPrototypeOf(_this, _newTarget.prototype);
_this.name = BadEquivalenceError.name;
return _this;
}
return BadEquivalenceError;
}(Error));
exports.BadEquivalenceError = BadEquivalenceError;
/** Class representing a bad format exception. */
var BadFormatError = /** @class */ (function (_super) {
__extends(BadFormatError, _super);
function BadFormatError(message) {
var _newTarget = this.constructor;
var _this = _super.call(this, message) || this;
Object.setPrototypeOf(_this, _newTarget.prototype);
_this.name = BadFormatError.name;
return _this;
}
return BadFormatError;
}(Error));
exports.BadFormatError = BadFormatError;
/** Class representing a bad identifier exception. */
var BadIdentifierError = /** @class */ (function (_super) {
__extends(BadIdentifierError, _super);
function BadIdentifierError(message) {
var _newTarget = this.constructor;
var _this = _super.call(this, message) || this;
Object.setPrototypeOf(_this, _newTarget.prototype);
_this.name = BadIdentifierError.name;
return _this;
}
return BadIdentifierError;
}(Error));
exports.BadIdentifierError = BadIdentifierError;
/** Class representing a bad loop exception. */
var BadLoopError = /** @class */ (function (_super) {
__extends(BadLoopError, _super);
function BadLoopError(message) {
var _newTarget = this.constructor;
var _this = _super.call(this, message) || this;
Object.setPrototypeOf(_this, _newTarget.prototype);
_this.name = BadLoopError.name;
return _this;
}
return BadLoopError;
}(Error));
exports.BadLoopError = BadLoopError;
/** Class representing a bad iterator exception. */
var BadIteratorError = /** @class */ (function (_super) {
__extends(BadIteratorError, _super);
function BadIteratorError(message) {
var _newTarget = this.constructor;
var _this = _super.call(this, message) || this;
Object.setPrototypeOf(_this, _newTarget.prototype);
_this.name = BadIteratorError.name;
return _this;
}
return BadIteratorError;
}(Error));
exports.BadIteratorError = BadIteratorError;
/** Class representing a bad condition structure exception. */
var BadConditionStructureError = /** @class */ (function (_super) {
__extends(BadConditionStructureError, _super);
function BadConditionStructureError(message) {
var _newTarget = this.constructor;
var _this = _super.call(this, message) || this;
Object.setPrototypeOf(_this, _newTarget.prototype);
_this.name = BadConditionStructureError.name;
return _this;
}
return BadConditionStructureError;
}(Error));
exports.BadConditionStructureError = BadConditionStructureError;
/** Class representing an undeclared variable exception. */
var UndeclaredVariableError = /** @class */ (function (_super) {
__extends(UndeclaredVariableError, _super);
function UndeclaredVariableError(message) {
var _newTarget = this.constructor;
var _this = _super.call(this, message) || this;
Object.setPrototypeOf(_this, _newTarget.prototype);
_this.name = UndeclaredVariableError.name;
return _this;
}
return UndeclaredVariableError;
}(Error));
exports.UndeclaredVariableError = UndeclaredVariableError;
/** Class representing an undeclared qubit exception. */
var UndeclaredQubitError = /** @class */ (function (_super) {
__extends(UndeclaredQubitError, _super);
function UndeclaredQubitError(message) {
var _newTarget = this.constructor;
var _this = _super.call(this, message) || this;
Object.setPrototypeOf(_this, _newTarget.prototype);
_this.name = UndeclaredQubitError.name;
return _this;
}
return UndeclaredQubitError;
}(Error));
exports.UndeclaredQubitError = UndeclaredQubitError;