parjs
Version:
A parser-combinator library for JavaScript.
29 lines (28 loc) • 761 B
JavaScript
;
/**
* @module parjs
*/
/** */
Object.defineProperty(exports, "__esModule", { value: true });
const result_1 = require("../result");
const parser_1 = require("../parser");
/**
* Returns a parser that succeeds without consuming input and yields the
* constant `value`.
* @param value The value the returned parser will yield.
*/
function result(value) {
return new class Result extends parser_1.ParjserBase {
constructor() {
super(...arguments);
this.expecting = "expecting anything";
this.type = "result";
}
_apply(ps) {
ps.value = value;
ps.kind = result_1.ResultKind.Ok;
}
}();
}
exports.result = result;
//# sourceMappingURL=result.js.map