parjs
Version:
A parser-combinator library for JavaScript.
31 lines (30 loc) • 861 B
JavaScript
;
/**
* @module parjs
*/
/** */
Object.defineProperty(exports, "__esModule", { value: true });
const result_1 = require("../result");
const parser_1 = require("../parser");
/**
* Returns a parser that consumes all the rest of the input and yields the
* text that was parsed. Always succeeds.
*/
function rest() {
return new class Rest extends parser_1.ParjserBase {
constructor() {
super(...arguments);
this.expecting = "expecting anything";
this.type = "rest";
}
_apply(pr) {
let { position, input } = pr;
let text = input.substr(Math.min(position, input.length));
pr.position = input.length;
pr.value = text;
pr.kind = result_1.ResultKind.Ok;
}
}();
}
exports.rest = rest;
//# sourceMappingURL=rest.js.map