You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
897 B
JavaScript

"use strict";
const mapObject = require("map-obj");
const yieldcore = require("../yieldcore");
let coreOps = {
literal: require("./literal"),
characterRange: require("./character-range"),
endOfInput: require("./end-of-input"),
either: require("./either"),
peek: require("./peek"),
test: require("./test"),
zeroOrMore: require("./zero-or-more"),
oneOrMore: require("./one-or-more"),
optional: require("./optional"),
until: require("./until"),
wholeMatch: require("./whole-match"),
// FIXME: Implement trackPosition
};
Object.assign(module.exports, {
... coreOps,
internalCall: mapObject(coreOps, (name, func) => {
return [
name,
function (properties, state, context) {
let instruction = {
__protocolKitInstruction: true,
type: name,
... properties,
};
return yieldcore.Internal(func(instruction, state, context), instruction);
}
];
})
});