MCPcopy Create free account
hub / github.com/MirrowApp/mirrow / parseCssStateDirectives

Method parseCssStateDirectives

packages/core/src/compiler/parser.ts:611–654  ·  view source on GitHub ↗
(
    parentKeyword: Keyword,
    directiveId: string
  )

Source from the content-addressed store, hash-verified

609 }
610
611 private parseCssStateDirectives(
612 parentKeyword: Keyword,
613 directiveId: string
614 ): CssStateDirective[] {
615 const { directives, blockToken } =
616 this.parseDirectiveGroup<CssStateDirective>({
617 parseDirective: () => {
618 const atToken = this.consume(
619 TokenType.AT,
620 `Unexpected token inside <${parentKeyword.name}>`
621 );
622 const stateToken = this.consume(
623 TokenType.IDENTIFIER,
624 `Expected CSS state name after '@' in <${parentKeyword.name}>`
625 );
626
627 if (!isCssState(stateToken.value)) {
628 throw new ParserError(
629 `Unknown CSS state '${stateToken.value}'`,
630 stateToken.position
631 );
632 }
633
634 return {
635 type: "CssState",
636 name: stateToken.value,
637 dataId: directiveId,
638 block: "",
639 position: atToken.position,
640 } satisfies CssStateDirective;
641 },
642 hasNext: () =>
643 this.check(TokenType.COMMA) && this.peek(1).type === TokenType.AT,
644 separatorMessage: "Expected ',' between CSS states",
645 blockMessageFor: (directive) =>
646 `Expected block for CSS state '${directive.name}' in <${parentKeyword.name}>`,
647 });
648
649 const blockValue = blockToken.value;
650 return directives.map((directive) => ({
651 ...directive,
652 block: blockValue,
653 }));
654 }
655
656 private parseJsEventDirectives(
657 parentKeyword: Keyword,

Callers 1

collectBlockEntriesMethod · 0.95

Calls 5

parseDirectiveGroupMethod · 0.95
consumeMethod · 0.95
checkMethod · 0.95
peekMethod · 0.95
isCssStateFunction · 0.85

Tested by

no test coverage detected