parjs
Version:
A parser-combinator library for JavaScript.
37 lines (36 loc) • 1.05 kB
JavaScript
;
/**
* @module parjs/combinators
*/
/** */
Object.defineProperty(exports, "__esModule", { value: true });
const parser_1 = require("../parser");
const issues_1 = require("../issues");
/**
* 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 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);
}
}();
}
exports.later = later;
//# sourceMappingURL=later.js.map