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.

17 lines
461 B
JavaScript

2 years ago
"use strict";
const { NoMatch } = require("../symbols");
2 years ago
const coreOps = require("./index");
2 years ago
module.exports = function* oneOrMore(instruction, state, context) {
2 years ago
let matches = yield coreOps.internalCall.zeroOrMore({ rule: instruction.rule }, state, context);
2 years ago
// FIXME: NotEnoughInput propagation necessary here?
2 years ago
// FIXME: Do we need this array check?
if (Array.isArray(matches) && matches.length > 0) {
2 years ago
return matches;
} else {
return NoMatch;
}
};