UNPKG

parjs

Version:

A parser-combinator library for JavaScript.

28 lines (27 loc) 720 B
"use strict"; /** * @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 * current position as an integer. */ function position() { return new class Position extends parser_1.ParjserBase { constructor() { super(...arguments); this.expecting = "anything"; this.type = "position"; } _apply(ps) { ps.value = ps.position; ps.kind = result_1.ResultKind.Ok; } }(); } exports.position = position; //# sourceMappingURL=position.js.map