Skip to content

Commit 4969ace

Browse files
committed
special casing the optional ident, which is conflicting with pi and e as numbers
1 parent b439c9a commit 4969ace

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

org/w3c/css/parser/analyzer/CssParser.jj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3338,8 +3338,8 @@ CssCheckableValue mathfunctionround() :
33383338
}
33393339
{
33403340
( n=<FUNCTIONROUND> { c = new CssMathFunction(ac, n.image); }
3341-
( <S> )* ( LOOKAHEAD(2) v=mathsum() { c.addValue(v); }
3342-
| n=<IDENT> { c.addValue(CssIdent.getIdent(convertIdent(n.image))); } )
3341+
( <S> )* ( LOOKAHEAD(2) n=<IDENT> { c.addValue(CssIdent.getIdent(convertIdent(n.image))); }
3342+
| v=mathsum() { c.addValue(v); } )
33433343
( <S> )* ( <COMMA> ( <S> )* v=mathsum() {
33443344
c.addValue(v);
33453345
} ( <S> )* )* <RPAREN> ) {

org/w3c/css/values/CssMathFunction.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,15 @@ private void _computeResultingTypeRound(boolean is_final)
278278
}
279279
if (vsize == 2) {
280280
valtype1 = values.get(0).getType();
281+
// parsing artefact
282+
if (valtype1 == CssTypes.CSS_IDENT) {
283+
try {
284+
CssNumber n = new CssNumber();
285+
n.set(values.get(0).getIdent().toString(), ac);
286+
valtype1 = CssTypes.CSS_NUMBER;
287+
} catch (Exception ignored) {
288+
}
289+
}
281290
valtype2 = values.get(1).getType();
282291
} else { // 3 values
283292
CssValue v = values.get(0);

0 commit comments

Comments
 (0)