2 * @fileoverview Define the cursor which ignores specified tokens.
3 * @author Toru Nagashima
7 //------------------------------------------------------------------------------
9 //------------------------------------------------------------------------------
11 const DecorativeCursor = require("./decorative-cursor");
13 //------------------------------------------------------------------------------
15 //------------------------------------------------------------------------------
18 * The decorative cursor which ignores specified tokens.
20 module.exports = class FilterCursor extends DecorativeCursor {
23 * Initializes this cursor.
24 * @param {Cursor} cursor The cursor to be decorated.
25 * @param {Function} predicate The predicate function to decide tokens this cursor iterates.
27 constructor(cursor, predicate) {
29 this.predicate = predicate;
34 const predicate = this.predicate;
36 while (super.moveNext()) {
37 if (predicate(this.current)) {