SignedExpression negated = (SignedExpression) first;
first = negated.getExpression();
sign = negated.getSign().toSymbol();
}
if (first.getType() == ASTCssNodeType.IDENTIFIER_EXPRESSION) {
IdentifierExpression ident = (IdentifierExpression) first;
String lowerCaseValue = ident.getValue().toLowerCase();
lowerCaseValue = sign + lowerCaseValue;
if ("even".equals(lowerCaseValue)) {
return new Nth(token, null, null, Form.EVEN);
} else if ("odd".equals(lowerCaseValue)) {
return new Nth(token, null, null, Form.ODD);
} else if ("n".equals(lowerCaseValue) || "-n".equals(lowerCaseValue) || "+n".equals(lowerCaseValue)) {
boolean expliciteSign = !"n".equals(lowerCaseValue);
first = new NumberExpression(token.getChild(0), lowerCaseValue, NumberExpression.Dimension.REPEATER, expliciteSign);
} else
throw new IllegalStateException("Unexpected identifier value for nth: " + ident.getValue());
}
}
if (token.getChild(1) != null && hasChildren(token.getChild(1))) {
second = termBuilder.buildFromChildTerm(token.getChild(1));