Skip to content

Commit 1bb280a

Browse files
committed
use ident() at more places
1 parent 3086b94 commit 1bb280a

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

src/main/javacc/CSS3Parser.jj

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1606,7 +1606,7 @@ LexicalUnit term(LexicalUnit prev) :
16061606
| t = "progid:" { value = LexicalUnitImpl.createIdent(prev, skipUnit().trim()); }
16071607
|
16081608
(
1609-
t = <IDENT>
1609+
t = identExcludingInherit()
16101610
( <COLON> { throw toCSSParseException("invalidExprColon", new String[]{ unescape(t.image, false) }, createLocator(t)); } )?
16111611
)
16121612
{ value = LexicalUnitImpl.createIdent(prev, unescape(t.image, false)); }
@@ -1622,9 +1622,6 @@ LexicalUnit term(LexicalUnit prev) :
16221622
t.image.substring(n+1));
16231623
}
16241624
| t = <INHERIT> { value = LexicalUnitImpl.createInherit(prev); }
1625-
| t = <ONLY> { value = LexicalUnitImpl.createIdent(prev, unescape(t.image, false)); }
1626-
| t = <NONE> { value = LexicalUnitImpl.createIdent(prev, unescape(t.image, false)); }
1627-
| t = <FROM> { value = LexicalUnitImpl.createIdent(prev, unescape(t.image, false)); }
16281625
)
16291626
{
16301627
if (locator == null)
@@ -2348,6 +2345,31 @@ Token ident() :
23482345
}
23492346
}
23502347

2348+
Token identExcludingInherit() :
2349+
{
2350+
Token t;
2351+
}
2352+
{
2353+
t = <IDENT> { return t; }
2354+
|
2355+
(
2356+
t = <ONLY>
2357+
| t = <NONE>
2358+
| t = <FROM>
2359+
)
2360+
{
2361+
Token ident = new Token(IDENT, unescape(t.image, false));
2362+
ident.beginLine = t.beginLine;
2363+
ident.beginColumn = t.endColumn;
2364+
ident.endLine = t.beginLine;
2365+
ident.endColumn = t.endColumn;
2366+
ident.next = t.next;
2367+
ident.specialToken = t.specialToken;
2368+
return ident;
2369+
2370+
}
2371+
}
2372+
23512373

23522374
//
23532375
// number()

0 commit comments

Comments
 (0)