*/
protected LexicalUnit parseFunction(boolean positive, LexicalUnit prev) {
String name = scanner.getStringValue();
nextIgnoreSpaces();
LexicalUnit params = parseExpression(true);
if (current != LexicalUnits.RIGHT_BRACE) {
throw createCSSParseException
("token",
new Object[] { new Integer(current) });
}
nextIgnoreSpaces();
predefined: switch (name.charAt(0)) {
case 'r':
case 'R':
LexicalUnit lu;
if (name.equalsIgnoreCase("rgb")) {
lu = params;
if (lu == null) {
break;
}
switch (lu.getLexicalUnitType()) {
default:
break predefined;
case LexicalUnit.SAC_INTEGER:
case LexicalUnit.SAC_PERCENTAGE:
lu = lu.getNextLexicalUnit();
}
if (lu == null) {
break;
}
switch (lu.getLexicalUnitType()) {
default:
break predefined;
case LexicalUnit.SAC_OPERATOR_COMMA:
lu = lu.getNextLexicalUnit();
}
if (lu == null) {
break;
}
switch (lu.getLexicalUnitType()) {
default:
break predefined;
case LexicalUnit.SAC_INTEGER:
case LexicalUnit.SAC_PERCENTAGE:
lu = lu.getNextLexicalUnit();
}
if (lu == null) {
break;
}
switch (lu.getLexicalUnitType()) {
default:
break predefined;
case LexicalUnit.SAC_OPERATOR_COMMA:
lu = lu.getNextLexicalUnit();
}
if (lu == null) {
break;
}
switch (lu.getLexicalUnitType()) {
default:
break predefined;
case LexicalUnit.SAC_INTEGER:
case LexicalUnit.SAC_PERCENTAGE:
lu = lu.getNextLexicalUnit();
}
if (lu != null) {
break;
}
return CSSLexicalUnit.createPredefinedFunction
(LexicalUnit.SAC_RGBCOLOR, params, prev);
} else if (name.equalsIgnoreCase("rect")) {
lu = params;
if (lu == null) {
break;
}
switch (lu.getLexicalUnitType()) {
default:
break predefined;
case LexicalUnit.SAC_INTEGER:
if (lu.getIntegerValue() != 0) {
break predefined;
}
lu = lu.getNextLexicalUnit();
break;
case LexicalUnit.SAC_IDENT:
if (!lu.getStringValue().equalsIgnoreCase("auto")) {
break predefined;
}
lu = lu.getNextLexicalUnit();
break;
case LexicalUnit.SAC_EM:
case LexicalUnit.SAC_EX:
case LexicalUnit.SAC_PIXEL:
case LexicalUnit.SAC_CENTIMETER:
case LexicalUnit.SAC_MILLIMETER:
case LexicalUnit.SAC_INCH:
case LexicalUnit.SAC_POINT:
case LexicalUnit.SAC_PICA:
case LexicalUnit.SAC_PERCENTAGE:
lu = lu.getNextLexicalUnit();
}
if (lu == null) {
break;
}
switch (lu.getLexicalUnitType()) {
default:
break predefined;
case LexicalUnit.SAC_OPERATOR_COMMA:
lu = lu.getNextLexicalUnit();
}
if (lu == null) {
break;
}
switch (lu.getLexicalUnitType()) {
default:
break predefined;
case LexicalUnit.SAC_INTEGER:
if (lu.getIntegerValue() != 0) {
break predefined;
}
lu = lu.getNextLexicalUnit();
break;
case LexicalUnit.SAC_IDENT:
if (!lu.getStringValue().equalsIgnoreCase("auto")) {
break predefined;
}
lu = lu.getNextLexicalUnit();
break;
case LexicalUnit.SAC_EM:
case LexicalUnit.SAC_EX:
case LexicalUnit.SAC_PIXEL:
case LexicalUnit.SAC_CENTIMETER:
case LexicalUnit.SAC_MILLIMETER:
case LexicalUnit.SAC_INCH:
case LexicalUnit.SAC_POINT:
case LexicalUnit.SAC_PICA:
case LexicalUnit.SAC_PERCENTAGE:
lu = lu.getNextLexicalUnit();
}
if (lu == null) {
break;
}
switch (lu.getLexicalUnitType()) {
default:
break predefined;
case LexicalUnit.SAC_OPERATOR_COMMA:
lu = lu.getNextLexicalUnit();
}
if (lu == null) {
break;
}
switch (lu.getLexicalUnitType()) {
default:
break predefined;
case LexicalUnit.SAC_INTEGER:
if (lu.getIntegerValue() != 0) {
break predefined;
}
lu = lu.getNextLexicalUnit();
break;
case LexicalUnit.SAC_IDENT:
if (!lu.getStringValue().equalsIgnoreCase("auto")) {
break predefined;
}
lu = lu.getNextLexicalUnit();
break;
case LexicalUnit.SAC_EM:
case LexicalUnit.SAC_EX:
case LexicalUnit.SAC_PIXEL:
case LexicalUnit.SAC_CENTIMETER:
case LexicalUnit.SAC_MILLIMETER:
case LexicalUnit.SAC_INCH:
case LexicalUnit.SAC_POINT:
case LexicalUnit.SAC_PICA:
case LexicalUnit.SAC_PERCENTAGE:
lu = lu.getNextLexicalUnit();
}
if (lu == null) {
break;
}
switch (lu.getLexicalUnitType()) {
default:
break predefined;
case LexicalUnit.SAC_OPERATOR_COMMA:
lu = lu.getNextLexicalUnit();
}
if (lu == null) {
break;
}
switch (lu.getLexicalUnitType()) {
default:
break predefined;
case LexicalUnit.SAC_INTEGER:
if (lu.getIntegerValue() != 0) {
break predefined;
}
lu = lu.getNextLexicalUnit();
break;
case LexicalUnit.SAC_IDENT:
if (!lu.getStringValue().equalsIgnoreCase("auto")) {
break predefined;
}
lu = lu.getNextLexicalUnit();
break;
case LexicalUnit.SAC_EM:
case LexicalUnit.SAC_EX:
case LexicalUnit.SAC_PIXEL:
case LexicalUnit.SAC_CENTIMETER:
case LexicalUnit.SAC_MILLIMETER:
case LexicalUnit.SAC_INCH:
case LexicalUnit.SAC_POINT:
case LexicalUnit.SAC_PICA:
case LexicalUnit.SAC_PERCENTAGE:
lu = lu.getNextLexicalUnit();
}
if (lu != null) {
break;
}
return CSSLexicalUnit.createPredefinedFunction
(LexicalUnit.SAC_RECT_FUNCTION, params, prev);
}
break;
case 'c':
case 'C':
if (name.equalsIgnoreCase("counter")) {
lu = params;
if (lu == null) {
break;
}
switch (lu.getLexicalUnitType()) {
default:
break predefined;
case LexicalUnit.SAC_IDENT:
lu = lu.getNextLexicalUnit();
}
if (lu == null) {
break;
}
switch (lu.getLexicalUnitType()) {
default:
break predefined;
case LexicalUnit.SAC_OPERATOR_COMMA:
lu = lu.getNextLexicalUnit();
}
if (lu == null) {
break;
}
switch (lu.getLexicalUnitType()) {
default:
break predefined;
case LexicalUnit.SAC_IDENT:
lu = lu.getNextLexicalUnit();
}
if (lu != null) {
break;
}
return CSSLexicalUnit.createPredefinedFunction
(LexicalUnit.SAC_COUNTER_FUNCTION, params, prev);
} else if (name.equalsIgnoreCase("counters")) {
lu = params;
if (lu == null) {
break;
}
switch (lu.getLexicalUnitType()) {
default:
break predefined;
case LexicalUnit.SAC_IDENT:
lu = lu.getNextLexicalUnit();
}
if (lu == null) {
break;
}
switch (lu.getLexicalUnitType()) {
default:
break predefined;
case LexicalUnit.SAC_OPERATOR_COMMA:
lu = lu.getNextLexicalUnit();
}
if (lu == null) {
break;
}
switch (lu.getLexicalUnitType()) {
default:
break predefined;
case LexicalUnit.SAC_STRING_VALUE:
lu = lu.getNextLexicalUnit();
}
if (lu == null) {
break;
}
switch (lu.getLexicalUnitType()) {
default:
break predefined;
case LexicalUnit.SAC_OPERATOR_COMMA:
lu = lu.getNextLexicalUnit();
}
if (lu == null) {
break;
}
switch (lu.getLexicalUnitType()) {
default:
break predefined;
case LexicalUnit.SAC_IDENT:
lu = lu.getNextLexicalUnit();
}
if (lu != null) {
break;
}
return CSSLexicalUnit.createPredefinedFunction
(LexicalUnit.SAC_COUNTERS_FUNCTION, params, prev);
}
break;
case 'a':
case 'A':
if (name.equalsIgnoreCase("attr")) {
lu = params;
if (lu == null) {
break;
}
switch (lu.getLexicalUnitType()) {
default:
break predefined;
case LexicalUnit.SAC_IDENT:
lu = lu.getNextLexicalUnit();
}
if (lu != null) {
break;
}
return CSSLexicalUnit.createString