mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-01 01:38:07 +08:00
These packages will be used to dynamically optimize SVG images during the build. R=jacktfranklin@chromium.org Bug: 1216402 Change-Id: I04e95aa7d79c9d67beaf8a7861182c52b16b7d0f Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2939992 Reviewed-by: Jack Franklin <jacktfranklin@chromium.org> Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
52 lines
1.3 KiB
JavaScript
52 lines
1.3 KiB
JavaScript
module.exports = {
|
|
name: 'Nth',
|
|
structure: {
|
|
nth: ['AnPlusB', 'Identifier'],
|
|
selector: ['SelectorList', null]
|
|
},
|
|
parse: function(allowOfClause) {
|
|
this.scanner.skipSC();
|
|
|
|
var start = this.scanner.tokenStart;
|
|
var end = start;
|
|
var selector = null;
|
|
var query;
|
|
|
|
if (this.scanner.lookupValue(0, 'odd') || this.scanner.lookupValue(0, 'even')) {
|
|
query = this.Identifier();
|
|
} else {
|
|
query = this.AnPlusB();
|
|
}
|
|
|
|
this.scanner.skipSC();
|
|
|
|
if (allowOfClause && this.scanner.lookupValue(0, 'of')) {
|
|
this.scanner.next();
|
|
|
|
selector = this.SelectorList();
|
|
|
|
if (this.needPositions) {
|
|
end = this.getLastListNode(selector.children).loc.end.offset;
|
|
}
|
|
} else {
|
|
if (this.needPositions) {
|
|
end = query.loc.end.offset;
|
|
}
|
|
}
|
|
|
|
return {
|
|
type: 'Nth',
|
|
loc: this.getLocation(start, end),
|
|
nth: query,
|
|
selector: selector
|
|
};
|
|
},
|
|
generate: function(node) {
|
|
this.node(node.nth);
|
|
if (node.selector !== null) {
|
|
this.chunk(' of ');
|
|
this.node(node.selector);
|
|
}
|
|
}
|
|
};
|