Skip to content
This repository was archived by the owner on Feb 23, 2022. It is now read-only.

Commit 94e2d57

Browse files
committed
Allow ::slotted(selectors)
1 parent bc00e32 commit 94e2d57

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/com/google/common/css/compiler/ast/GssParserCC.jj

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,7 @@ PARSER_END(GssParserCC)
707707
// Special handling needed because ':not' takes simple selectors as
708708
// an argument.
709709
| < NOTFUNCTION: "not" <LEFTROUND> >
710+
| < SLOTTEDFUNCTION: ":slotted" <LEFTROUND> >
710711
| < LANGFUNCTION: "lang" <LEFTROUND> >
711712

712713
// "calc("
@@ -906,11 +907,22 @@ CssRefinerNode pseudo() :
906907
String pseudo = null;
907908
String argument = null;
908909
List<Token> tokens = Lists.newArrayList();
909-
CssSelectorNode notSelector = null;
910+
CssSelectorNode innerSelector = null;
910911
}
911912
{
912913
t = <COLON> { beginLocation = this.getLocation(); tokens.add(t); }
913914
( ( t = <IDENTIFIER> { pseudo = t.image; tokens.add(t); } )
915+
|
916+
( // ::slotted( simple_selector )
917+
t = <SLOTTEDFUNCTION> ( <S> )* { beginLocation = this.getLocation();
918+
pseudo = t.image; tokens.add(t); }
919+
innerSelector = simpleSelector()
920+
( <S> )*
921+
t = <RIGHTROUND> { tokens.add(t);
922+
endLocation = this.getLocation();
923+
return nodeBuilder.buildPseudoClassNode(pseudo, innerSelector,
924+
this.mergeLocations(beginLocation, endLocation), tokens); }
925+
)
914926
|
915927
( // ::identifier (pseudo-element)
916928
t = <COLON> { tokens.add(t); }
@@ -923,11 +935,11 @@ CssRefinerNode pseudo() :
923935
( // :not( simple_selector )
924936
t = <NOTFUNCTION> ( <S> )* { beginLocation = this.getLocation();
925937
pseudo = t.image; tokens.add(t); }
926-
notSelector = simpleSelector()
938+
innerSelector = simpleSelector()
927939
( <S> )*
928940
t = <RIGHTROUND> { tokens.add(t);
929941
endLocation = this.getLocation();
930-
return nodeBuilder.buildPseudoClassNode(pseudo, notSelector,
942+
return nodeBuilder.buildPseudoClassNode(pseudo, innerSelector,
931943
this.mergeLocations(beginLocation, endLocation), tokens); }
932944
)
933945
|

0 commit comments

Comments
 (0)