Last change
on this file since 6c1585f was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.3 KB
|
Line | |
---|
1 | var TYPE = require('../../tokenizer').TYPE;
|
---|
2 | var rawMode = require('../node/Raw').mode;
|
---|
3 |
|
---|
4 | var COMMA = TYPE.Comma;
|
---|
5 | var WHITESPACE = TYPE.WhiteSpace;
|
---|
6 |
|
---|
7 | // var( <ident> , <value>? )
|
---|
8 | module.exports = function() {
|
---|
9 | var children = this.createList();
|
---|
10 |
|
---|
11 | this.scanner.skipSC();
|
---|
12 |
|
---|
13 | // NOTE: Don't check more than a first argument is an ident, rest checks are for lexer
|
---|
14 | children.push(this.Identifier());
|
---|
15 |
|
---|
16 | this.scanner.skipSC();
|
---|
17 |
|
---|
18 | if (this.scanner.tokenType === COMMA) {
|
---|
19 | children.push(this.Operator());
|
---|
20 |
|
---|
21 | const startIndex = this.scanner.tokenIndex;
|
---|
22 | const value = this.parseCustomProperty
|
---|
23 | ? this.Value(null)
|
---|
24 | : this.Raw(this.scanner.tokenIndex, rawMode.exclamationMarkOrSemicolon, false);
|
---|
25 |
|
---|
26 | if (value.type === 'Value' && value.children.isEmpty()) {
|
---|
27 | for (let offset = startIndex - this.scanner.tokenIndex; offset <= 0; offset++) {
|
---|
28 | if (this.scanner.lookupType(offset) === WHITESPACE) {
|
---|
29 | value.children.appendData({
|
---|
30 | type: 'WhiteSpace',
|
---|
31 | loc: null,
|
---|
32 | value: ' '
|
---|
33 | });
|
---|
34 | break;
|
---|
35 | }
|
---|
36 | }
|
---|
37 | }
|
---|
38 |
|
---|
39 | children.push(value);
|
---|
40 | }
|
---|
41 |
|
---|
42 | return children;
|
---|
43 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.