Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

padded-token-cursor.js 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /**
  2. * @fileoverview Define the cursor which iterates tokens only, with inflated range.
  3. * @author Toru Nagashima
  4. */
  5. "use strict";
  6. //------------------------------------------------------------------------------
  7. // Requirements
  8. //------------------------------------------------------------------------------
  9. const ForwardTokenCursor = require("./forward-token-cursor");
  10. //------------------------------------------------------------------------------
  11. // Exports
  12. //------------------------------------------------------------------------------
  13. /**
  14. * The cursor which iterates tokens only, with inflated range.
  15. * This is for the backward compatibility of padding options.
  16. */
  17. module.exports = class PaddedTokenCursor extends ForwardTokenCursor {
  18. /**
  19. * Initializes this cursor.
  20. * @param {Token[]} tokens The array of tokens.
  21. * @param {Comment[]} comments The array of comments.
  22. * @param {Object} indexMap The map from locations to indices in `tokens`.
  23. * @param {number} startLoc The start location of the iteration range.
  24. * @param {number} endLoc The end location of the iteration range.
  25. * @param {number} beforeCount The number of tokens this cursor iterates before start.
  26. * @param {number} afterCount The number of tokens this cursor iterates after end.
  27. */
  28. constructor(tokens, comments, indexMap, startLoc, endLoc, beforeCount, afterCount) {
  29. super(tokens, comments, indexMap, startLoc, endLoc);
  30. this.index = Math.max(0, this.index - beforeCount);
  31. this.indexEnd = Math.min(tokens.length - 1, this.indexEnd + afterCount);
  32. }
  33. };