use of com.gargoylesoftware.css.parser.LexicalUnit in project LoboEvolution by LoboEvolution.
the class CSS3Parser method hslColor.
// hsl() / hsla()
//
public final LexicalUnit hslColor(LexicalUnit prev) throws ParseException {
Token t;
char op = ' ';
LexicalUnit param = null;
LexicalUnit next = null;
String funct;
t = jj_consume_token(FUNCTION_HSL);
funct = unescape(t.image.substring(0, t.image.length() - 1), false);
label_93: while (true) {
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case S:
{
;
break;
}
default:
jj_la1[163] = jj_gen;
break label_93;
}
jj_consume_token(S);
}
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case MINUS:
case PLUS:
{
op = unaryOperator();
break;
}
default:
jj_la1[164] = jj_gen;
;
}
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case NUMBER:
{
param = number(null, op);
break;
}
case ANGLE_DEG:
{
t = jj_consume_token(ANGLE_DEG);
param = LexicalUnitImpl.createDegree(null, doubleValue(op, t.image));
break;
}
case ANGLE_RAD:
{
t = jj_consume_token(ANGLE_RAD);
param = LexicalUnitImpl.createRadian(null, doubleValue(op, t.image));
break;
}
case ANGLE_GRAD:
{
t = jj_consume_token(ANGLE_GRAD);
param = LexicalUnitImpl.createGradian(null, doubleValue(op, t.image));
break;
}
case ANGLE_TURN:
{
t = jj_consume_token(ANGLE_TURN);
param = LexicalUnitImpl.createTurn(null, doubleValue(op, t.image));
break;
}
default:
jj_la1[165] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
op = ' ';
next = param;
label_94: while (true) {
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case S:
{
;
break;
}
default:
jj_la1[166] = jj_gen;
break label_94;
}
jj_consume_token(S);
}
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case COMMA:
{
jj_consume_token(COMMA);
next = LexicalUnitImpl.createComma(next);
label_95: while (true) {
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case S:
{
;
break;
}
default:
jj_la1[167] = jj_gen;
break label_95;
}
jj_consume_token(S);
}
break;
}
default:
jj_la1[168] = jj_gen;
;
}
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case MINUS:
case PLUS:
{
op = unaryOperator();
break;
}
default:
jj_la1[169] = jj_gen;
;
}
next = percentage(next, op);
op = ' ';
label_96: while (true) {
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case S:
{
;
break;
}
default:
jj_la1[170] = jj_gen;
break label_96;
}
jj_consume_token(S);
}
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case COMMA:
{
jj_consume_token(COMMA);
next = LexicalUnitImpl.createComma(next);
label_97: while (true) {
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case S:
{
;
break;
}
default:
jj_la1[171] = jj_gen;
break label_97;
}
jj_consume_token(S);
}
break;
}
default:
jj_la1[172] = jj_gen;
;
}
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case MINUS:
case PLUS:
{
op = unaryOperator();
break;
}
default:
jj_la1[173] = jj_gen;
;
}
next = percentage(next, op);
op = ' ';
label_98: while (true) {
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case S:
{
;
break;
}
default:
jj_la1[174] = jj_gen;
break label_98;
}
jj_consume_token(S);
}
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case NUMBER:
case SLASH:
case MINUS:
case PLUS:
case COMMA:
case PERCENTAGE:
{
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case SLASH:
case COMMA:
{
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case COMMA:
{
jj_consume_token(COMMA);
next = LexicalUnitImpl.createComma(next);
break;
}
case SLASH:
{
jj_consume_token(SLASH);
next = LexicalUnitImpl.createSlash(next);
break;
}
default:
jj_la1[175] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
label_99: while (true) {
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case S:
{
;
break;
}
default:
jj_la1[176] = jj_gen;
break label_99;
}
jj_consume_token(S);
}
break;
}
default:
jj_la1[177] = jj_gen;
;
}
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case MINUS:
case PLUS:
{
op = unaryOperator();
break;
}
default:
jj_la1[178] = jj_gen;
;
}
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case NUMBER:
{
next = number(next, op);
break;
}
case PERCENTAGE:
{
next = percentage(next, op);
break;
}
default:
jj_la1[179] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
label_100: while (true) {
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case S:
{
;
break;
}
default:
jj_la1[180] = jj_gen;
break label_100;
}
jj_consume_token(S);
}
break;
}
default:
jj_la1[181] = jj_gen;
;
}
jj_consume_token(RROUND);
return hslColorInternal(prev, funct, param);
}
use of com.gargoylesoftware.css.parser.LexicalUnit in project LoboEvolution by LoboEvolution.
the class CSS3Parser method calc.
//
// calc()
// https://www.w3.org/TR/css3-values/#calc-syntax
// <calc()> = calc( <calc-sum> )
//
public final LexicalUnit calc(LexicalUnit prev) throws ParseException {
Token t;
LexicalUnit head = LexicalUnitImpl.createIdent(null, "");
String funct = "";
t = jj_consume_token(FUNCTION_CALC);
funct = unescape(t.image, false);
label_68: while (true) {
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case S:
{
;
break;
}
default:
jj_la1[113] = jj_gen;
break label_68;
}
jj_consume_token(S);
}
calcSum(head);
jj_consume_token(RROUND);
return functionInternal(prev, funct, head.getNextLexicalUnit());
}
use of com.gargoylesoftware.css.parser.LexicalUnit in project LoboEvolution by LoboEvolution.
the class CSS3Parser method rgbColor.
// rgb() / rgba()
//
public final LexicalUnit rgbColor(LexicalUnit prev) throws ParseException {
Token t;
char op = ' ';
LexicalUnit param = null;
LexicalUnit next = null;
String funct;
t = jj_consume_token(FUNCTION_RGB);
funct = unescape(t.image.substring(0, t.image.length() - 1), false);
label_85: while (true) {
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case S:
{
;
break;
}
default:
jj_la1[142] = jj_gen;
break label_85;
}
jj_consume_token(S);
}
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case MINUS:
case PLUS:
{
op = unaryOperator();
break;
}
default:
jj_la1[143] = jj_gen;
;
}
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case NUMBER:
{
param = number(null, op);
break;
}
case PERCENTAGE:
{
param = percentage(null, op);
break;
}
default:
jj_la1[144] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
op = ' ';
next = param;
label_86: while (true) {
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case S:
{
;
break;
}
default:
jj_la1[145] = jj_gen;
break label_86;
}
jj_consume_token(S);
}
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case COMMA:
{
jj_consume_token(COMMA);
next = LexicalUnitImpl.createComma(next);
label_87: while (true) {
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case S:
{
;
break;
}
default:
jj_la1[146] = jj_gen;
break label_87;
}
jj_consume_token(S);
}
break;
}
default:
jj_la1[147] = jj_gen;
;
}
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case MINUS:
case PLUS:
{
op = unaryOperator();
break;
}
default:
jj_la1[148] = jj_gen;
;
}
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case NUMBER:
{
next = number(next, op);
break;
}
case PERCENTAGE:
{
next = percentage(next, op);
break;
}
default:
jj_la1[149] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
op = ' ';
label_88: while (true) {
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case S:
{
;
break;
}
default:
jj_la1[150] = jj_gen;
break label_88;
}
jj_consume_token(S);
}
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case COMMA:
{
jj_consume_token(COMMA);
next = LexicalUnitImpl.createComma(next);
label_89: while (true) {
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case S:
{
;
break;
}
default:
jj_la1[151] = jj_gen;
break label_89;
}
jj_consume_token(S);
}
break;
}
default:
jj_la1[152] = jj_gen;
;
}
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case MINUS:
case PLUS:
{
op = unaryOperator();
break;
}
default:
jj_la1[153] = jj_gen;
;
}
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case NUMBER:
{
next = number(next, op);
break;
}
case PERCENTAGE:
{
next = percentage(next, op);
break;
}
default:
jj_la1[154] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
op = ' ';
label_90: while (true) {
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case S:
{
;
break;
}
default:
jj_la1[155] = jj_gen;
break label_90;
}
jj_consume_token(S);
}
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case NUMBER:
case SLASH:
case MINUS:
case PLUS:
case COMMA:
case PERCENTAGE:
{
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case SLASH:
case COMMA:
{
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case COMMA:
{
jj_consume_token(COMMA);
next = LexicalUnitImpl.createComma(next);
break;
}
case SLASH:
{
jj_consume_token(SLASH);
next = LexicalUnitImpl.createSlash(next);
break;
}
default:
jj_la1[156] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
label_91: while (true) {
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case S:
{
;
break;
}
default:
jj_la1[157] = jj_gen;
break label_91;
}
jj_consume_token(S);
}
break;
}
default:
jj_la1[158] = jj_gen;
;
}
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case MINUS:
case PLUS:
{
op = unaryOperator();
break;
}
default:
jj_la1[159] = jj_gen;
;
}
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case NUMBER:
{
next = number(next, op);
break;
}
case PERCENTAGE:
{
next = percentage(next, op);
break;
}
default:
jj_la1[160] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
label_92: while (true) {
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case S:
{
;
break;
}
default:
jj_la1[161] = jj_gen;
break label_92;
}
jj_consume_token(S);
}
break;
}
default:
jj_la1[162] = jj_gen;
;
}
jj_consume_token(RROUND);
return rgbColorInternal(prev, funct, param);
}
use of com.gargoylesoftware.css.parser.LexicalUnit in project LoboEvolution by LoboEvolution.
the class CSS3Parser method dimension.
//
// dimension()
//
public final LexicalUnit dimension(LexicalUnit prev, char op) throws ParseException {
Token t;
LexicalUnit value = null;
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case LENGTH_PX:
{
t = jj_consume_token(LENGTH_PX);
value = LexicalUnitImpl.createPixel(prev, doubleValue(op, t.image));
break;
}
case LENGTH_CM:
{
t = jj_consume_token(LENGTH_CM);
value = LexicalUnitImpl.createCentimeter(prev, doubleValue(op, t.image));
break;
}
case LENGTH_MM:
{
t = jj_consume_token(LENGTH_MM);
value = LexicalUnitImpl.createMillimeter(prev, doubleValue(op, t.image));
break;
}
case LENGTH_IN:
{
t = jj_consume_token(LENGTH_IN);
value = LexicalUnitImpl.createInch(prev, doubleValue(op, t.image));
break;
}
case LENGTH_PT:
{
t = jj_consume_token(LENGTH_PT);
value = LexicalUnitImpl.createPoint(prev, doubleValue(op, t.image));
break;
}
case LENGTH_PC:
{
t = jj_consume_token(LENGTH_PC);
value = LexicalUnitImpl.createPica(prev, doubleValue(op, t.image));
break;
}
case LENGTH_Q:
{
t = jj_consume_token(LENGTH_Q);
value = LexicalUnitImpl.createQuater(prev, doubleValue(op, t.image));
break;
}
case EMS:
{
t = jj_consume_token(EMS);
value = LexicalUnitImpl.createEm(prev, doubleValue(op, t.image));
break;
}
case REM:
{
t = jj_consume_token(REM);
value = LexicalUnitImpl.createRem(prev, doubleValue(op, t.image));
break;
}
case EXS:
{
t = jj_consume_token(EXS);
value = LexicalUnitImpl.createEx(prev, doubleValue(op, t.image));
break;
}
case CH:
{
t = jj_consume_token(CH);
value = LexicalUnitImpl.createCh(prev, doubleValue(op, t.image));
break;
}
case VW:
{
t = jj_consume_token(VW);
value = LexicalUnitImpl.createVw(prev, doubleValue(op, t.image));
break;
}
case VH:
{
t = jj_consume_token(VH);
value = LexicalUnitImpl.createVh(prev, doubleValue(op, t.image));
break;
}
case VMIN:
{
t = jj_consume_token(VMIN);
value = LexicalUnitImpl.createVMin(prev, doubleValue(op, t.image));
break;
}
case VMAX:
{
t = jj_consume_token(VMAX);
value = LexicalUnitImpl.createVMax(prev, doubleValue(op, t.image));
break;
}
case ANGLE_DEG:
{
t = jj_consume_token(ANGLE_DEG);
value = LexicalUnitImpl.createDegree(prev, doubleValue(op, t.image));
break;
}
case ANGLE_RAD:
{
t = jj_consume_token(ANGLE_RAD);
value = LexicalUnitImpl.createRadian(prev, doubleValue(op, t.image));
break;
}
case ANGLE_GRAD:
{
t = jj_consume_token(ANGLE_GRAD);
value = LexicalUnitImpl.createGradian(prev, doubleValue(op, t.image));
break;
}
case ANGLE_TURN:
{
t = jj_consume_token(ANGLE_TURN);
value = LexicalUnitImpl.createTurn(prev, doubleValue(op, t.image));
break;
}
case TIME_MS:
{
t = jj_consume_token(TIME_MS);
value = LexicalUnitImpl.createMillisecond(prev, doubleValue(op, t.image));
break;
}
case TIME_S:
{
t = jj_consume_token(TIME_S);
value = LexicalUnitImpl.createSecond(prev, doubleValue(op, t.image));
break;
}
case FREQ_HZ:
{
t = jj_consume_token(FREQ_HZ);
value = LexicalUnitImpl.createHertz(prev, doubleValue(op, t.image));
break;
}
case FREQ_KHZ:
{
t = jj_consume_token(FREQ_KHZ);
value = LexicalUnitImpl.createKiloHertz(prev, doubleValue(op, t.image));
break;
}
case RESOLUTION_DPI:
{
t = jj_consume_token(RESOLUTION_DPI);
value = LexicalUnitImpl.createDimension(prev, doubleValue(op, t.image), "dpi");
break;
}
case RESOLUTION_DPCM:
{
t = jj_consume_token(RESOLUTION_DPCM);
value = LexicalUnitImpl.createDimension(prev, doubleValue(op, t.image), "dpcm");
break;
}
default:
jj_la1[183] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
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 function.
//
// function
// : FUNCTION S* ((EQUALS | COMMA | (unaryOperator? NUMBER) | STRING | IDENT | URI)? S*)+ ')' S*
// ;
//
public final LexicalUnit function(LexicalUnit prev) throws ParseException {
Token t;
LexicalUnit param = null;
LexicalUnit body = null;
String funct = "";
t = jj_consume_token(FUNCTION);
funct = funct + unescape(t.image, false);
label_65: while (true) {
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case S:
{
;
break;
}
default:
jj_la1[107] = jj_gen;
break label_65;
}
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:
{
param = term(null);
body = param;
label_66: while (true) {
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case NUMBER:
case INHERIT:
case IDENT:
case STRING:
case MINUS:
case EQUALS:
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[108] = jj_gen;
break label_66;
}
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case EQUALS:
case COMMA:
{
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case COMMA:
{
t = jj_consume_token(COMMA);
body = LexicalUnitImpl.createComma(body);
break;
}
case EQUALS:
{
t = jj_consume_token(EQUALS);
body = LexicalUnitImpl.createIdent(body, t.image);
break;
}
default:
jj_la1[109] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
label_67: while (true) {
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case S:
{
;
break;
}
default:
jj_la1[110] = jj_gen;
break label_67;
}
jj_consume_token(S);
}
break;
}
default:
jj_la1[111] = jj_gen;
;
}
body = term(body);
}
break;
}
default:
jj_la1[112] = jj_gen;
;
}
jj_consume_token(RROUND);
return functionInternal(prev, funct, param);
}
Aggregations