parjs
Version:
A parser-combinator library for JavaScript.
29 lines (28 loc) • 781 B
JavaScript
;
/**
* @module parjs/combinators
*/
/** */
Object.defineProperty(exports, "__esModule", { value: true });
const combinator_1 = require("./combinator");
const parser_1 = require("../parser");
function each(action) {
return combinator_1.defineCombinator(source => {
return new class extends parser_1.ParjserBase {
constructor() {
super(...arguments);
this.type = "each";
this.expecting = source.expecting;
}
_apply(ps) {
source.apply(ps);
if (!ps.isOk) {
return;
}
action(ps.value, ps.userState);
}
}();
});
}
exports.each = each;
//# sourceMappingURL=each.js.map