source: trip-planner-front/node_modules/css-tree/lib/syntax/node/Nth.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.3 KB
Line 
1module.exports = {
2 name: 'Nth',
3 structure: {
4 nth: ['AnPlusB', 'Identifier'],
5 selector: ['SelectorList', null]
6 },
7 parse: function(allowOfClause) {
8 this.scanner.skipSC();
9
10 var start = this.scanner.tokenStart;
11 var end = start;
12 var selector = null;
13 var query;
14
15 if (this.scanner.lookupValue(0, 'odd') || this.scanner.lookupValue(0, 'even')) {
16 query = this.Identifier();
17 } else {
18 query = this.AnPlusB();
19 }
20
21 this.scanner.skipSC();
22
23 if (allowOfClause && this.scanner.lookupValue(0, 'of')) {
24 this.scanner.next();
25
26 selector = this.SelectorList();
27
28 if (this.needPositions) {
29 end = this.getLastListNode(selector.children).loc.end.offset;
30 }
31 } else {
32 if (this.needPositions) {
33 end = query.loc.end.offset;
34 }
35 }
36
37 return {
38 type: 'Nth',
39 loc: this.getLocation(start, end),
40 nth: query,
41 selector: selector
42 };
43 },
44 generate: function(node) {
45 this.node(node.nth);
46 if (node.selector !== null) {
47 this.chunk(' of ');
48 this.node(node.selector);
49 }
50 }
51};
Note: See TracBrowser for help on using the repository browser.