MCPcopy Create free account
hub / github.com/NativeScript/NativeScript / consumeAFunction

Method consumeAFunction

packages/core/css/CSS3Parser.ts:664–696  ·  view source on GitHub ↗

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

(name: string)

Source from the content-addressed store, hash-verified

662 * https://www.w3.org/TR/css-syntax-3/#consume-a-function
663 */
664 private consumeAFunction(name: string): InputToken {
665 const start = this.nextInputCodePointIndex;
666 const funcToken: FunctionToken = {
667 type: TokenObjectType.function,
668 name,
669 text: undefined,
670 components: [],
671 };
672 do {
673 if (this.nextInputCodePointIndex >= this.text.length) {
674 funcToken.text = name + '(' + this.text.substring(start);
675
676 return funcToken;
677 }
678 const nextInputToken = this.text[this.nextInputCodePointIndex];
679 switch (nextInputToken) {
680 case ')': {
681 this.nextInputCodePointIndex++;
682 const end = this.nextInputCodePointIndex;
683 funcToken.text = name + '(' + this.text.substring(start, end);
684
685 return funcToken;
686 }
687 default: {
688 const component = this.consumeAComponentValue();
689 if (component) {
690 funcToken.components.push(component);
691 }
692 }
693 // TODO: Else we won't advance
694 }
695 } while (true);
696 }
697}

Callers 1

Calls 2

pushMethod · 0.45

Tested by

no test coverage detected