counter-reset.js 995 B

123456789101112131415161718192021222324252627
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. var IPropertyDescriptor_1 = require("../IPropertyDescriptor");
  4. var parser_1 = require("../syntax/parser");
  5. exports.counterReset = {
  6. name: 'counter-reset',
  7. initialValue: 'none',
  8. prefix: true,
  9. type: IPropertyDescriptor_1.PropertyDescriptorParsingType.LIST,
  10. parse: function (tokens) {
  11. if (tokens.length === 0) {
  12. return [];
  13. }
  14. var resets = [];
  15. var filtered = tokens.filter(parser_1.nonWhiteSpace);
  16. for (var i = 0; i < filtered.length; i++) {
  17. var counter = filtered[i];
  18. var next = filtered[i + 1];
  19. if (parser_1.isIdentToken(counter) && counter.value !== 'none') {
  20. var reset = next && parser_1.isNumberToken(next) ? next.number : 0;
  21. resets.push({ counter: counter.value, reset: reset });
  22. }
  23. }
  24. return resets;
  25. }
  26. };
  27. //# sourceMappingURL=counter-reset.js.map