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.2 KB
|
Line | |
---|
1 | var TYPE = require('../../tokenizer').TYPE;
|
---|
2 | var rawMode = require('./Raw').mode;
|
---|
3 |
|
---|
4 | var WHITESPACE = TYPE.WhiteSpace;
|
---|
5 | var COMMENT = TYPE.Comment;
|
---|
6 | var SEMICOLON = TYPE.Semicolon;
|
---|
7 |
|
---|
8 | function consumeRaw(startToken) {
|
---|
9 | return this.Raw(startToken, rawMode.semicolonIncluded, true);
|
---|
10 | }
|
---|
11 |
|
---|
12 | module.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.