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

Method consumeANumericToken

packages/core/css/CSS3Parser.ts:290–310  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

288 * https://www.w3.org/TR/css-syntax-3/#consume-a-numeric-token
289 */
290 private consumeANumericToken(): InputToken {
291 numberRegEx.lastIndex = this.nextInputCodePointIndex;
292 const result = numberRegEx.exec(this.text);
293 if (!result) {
294 return null;
295 }
296 this.nextInputCodePointIndex = numberRegEx.lastIndex;
297 if (this.text[this.nextInputCodePointIndex] === '%') {
298 return { type: TokenObjectType.percentage, text: result[0] }; // TODO: Push the actual number and unit here...
299 }
300
301 const name = this.consumeAName();
302 if (name) {
303 return {
304 type: TokenObjectType.dimension,
305 text: result[0] + name.text,
306 };
307 }
308
309 return { type: TokenObjectType.number, text: result[0] };
310 }
311
312 /**
313 * 4.3.3. Consume an ident-like token

Callers 1

consumeATokenMethod · 0.95

Calls 1

consumeANameMethod · 0.95

Tested by

no test coverage detected