UNPKG

parjs

Version:

Library for building parsers using combinators.

28 lines 811 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.rest = void 0; const parser_1 = require("../parser"); const result_1 = require("../result"); class Rest extends parser_1.ParjserBase { constructor() { super(...arguments); this.type = "rest"; this.expecting = "expecting anything"; } _apply(pr) { const { position, input } = pr; const text = input.substring(Math.min(position, input.length)); pr.position = input.length; pr.value = text; pr.kind = result_1.ResultKind.Ok; } } /** * Returns a parser that consumes all the rest of the input and yields the text that was parsed. * Always succeeds. */ function rest() { return new Rest(); } exports.rest = rest; //# sourceMappingURL=rest.js.map