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
17 lines
461 B
JavaScript
"use strict";
|
|
|
|
const { NoMatch } = require("../symbols");
|
|
const coreOps = require("./index");
|
|
|
|
module.exports = function* oneOrMore(instruction, state, context) {
|
|
let matches = yield coreOps.internalCall.zeroOrMore({ rule: instruction.rule }, state, context);
|
|
|
|
// FIXME: NotEnoughInput propagation necessary here?
|
|
// FIXME: Do we need this array check?
|
|
if (Array.isArray(matches) && matches.length > 0) {
|
|
return matches;
|
|
} else {
|
|
return NoMatch;
|
|
}
|
|
};
|