@@ -787,7 +787,7 @@ Property mediaExpression() :
787787 <LROUND>
788788 ( <S> )*
789789 (
790- t = <IDENT> ( <S> )* { p = unescape(t.image, false); }
790+ t = identExcludingOnly() ( <S> )* { p = unescape(t.image, false); }
791791 | t = <CUSTOM_PROPERTY_NAME> ( <S> )* { p = unescape(t.image, false); }
792792 )
793793 (
@@ -826,7 +826,7 @@ String medium() :
826826 Token t;
827827}
828828{
829- t = <IDENT> ( <S> )*
829+ t = identExcludingOnly() ( <S> )*
830830 {
831831 return unescape(t.image, false);
832832 }
@@ -915,7 +915,7 @@ String pageSelector() :
915915 (
916916 pseudo = pseudoPage() { pseudos.append(pseudo); }
917917 |
918- ident = <IDENT> { pseudos.append(unescape(ident.image, false)); }
918+ ident = ident() { pseudos.append(unescape(ident.image, false)); }
919919 )
920920 ( pseudo = pseudoPage() { pseudos.append(pseudo); } )*
921921 ( <S> )*
@@ -933,7 +933,7 @@ String pseudoPage() :
933933 Token t;
934934}
935935{
936- <COLON> t = <IDENT> { return ":" + normalizeAndValidatePagePseudoClass(t); }
936+ <COLON> t = ident() { return ":" + normalizeAndValidatePagePseudoClass(t); }
937937}
938938
939939//
@@ -1373,7 +1373,7 @@ Object pseudo(boolean pseudoElementFound) :
13731373 (<COLON> { doubleColon = true; } )?
13741374
13751375 (
1376- t = <IDENT>
1376+ t = ident()
13771377 {
13781378 String s = unescape(t.image, false);
13791379 if (pseudoElementFound) { throw toCSSParseException("duplicatePseudo", new String[] { s }, locator); }
@@ -1401,7 +1401,7 @@ Object pseudo(boolean pseudoElementFound) :
14011401 (
14021402 t = <FUNCTION_LANG> { function = unescape(t.image, false); }
14031403 ( <S> )*
1404- t = <IDENT> { String lang = unescape(t.image, false); }
1404+ t = ident() { String lang = unescape(t.image, false); }
14051405 ( <S> )*
14061406 <RROUND>
14071407 {
@@ -1414,7 +1414,7 @@ Object pseudo(boolean pseudoElementFound) :
14141414 t = <FUNCTION> { function = unescape(t.image, false); StringBuilder args = new StringBuilder(); }
14151415 ( <S> )*
14161416 (
1417- (t = <PLUS> | t = <MINUS> | t = <DIMENSION> | t = <NUMBER> | t = <STRING> | t = <IDENT> )
1417+ (t = <PLUS> | t = <MINUS> | t = <DIMENSION> | t = <NUMBER> | t = <STRING> | t = ident() )
14181418 { args.append(unescape(t.image, false)); }
14191419 ( t = <S>
14201420 { args.append(unescape(t.image, false)); }
@@ -2370,6 +2370,31 @@ Token identExcludingInherit() :
23702370 }
23712371}
23722372
2373+ Token identExcludingOnly() :
2374+ {
2375+ Token t;
2376+ }
2377+ {
2378+ t = <IDENT> { return t; }
2379+ |
2380+ (
2381+ t = <INHERIT>
2382+ | t = <NONE>
2383+ | t = <FROM>
2384+ )
2385+ {
2386+ Token ident = new Token(IDENT, unescape(t.image, false));
2387+ ident.beginLine = t.beginLine;
2388+ ident.beginColumn = t.endColumn;
2389+ ident.endLine = t.beginLine;
2390+ ident.endColumn = t.endColumn;
2391+ ident.next = t.next;
2392+ ident.specialToken = t.specialToken;
2393+ return ident;
2394+
2395+ }
2396+ }
2397+
23732398
23742399//
23752400// number()
0 commit comments