Skip to content

Commit 6ed0bde

Browse files
committed
Fix formatting
1 parent 655d280 commit 6ed0bde

File tree

1 file changed

+49
-11
lines changed

1 file changed

+49
-11
lines changed

lib/parse.js

+49-11
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@ module.exports = function (input) {
4242
} else if (code === comma || code === colon || code === slash && value.charCodeAt(next + 1) !== star) {
4343
before = token;
4444
} else {
45-
tokens.push({ type: 'space', sourceIndex: pos, value: token });
45+
tokens.push({
46+
type: 'space',
47+
sourceIndex: pos,
48+
value: token
49+
});
4650
}
4751

4852
pos = next;
@@ -51,7 +55,11 @@ module.exports = function (input) {
5155
} else if (code === singleQuote || code === doubleQuote) {
5256
next = pos;
5357
quote = code === singleQuote ? '\'' : '"';
54-
token = { type: 'string', sourceIndex: pos, quote: quote };
58+
token = {
59+
type: 'string',
60+
sourceIndex: pos,
61+
quote: quote
62+
};
5563
do {
5664
escape = false;
5765
next = value.indexOf(quote, next + 1);
@@ -75,7 +83,10 @@ module.exports = function (input) {
7583

7684
//Comments
7785
} else if (code === slash && value.charCodeAt(pos + 1) === star) {
78-
token = { type: 'comment', sourceIndex: pos};
86+
token = {
87+
type: 'comment',
88+
sourceIndex: pos
89+
};
7990

8091
next = value.indexOf('*/', pos);
8192
if (next === -1) {
@@ -93,7 +104,13 @@ module.exports = function (input) {
93104
} else if (code === slash || code === comma || code === colon) {
94105
token = value[pos];
95106

96-
tokens.push({ type: 'div', sourceIndex: pos - before.length, value: token, before: before, after: '' });
107+
tokens.push({
108+
type: 'div',
109+
sourceIndex: pos - before.length,
110+
value: token,
111+
before: before,
112+
after: ''
113+
});
97114
before = '';
98115

99116
pos += 1;
@@ -107,7 +124,12 @@ module.exports = function (input) {
107124
next += 1;
108125
code = value.charCodeAt(next);
109126
} while (code <= 32);
110-
token = { type: 'function', sourceIndex: pos - name.length, value: name, before: value.slice(pos + 1, next) };
127+
token = {
128+
type: 'function',
129+
sourceIndex: pos - name.length,
130+
value: name,
131+
before: value.slice(pos + 1, next)
132+
};
111133
pos = next;
112134

113135
if (name === 'url' && code !== singleQuote && code !== doubleQuote) {
@@ -134,13 +156,21 @@ module.exports = function (input) {
134156
code = value.charCodeAt(whitespacePos);
135157
} while (code <= 32);
136158
if (pos !== whitespacePos + 1) {
137-
token.nodes = [{ type: 'word', sourceIndex: pos, value: value.slice(pos, whitespacePos + 1) }];
159+
token.nodes = [{
160+
type: 'word',
161+
sourceIndex: pos,
162+
value: value.slice(pos, whitespacePos + 1)
163+
}];
138164
} else {
139165
token.nodes = [];
140166
}
141167
if (token.unclosed && whitespacePos + 1 !== next) {
142168
token.after = '';
143-
token.nodes.push({ type: 'space', sourceIndex: whitespacePos + 1, value: value.slice(whitespacePos + 1, next) });
169+
token.nodes.push({
170+
type: 'space',
171+
sourceIndex: whitespacePos + 1,
172+
value: value.slice(whitespacePos + 1, next)
173+
});
144174
} else {
145175
token.after = value.slice(whitespacePos + 1, next);
146176
}
@@ -180,16 +210,24 @@ module.exports = function (input) {
180210
code = value.charCodeAt(next);
181211
} while (next < max && !(
182212
code <= 32 ||
183-
code === singleQuote || code === doubleQuote ||
184-
code === slash && value.charCodeAt(next + 1) !== star || code === comma || code === colon ||
185-
code === openParentheses || code === closeParentheses && balanced
213+
code === singleQuote ||
214+
code === doubleQuote ||
215+
code === comma ||
216+
code === colon ||
217+
code === slash && value.charCodeAt(next + 1) !== star ||
218+
code === openParentheses ||
219+
code === closeParentheses && balanced
186220
));
187221
token = value.slice(pos, next);
188222

189223
if (openParentheses === code) {
190224
name = token;
191225
} else {
192-
tokens.push({ type: 'word', sourceIndex: pos, value: token });
226+
tokens.push({
227+
type: 'word',
228+
sourceIndex: pos,
229+
value: token
230+
});
193231
}
194232

195233
pos = next;

0 commit comments

Comments
 (0)