parjs
Version:
Library for building parsers using combinators.
27 lines • 751 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.result = void 0;
const parser_1 = require("../parser");
const result_1 = require("../result");
class Result extends parser_1.ParjserBase {
constructor(value) {
super();
this.value = value;
this.type = "result";
this.expecting = "expecting anything";
}
_apply(ps) {
ps.value = this.value;
ps.kind = result_1.ResultKind.Ok;
}
}
/**
* 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 Result(value);
}
exports.result = result;
//# sourceMappingURL=result.js.map