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
|
Rev | Line | |
---|
[6a3a178] | 1 | var TYPE = require('../../tokenizer').TYPE;
|
---|
| 2 |
|
---|
| 3 | var SEMICOLON = TYPE.Semicolon;
|
---|
| 4 | var LEFTCURLYBRACKET = TYPE.LeftCurlyBracket;
|
---|
| 5 |
|
---|
| 6 | module.exports = {
|
---|
| 7 | name: 'AtrulePrelude',
|
---|
| 8 | structure: {
|
---|
| 9 | children: [[]]
|
---|
| 10 | },
|
---|
| 11 | parse: function(name) {
|
---|
| 12 | var children = null;
|
---|
| 13 |
|
---|
| 14 | if (name !== null) {
|
---|
| 15 | name = name.toLowerCase();
|
---|
| 16 | }
|
---|
| 17 |
|
---|
| 18 | this.scanner.skipSC();
|
---|
| 19 |
|
---|
| 20 | if (this.atrule.hasOwnProperty(name) &&
|
---|
| 21 | typeof this.atrule[name].prelude === 'function') {
|
---|
| 22 | // custom consumer
|
---|
| 23 | children = this.atrule[name].prelude.call(this);
|
---|
| 24 | } else {
|
---|
| 25 | // default consumer
|
---|
| 26 | children = this.readSequence(this.scope.AtrulePrelude);
|
---|
| 27 | }
|
---|
| 28 |
|
---|
| 29 | this.scanner.skipSC();
|
---|
| 30 |
|
---|
| 31 | if (this.scanner.eof !== true &&
|
---|
| 32 | this.scanner.tokenType !== LEFTCURLYBRACKET &&
|
---|
| 33 | this.scanner.tokenType !== SEMICOLON) {
|
---|
| 34 | this.error('Semicolon or block is expected');
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | if (children === null) {
|
---|
| 38 | children = this.createList();
|
---|
| 39 | }
|
---|
| 40 |
|
---|
| 41 | return {
|
---|
| 42 | type: 'AtrulePrelude',
|
---|
| 43 | loc: this.getLocationFromList(children),
|
---|
| 44 | children: children
|
---|
| 45 | };
|
---|
| 46 | },
|
---|
| 47 | generate: function(node) {
|
---|
| 48 | this.children(node);
|
---|
| 49 | },
|
---|
| 50 | walkContext: 'atrulePrelude'
|
---|
| 51 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.