source: imaps-frontend/node_modules/css-tree/lib/syntax/node/DeclarationList.js

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 1.2 KB
Line 
1var TYPE = require('../../tokenizer').TYPE;
2var rawMode = require('./Raw').mode;
3
4var WHITESPACE = TYPE.WhiteSpace;
5var COMMENT = TYPE.Comment;
6var SEMICOLON = TYPE.Semicolon;
7
8function consumeRaw(startToken) {
9 return this.Raw(startToken, rawMode.semicolonIncluded, true);
10}
11
12module.exports = {
13 name: 'DeclarationList',
14 structure: {
15 children: [[
16 'Declaration'
17 ]]
18 },
19 parse: function() {
20 var children = this.createList();
21
22 scan:
23 while (!this.scanner.eof) {
24 switch (this.scanner.tokenType) {
25 case WHITESPACE:
26 case COMMENT:
27 case SEMICOLON:
28 this.scanner.next();
29 break;
30
31 default:
32 children.push(this.parseWithFallback(this.Declaration, consumeRaw));
33 }
34 }
35
36 return {
37 type: 'DeclarationList',
38 loc: this.getLocationFromList(children),
39 children: children
40 };
41 },
42 generate: function(node) {
43 this.children(node, function(prev) {
44 if (prev.type === 'Declaration') {
45 this.chunk(';');
46 }
47 });
48 }
49};
Note: See TracBrowser for help on using the repository browser.