MCPcopy Index your code
hub / github.com/NativeScript/NativeScript / consumeAToken

Method consumeAToken

packages/core/css/CSS3Parser.ts:147–227  ·  view source on GitHub ↗

* 4.3.1. Consume a token * https://www.w3.org/TR/css-syntax-3/#consume-a-token

()

Source from the content-addressed store, hash-verified

145 * https://www.w3.org/TR/css-syntax-3/#consume-a-token
146 */
147 private consumeAToken(): InputToken {
148 if (this.reconsumedInputToken) {
149 const result = this.reconsumedInputToken;
150 this.reconsumedInputToken = null;
151
152 return result;
153 }
154 const char = this.text[this.nextInputCodePointIndex];
155 switch (char) {
156 case '"':
157 return this.consumeAStringToken();
158 case "'":
159 return this.consumeAStringToken();
160 case '(':
161 case ')':
162 case ',':
163 case ':':
164 case ';':
165 case '[':
166 case ']':
167 case '{':
168 case '}':
169 this.nextInputCodePointIndex++;
170
171 return <any>char;
172 case '#':
173 return this.consumeAHashToken() || this.consumeADelimToken();
174 case ' ':
175 case '\t':
176 case '\n':
177 case '\r':
178 case '\f':
179 return this.consumeAWhitespace();
180 case '@':
181 return this.consumeAtKeyword() || this.consumeADelimToken();
182 // TODO: Only if this is valid escape, otherwise it is a parse error
183 case '\\':
184 return this.consumeAnIdentLikeToken() || this.consumeADelimToken();
185 case '0':
186 case '1':
187 case '2':
188 case '3':
189 case '4':
190 case '5':
191 case '6':
192 case '7':
193 case '8':
194 case '9':
195 return this.consumeANumericToken();
196 case 'u':
197 case 'U':
198 if (this.text[this.nextInputCodePointIndex + 1] === '+') {
199 const thirdChar = this.text[this.nextInputCodePointIndex + 2];
200 if ((thirdChar >= '0' && thirdChar <= '9') || thirdChar === '?') {
201 // TODO: Handle unicode stuff such as U+002B
202 throw new Error('Unicode tokens not supported!');
203 }
204 }

Callers 6

tokenizeMethod · 0.95
consumeACommentMethod · 0.95
consumeAListOfRulesMethod · 0.95
consumeAnAtRuleMethod · 0.95
consumeAQualifiedRuleMethod · 0.95

Calls 11

consumeAStringTokenMethod · 0.95
consumeAHashTokenMethod · 0.95
consumeADelimTokenMethod · 0.95
consumeAWhitespaceMethod · 0.95
consumeAtKeywordMethod · 0.95
consumeANumericTokenMethod · 0.95
consumeAMatchTokenMethod · 0.95
consumeCDCMethod · 0.95
consumeACommentMethod · 0.95
consumeCDOMethod · 0.95

Tested by

no test coverage detected