UNPKG

parjs

Version:

Library for building parsers using combinators.

24 lines 716 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.position = void 0; const parser_1 = require("../parser"); const result_1 = require("../result"); /** * Returns a parser that succeeds without consuming input and yields the current position as an * integer. */ function position() { return new (class Position extends parser_1.ParjserBase { constructor() { super(...arguments); this.type = "position"; this.expecting = "anything"; } _apply(ps) { ps.value = ps.position; ps.kind = result_1.ResultKind.Ok; } })(); } exports.position = position; //# sourceMappingURL=position.js.map