MCPcopy
hub / github.com/postcss/postcss / checkMissedSemicolon

Method checkMissedSemicolon

lib/parser.js:128–149  ·  view source on GitHub ↗
(tokens)

Source from the content-addressed store, hash-verified

126 }
127
128 checkMissedSemicolon(tokens) {
129 let colon = this.colon(tokens)
130 if (colon === false) return
131
132 let founded = 0
133 let token
134 for (let j = colon - 1; j >= 0; j--) {
135 token = tokens[j]
136 if (token[0] !== 'space') {
137 founded += 1
138 if (founded === 2) break
139 }
140 }
141 // If the token is a word, e.g. `!important`, `red` or any other valid
142 // property's value. Then we need to return the colon after that word
143 // token. [3] is the "end" colon of that word. And because we need it
144 // after that one we do +1 to get the next one.
145 throw this.input.error(
146 'Missed semicolon',
147 token[0] === 'word' ? token[3] + 1 : token[2]
148 )
149 }
150
151 colon(tokens) {
152 let brackets = 0

Callers 1

declMethod · 0.95

Calls 2

colonMethod · 0.95
errorMethod · 0.45

Tested by

no test coverage detected