Files
med-notes/.pnpm-store/v10/files/67/a249d31470ec459ebf8a020ba9bcc202e837de4e264c4866f23915fbd89a395f8e339f307c6cc94f90eec020a84061c9156bbbac0d9f07f9c69d6ec5d9f5c7
2025-05-09 05:30:08 +02:00

42 lines
1.0 KiB
Plaintext

/**
* @fileoverview Define the cursor which ignores the first few tokens.
* @author Toru Nagashima
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const DecorativeCursor = require("./decorative-cursor");
//------------------------------------------------------------------------------
// Exports
//------------------------------------------------------------------------------
/**
* The decorative cursor which ignores the first few tokens.
*/
module.exports = class SkipCursor extends DecorativeCursor {
/**
* Initializes this cursor.
* @param {Cursor} cursor The cursor to be decorated.
* @param {number} count The count of tokens this cursor skips.
*/
constructor(cursor, count) {
super(cursor);
this.count = count;
}
/** @inheritdoc */
moveNext() {
while (this.count > 0) {
this.count -= 1;
if (!super.moveNext()) {
return false;
}
}
return super.moveNext();
}
};