counter-increment.js 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.counterIncrement = void 0;
  4. var parser_1 = require("../syntax/parser");
  5. exports.counterIncrement = {
  6. name: 'counter-increment',
  7. initialValue: 'none',
  8. prefix: true,
  9. type: 1 /* LIST */,
  10. parse: function (_context, tokens) {
  11. if (tokens.length === 0) {
  12. return null;
  13. }
  14. var first = tokens[0];
  15. if (first.type === 20 /* IDENT_TOKEN */ && first.value === 'none') {
  16. return null;
  17. }
  18. var increments = [];
  19. var filtered = tokens.filter(parser_1.nonWhiteSpace);
  20. for (var i = 0; i < filtered.length; i++) {
  21. var counter = filtered[i];
  22. var next = filtered[i + 1];
  23. if (counter.type === 20 /* IDENT_TOKEN */) {
  24. var increment = next && parser_1.isNumberToken(next) ? next.number : 1;
  25. increments.push({ counter: counter.value, increment: increment });
  26. }
  27. }
  28. return increments;
  29. }
  30. };
  31. //# sourceMappingURL=counter-increment.js.map