use of com.gargoylesoftware.css.parser.LexicalUnit in project LoboEvolution by LoboEvolution.
the class CSS3Parser method declaration.
//
// declaration
// : property ':' S* expr prio?
// |
// ;
//
public final void declaration() throws ParseException {
String p;
LexicalUnit e;
Token t;
boolean priority = false;
Locator starHack = null;
Locator locator = null;
try {
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case ASTERISK:
{
jj_consume_token(ASTERISK);
starHack = createLocator(token);
break;
}
default:
jj_la1[95] = jj_gen;
;
}
p = property();
locator = createLocator(token);
jj_consume_token(COLON);
label_61: while (true) {
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case S:
{
;
break;
}
default:
jj_la1[96] = jj_gen;
break label_61;
}
jj_consume_token(S);
}
e = expr();
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case IMPORTANT_SYM:
{
priority = prio();
break;
}
default:
jj_la1[97] = jj_gen;
;
}
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case UNKNOWN:
{
t = jj_consume_token(UNKNOWN);
locator = createLocator(t);
CSSParseException cpe = toCSSParseException("invalidDeclarationInvalidChar", new String[] { t.image }, locator);
getErrorHandler().error(cpe);
error_skipdecl();
break;
}
default:
jj_la1[98] = jj_gen;
;
}
if (starHack != null) {
CSSParseException cpe = toCSSParseException("invalidDeclarationStarHack", new Object[0], starHack);
getErrorHandler().error(cpe);
return;
}
handleProperty(p, e, priority, locator);
} catch (CSSParseException ex) {
getErrorHandler().error(ex);
error_skipdecl();
} catch (ParseException ex) {
CSSParseException cpe = toCSSParseException("invalidDeclaration", ex);
getErrorHandler().error(cpe);
error_skipdecl();
}
}
use of com.gargoylesoftware.css.parser.LexicalUnit in project LoboEvolution by LoboEvolution.
the class CSS3Parser method number.
//
// number()
//
public final LexicalUnit number(LexicalUnit prev, char op) throws ParseException {
Token t;
LexicalUnit value = null;
t = jj_consume_token(NUMBER);
try {
value = LexicalUnitImpl.createNumber(prev, intValue(op, t.image));
} catch (NumberFormatException e) {
value = LexicalUnitImpl.createNumber(prev, doubleValue(op, t.image));
}
if (value != null) {
value.setLocator(createLocator(token));
}
return value;
}
use of com.gargoylesoftware.css.parser.LexicalUnit in project LoboEvolution by LoboEvolution.
the class CSS3Parser method var.
// var()
// https://developer.mozilla.org/en-US/docs/Web/CSS/var
// var( <custom-property-name> , <declaration-value>? )
//
public final LexicalUnit var(LexicalUnit prev) throws ParseException {
Token t;
LexicalUnit current, propertyName;
String funct = "";
t = jj_consume_token(FUNCTION_VAR);
funct = unescape(t.image, false);
label_81: while (true) {
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case S:
{
;
break;
}
default:
jj_la1[137] = jj_gen;
break label_81;
}
jj_consume_token(S);
}
t = jj_consume_token(CUSTOM_PROPERTY_NAME);
current = LexicalUnitImpl.createIdent(prev, unescape(t.image, false));
propertyName = current;
label_82: while (true) {
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case S:
{
;
break;
}
default:
jj_la1[138] = jj_gen;
break label_82;
}
jj_consume_token(S);
}
label_83: while (true) {
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case COMMA:
{
;
break;
}
default:
jj_la1[139] = jj_gen;
break label_83;
}
jj_consume_token(COMMA);
current = LexicalUnitImpl.createComma(current);
label_84: while (true) {
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case S:
{
;
break;
}
default:
jj_la1[140] = jj_gen;
break label_84;
}
jj_consume_token(S);
}
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case NUMBER:
case INHERIT:
case IDENT:
case STRING:
case MINUS:
case PLUS:
case HASH:
case EMS:
case REM:
case EXS:
case CH:
case VW:
case VH:
case VMIN:
case VMAX:
case LENGTH_PX:
case LENGTH_CM:
case LENGTH_MM:
case LENGTH_IN:
case LENGTH_PT:
case LENGTH_PC:
case LENGTH_Q:
case ANGLE_DEG:
case ANGLE_RAD:
case ANGLE_GRAD:
case ANGLE_TURN:
case TIME_MS:
case TIME_S:
case FREQ_HZ:
case FREQ_KHZ:
case RESOLUTION_DPI:
case RESOLUTION_DPCM:
case PERCENTAGE:
case DIMENSION:
case UNICODE_RANGE:
case URI:
case FUNCTION_CALC:
case FUNCTION_VAR:
case FUNCTION_RGB:
case FUNCTION_HSL:
case FUNCTION:
case 118:
{
current = term(current);
break;
}
default:
jj_la1[141] = jj_gen;
;
}
}
jj_consume_token(RROUND);
return functionInternal(prev, funct, propertyName);
}
use of com.gargoylesoftware.css.parser.LexicalUnit in project LoboEvolution by LoboEvolution.
the class CSS3Parser method percentage.
//
// percentage()
//
public final LexicalUnit percentage(LexicalUnit prev, char op) throws ParseException {
Token t;
LexicalUnit value = null;
t = jj_consume_token(PERCENTAGE);
value = LexicalUnitImpl.createPercentage(prev, doubleValue(op, t.image));
if (value != null) {
value.setLocator(createLocator(token));
}
return value;
}
use of com.gargoylesoftware.css.parser.LexicalUnit in project LoboEvolution by LoboEvolution.
the class CSS3Parser method expr.
//
// expr
// : term [ operator term ]*
// ;
public final LexicalUnit expr() throws ParseException {
LexicalUnit head;
LexicalUnit body;
try {
head = term(null);
body = head;
label_63: while (true) {
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case NUMBER:
case INHERIT:
case IDENT:
case STRING:
case SLASH:
case MINUS:
case PLUS:
case COMMA:
case HASH:
case EMS:
case REM:
case EXS:
case CH:
case VW:
case VH:
case VMIN:
case VMAX:
case LENGTH_PX:
case LENGTH_CM:
case LENGTH_MM:
case LENGTH_IN:
case LENGTH_PT:
case LENGTH_PC:
case LENGTH_Q:
case ANGLE_DEG:
case ANGLE_RAD:
case ANGLE_GRAD:
case ANGLE_TURN:
case TIME_MS:
case TIME_S:
case FREQ_HZ:
case FREQ_KHZ:
case RESOLUTION_DPI:
case RESOLUTION_DPCM:
case PERCENTAGE:
case DIMENSION:
case UNICODE_RANGE:
case URI:
case FUNCTION_CALC:
case FUNCTION_VAR:
case FUNCTION_RGB:
case FUNCTION_HSL:
case FUNCTION:
case 118:
{
;
break;
}
default:
jj_la1[100] = jj_gen;
break label_63;
}
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case SLASH:
case COMMA:
{
body = operator(body);
break;
}
default:
jj_la1[101] = jj_gen;
;
}
body = term(body);
}
return head;
} catch (ParseException ex) {
throw toCSSParseException("invalidExpr", ex);
}
}
Aggregations