Skip to content

Commit 34d8366

Browse files
committed
introduce from keyword
1 parent 7bbc5e6 commit 34d8366

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/main/javacc/CSS3Parser.jj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ TOKEN_MGR_DECLS :
169169

170170
| < INHERIT: "inherit" >
171171
| < NONE: "none" >
172+
| < FROM: "from" >
172173

173174
// ident -?{nmstart}{nmchar}*
174175
// {ident} {return IDENT;}
@@ -1623,6 +1624,7 @@ LexicalUnit term(LexicalUnit prev) :
16231624
| t = <INHERIT> { value = LexicalUnitImpl.createInherit(prev); }
16241625
| t = <ONLY> { value = LexicalUnitImpl.createIdent(prev, unescape(t.image, false)); }
16251626
| t = <NONE> { value = LexicalUnitImpl.createIdent(prev, unescape(t.image, false)); }
1627+
| t = <FROM> { value = LexicalUnitImpl.createIdent(prev, unescape(t.image, false)); }
16261628
)
16271629
{
16281630
if (locator == null)
@@ -2331,6 +2333,7 @@ Token ident() :
23312333
t = <INHERIT>
23322334
| t = <ONLY>
23332335
| t = <NONE>
2336+
| t = <FROM>
23342337
)
23352338
{
23362339
Token ident = new Token(IDENT, unescape(t.image, false));

src/test/java/org/htmlunit/cssparser/parser/CSS3ParserTest.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ public void selector() throws Exception {
112112
selectorType(".inherit", SelectorType.ELEMENT_NODE_SELECTOR);
113113
selectorType(".only", SelectorType.ELEMENT_NODE_SELECTOR);
114114
selectorType(".none", SelectorType.ELEMENT_NODE_SELECTOR);
115+
selectorType(".from", SelectorType.ELEMENT_NODE_SELECTOR);
115116
}
116117

117118
/**
@@ -232,6 +233,7 @@ public void condition() throws Exception {
232233
conditionType(".inherit", ConditionType.CLASS_CONDITION);
233234
conditionType(".only", ConditionType.CLASS_CONDITION);
234235
conditionType(".none", ConditionType.CLASS_CONDITION);
236+
conditionType(".from", ConditionType.CLASS_CONDITION);
235237
}
236238

237239
/**
@@ -2449,15 +2451,15 @@ public void malformedDeclaration() throws Exception {
24492451
assertEquals(7, errorHandler.getErrorCount());
24502452
final String expected = "Error in declaration. (Invalid token \"}\". Was expecting one of: <S>, \":\".)"
24512453
+ " Error in declaration. (Invalid token \";\". Was expecting one of: <S>, \":\".)"
2452-
+ " Error in expression. (Invalid token \"}\". Was expecting one of: <S>, \"only\", <NUMBER>, \"inherit\", \"none\", "
2454+
+ " Error in expression. (Invalid token \"}\". Was expecting one of: <S>, \"only\", <NUMBER>, \"inherit\", \"none\", \"from\", "
24532455
+ "<IDENT>, <STRING>, \"-\", \"+\", <HASH>, <EMS>, <REM>, <EXS>, <CH>, "
24542456
+ "<VW>, <VH>, <VMIN>, <VMAX>, "
24552457
+ "<LENGTH_PX>, <LENGTH_CM>, <LENGTH_MM>, <LENGTH_IN>, <LENGTH_PT>, <LENGTH_PC>, <LENGTH_Q>, "
24562458
+ "<ANGLE_DEG>, <ANGLE_RAD>, <ANGLE_GRAD>, <ANGLE_TURN>, "
24572459
+ "<TIME_MS>, <TIME_S>, <FREQ_HZ>, <FREQ_KHZ>, <RESOLUTION_DPI>, <RESOLUTION_DPCM>, <PERCENTAGE>, "
24582460
+ "<DIMENSION>, <UNICODE_RANGE>, <URI>, <FUNCTION_CALC>, <FUNCTION_VAR>, "
24592461
+ "<FUNCTION_RGB>, <FUNCTION_HSL>, <FUNCTION_HWB>, <FUNCTION_LAB>, <FUNCTION_LCH>, <FUNCTION>, \"progid:\".)"
2460-
+ " Error in expression. (Invalid token \";\". Was expecting one of: <S>, \"only\", <NUMBER>, \"inherit\", \"none\", "
2462+
+ " Error in expression. (Invalid token \";\". Was expecting one of: <S>, \"only\", <NUMBER>, \"inherit\", \"none\", \"from\", "
24612463
+ "<IDENT>, <STRING>, \"-\", \"+\", <HASH>, <EMS>, <REM>, <EXS>, <CH>, "
24622464
+ "<VW>, <VH>, <VMIN>, <VMAX>, "
24632465
+ "<LENGTH_PX>, <LENGTH_CM>, <LENGTH_MM>, <LENGTH_IN>, <LENGTH_PT>, <LENGTH_PC>, <LENGTH_Q>, "
@@ -2710,7 +2712,7 @@ public void unexpectedEndOfPageRule() throws Exception {
27102712

27112713
assertEquals(1, errorHandler.getErrorCount());
27122714
final String expected = "Error in @page rule. "
2713-
+ "(Invalid token \"<EOF>\". Was expecting one of: <S>, \"only\", \"inherit\", \"none\", <IDENT>,"
2715+
+ "(Invalid token \"<EOF>\". Was expecting one of: <S>, \"only\", \"inherit\", \"none\", \"from\", <IDENT>,"
27142716
+ " \"}\", \";\", \"*\", <CUSTOM_PROPERTY_NAME>.)";
27152717
assertEquals(expected, errorHandler.getErrorMessage());
27162718
assertEquals("1", errorHandler.getErrorLines());
@@ -2755,7 +2757,7 @@ public void unexpectedEndOfString() throws Exception {
27552757

27562758
assertEquals(1, errorHandler.getErrorCount());
27572759
final String expected = "Error in expression. "
2758-
+ "(Invalid token \"\\'\". Was expecting one of: <S>, \"only\", <NUMBER>, \"inherit\", \"none\", "
2760+
+ "(Invalid token \"\\'\". Was expecting one of: <S>, \"only\", <NUMBER>, \"inherit\", \"none\", \"from\", "
27592761
+ "<IDENT>, <STRING>, \"-\", \"+\", <HASH>, <EMS>, <REM>, <EXS>, <CH>, "
27602762
+ "<VW>, <VH>, <VMIN>, <VMAX>, "
27612763
+ "<LENGTH_PX>, <LENGTH_CM>, <LENGTH_MM>, <LENGTH_IN>, <LENGTH_PT>, <LENGTH_PC>, <LENGTH_Q>, "

0 commit comments

Comments
 (0)