@@ -1000,54 +1000,6 @@ function parseSelector(tokens) {
10001000 // @ts -ignore
10011001 value . typ = EnumToken . ChildCombinatorTokenType ;
10021002 }
1003- // @ts -ignore
1004- // else if (value.typ == EnumToken.WhitespaceTokenType) {
1005- //
1006- // if (nextValue != null && nextValue.typ == EnumToken.LiteralTokenType) {
1007- //
1008- // if (['>', '+', '~'].includes((<LiteralToken>nextValue).val)) {
1009- //
1010- // switch ((<LiteralToken>value).val) {
1011- //
1012- // case '>':
1013- // // @ts -ignore
1014- // nextValue.typ = EnumToken.ChildCombinatorTokenType;
1015- // break;
1016- //
1017- // case '+':
1018- // // @ts -ignore
1019- // nextValue.typ = EnumToken.NextSiblingCombinatorTokenType;
1020- // break;
1021- //
1022- // case '~':
1023- // // @ts -ignore
1024- // nextValue.typ = EnumToken.SubsequentSiblingCombinatorTokenType;
1025- // break;
1026- // }
1027- //
1028- // // @ts -ignore
1029- // delete (<LiteralToken>nextValue).val;
1030- //
1031- // continue;
1032- // }
1033- // }
1034- //
1035- // if (previousValue != null && [
1036- // EnumToken.ChildCombinatorTokenType,
1037- // EnumToken.DescendantCombinatorTokenType,
1038- // EnumToken.NextSiblingCombinatorTokenType,
1039- // EnumToken.SubsequentSiblingCombinatorTokenType,
1040- // EnumToken.ColumnCombinatorTokenType,
1041- // EnumToken.NameSpaceAttributeTokenType,
1042- // EnumToken.CommaTokenType
1043- // ].includes(previousValue.typ)) {
1044- //
1045- // continue;
1046- // }
1047- //
1048- // // @ts -ignore
1049- // value.typ = EnumToken.DescendantCombinatorTokenType;
1050- // }
10511003 else if ( value . typ == EnumToken . LiteralTokenType ) {
10521004 if ( value . val . charAt ( 0 ) == '&' ) {
10531005 // @ts -ignore
@@ -1065,13 +1017,6 @@ function parseSelector(tokens) {
10651017 value . typ = EnumToken . ClassSelectorTokenType ;
10661018 }
10671019 }
1068- // @ts -ignore
1069- // if ((<DelimToken>value).typ == EnumToken.DelimTokenType) {
1070- //
1071- // // @ts -ignore
1072- // (<NextSiblingCombinatorToken>value).typ = EnumToken.NextSiblingCombinatorTokenType;
1073- //
1074- // } else
10751020 if ( [ '*' , '>' , '+' , '~' ] . includes ( value . val ) ) {
10761021 switch ( value . val ) {
10771022 case '*' :
@@ -1137,10 +1082,6 @@ function parseSelector(tokens) {
11371082 }
11381083 return tokens ;
11391084}
1140- // export async function parseDeclarations(src: string, options: ParserOptions = {}): Promise<AstDeclaration[]> {
1141- //
1142- // return doParse(`.x{${src}`, options).then((result: ParseResult) => <AstDeclaration[]>(<AstRule>result.ast.chi[0]).chi.filter(t => t.typ == EnumToken.DeclarationNodeType));
1143- // }
11441085/**
11451086 * parse css string
11461087 * @param src
@@ -1609,33 +1550,7 @@ function parseTokens(tokens, options = {}) {
16091550 }
16101551 }
16111552 }
1612- // continue;
16131553 }
1614- // if (options.parseColor) {
1615- //
1616- // if (t.typ == EnumToken.IdenTokenType) {
1617- // // named color
1618- // const value: string = (t as IdentToken).val.toLowerCase();
1619- //
1620- // if (value in COLORS_NAMES) {
1621- // Object.assign(t, {
1622- // typ: EnumToken.ColorTokenType,
1623- // val: COLORS_NAMES[value].length < value.length ? COLORS_NAMES[value] : value,
1624- // kin: ColorKind.HEX
1625- // });
1626- // }
1627- //
1628- // continue;
1629- // }
1630- //
1631- // if (t.typ == EnumToken.HashTokenType && isHexColor((t as HashToken).val)) {
1632- // // hex color
1633- // // @ts -ignore
1634- // t.typ = EnumToken.ColorTokenType;
1635- // // @ts -ignore
1636- // (t as ColorToken).kin = ColorKind.HEX;
1637- // }
1638- // }
16391554 }
16401555 return tokens ;
16411556}
0 commit comments