MCPcopy
hub / github.com/postcss/autoprefixer / parse

Function parse

lib/brackets.js:9–32  ·  view source on GitHub ↗

* Parse string to nodes tree

(str)

Source from the content-addressed store, hash-verified

7 * Parse string to nodes tree
8 */
9 parse(str) {
10 let current = ['']
11 let stack = [current]
12
13 for (let sym of str) {
14 if (sym === '(') {
15 current = ['']
16 last(stack).push(current)
17 stack.push(current)
18 continue
19 }
20
21 if (sym === ')') {
22 stack.pop()
23 current = last(stack)
24 current.push('')
25 continue
26 }
27
28 current[current.length - 1] += sym
29 }
30
31 return stack[0]
32 },
33
34 /**
35 * Generate output string by nodes tree

Callers 8

virtualMethod · 0.70
value.test.jsFile · 0.50
prefixer.test.jsFile · 0.50
selector.test.jsFile · 0.50
prefixes.test.jsFile · 0.50
at-rule.test.jsFile · 0.50

Calls 1

lastFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…