UNPKG

parjs

Version:

Library for building parsers using combinators.

34 lines 963 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.later = void 0; const issues_1 = require("../issues"); const parser_1 = require("../parser"); class Late extends parser_1.ParjserBase { constructor() { super(...arguments); this.type = "later"; } get expecting() { return !this._resolved ? "unbound delayed parser" : this._resolved.expecting; } init(resolved) { if (this._resolved) issues_1.Issues.delayedParserAlreadyInit(); this._resolved = resolved; } _apply(ps) { if (!this._resolved) { issues_1.Issues.delayedParserNotInit(""); } this._resolved.apply(ps); } } /** * Returns a parser that has no logic by itself and must be initialized with another parser by * calling the parser's `init` function. */ function later() { return new Late(); } exports.later = later; //# sourceMappingURL=later.js.map