source: trip-planner-front/node_modules/css-tree/lib/parser/sequence.js@ 6a3a178

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

initial commit

  • Property mode set to 100644
File size: 1.2 KB
Line 
1var TYPE = require('../tokenizer').TYPE;
2var WHITESPACE = TYPE.WhiteSpace;
3var COMMENT = TYPE.Comment;
4
5module.exports = function readSequence(recognizer) {
6 var children = this.createList();
7 var child = null;
8 var context = {
9 recognizer: recognizer,
10 space: null,
11 ignoreWS: false,
12 ignoreWSAfter: false
13 };
14
15 this.scanner.skipSC();
16
17 while (!this.scanner.eof) {
18 switch (this.scanner.tokenType) {
19 case COMMENT:
20 this.scanner.next();
21 continue;
22
23 case WHITESPACE:
24 if (context.ignoreWS) {
25 this.scanner.next();
26 } else {
27 context.space = this.WhiteSpace();
28 }
29 continue;
30 }
31
32 child = recognizer.getNode.call(this, context);
33
34 if (child === undefined) {
35 break;
36 }
37
38 if (context.space !== null) {
39 children.push(context.space);
40 context.space = null;
41 }
42
43 children.push(child);
44
45 if (context.ignoreWSAfter) {
46 context.ignoreWSAfter = false;
47 context.ignoreWS = true;
48 } else {
49 context.ignoreWS = false;
50 }
51 }
52
53 return children;
54};
Note: See TracBrowser for help on using the repository browser.