NewcommandItems.js 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. "use strict";
  2. var __extends = (this && this.__extends) || (function () {
  3. var extendStatics = function (d, b) {
  4. extendStatics = Object.setPrototypeOf ||
  5. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  6. function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
  7. return extendStatics(d, b);
  8. };
  9. return function (d, b) {
  10. if (typeof b !== "function" && b !== null)
  11. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  12. extendStatics(d, b);
  13. function __() { this.constructor = d; }
  14. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  15. };
  16. })();
  17. var __importDefault = (this && this.__importDefault) || function (mod) {
  18. return (mod && mod.__esModule) ? mod : { "default": mod };
  19. };
  20. Object.defineProperty(exports, "__esModule", { value: true });
  21. exports.BeginEnvItem = void 0;
  22. var TexError_js_1 = __importDefault(require("../TexError.js"));
  23. var StackItem_js_1 = require("../StackItem.js");
  24. var BeginEnvItem = (function (_super) {
  25. __extends(BeginEnvItem, _super);
  26. function BeginEnvItem() {
  27. return _super !== null && _super.apply(this, arguments) || this;
  28. }
  29. Object.defineProperty(BeginEnvItem.prototype, "kind", {
  30. get: function () {
  31. return 'beginEnv';
  32. },
  33. enumerable: false,
  34. configurable: true
  35. });
  36. Object.defineProperty(BeginEnvItem.prototype, "isOpen", {
  37. get: function () {
  38. return true;
  39. },
  40. enumerable: false,
  41. configurable: true
  42. });
  43. BeginEnvItem.prototype.checkItem = function (item) {
  44. if (item.isKind('end')) {
  45. if (item.getName() !== this.getName()) {
  46. throw new TexError_js_1.default('EnvBadEnd', '\\begin{%1} ended with \\end{%2}', this.getName(), item.getName());
  47. }
  48. return [[this.factory.create('mml', this.toMml())], true];
  49. }
  50. if (item.isKind('stop')) {
  51. throw new TexError_js_1.default('EnvMissingEnd', 'Missing \\end{%1}', this.getName());
  52. }
  53. return _super.prototype.checkItem.call(this, item);
  54. };
  55. return BeginEnvItem;
  56. }(StackItem_js_1.BaseItem));
  57. exports.BeginEnvItem = BeginEnvItem;
  58. //# sourceMappingURL=NewcommandItems.js.map