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
507 B
JavaScript

"use strict";
const { NotEnoughInput, NoMatch } = require("../symbols");
module.exports = function* endOfInput(_instruction, state) {
// FIXME: Make this not order-sensitive in an `either`! Currently the NotEnoughInput marker *might* cause issues if this (zero-width) rule comes after nonzero-width rules? Need to investigate.
if (state.currentIndex === state.currentInput.length) {
if (state.isFullyLoaded) {
return true;
} else {
return NotEnoughInput;
}
} else {
return NoMatch;
}
};