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
432 B
JavaScript
17 lines
432 B
JavaScript
2 years ago
|
"use strict";
|
||
|
|
||
|
const yieldcore = require("../yieldcore");
|
||
|
const { NoMatch } = require("../symbols");
|
||
|
const zeroOrMore = require("./zero-or-more");
|
||
|
|
||
|
module.exports = function* oneOrMore(instruction, state, context) {
|
||
|
let matches = yield yieldcore.Internal(zeroOrMore(instruction, state, context));
|
||
|
|
||
|
// FIXME: NotEnoughInput propagation necessary here?
|
||
|
if (matches.length > 0) {
|
||
|
return matches;
|
||
|
} else {
|
||
|
return NoMatch;
|
||
|
}
|
||
|
};
|