use of com.gargoylesoftware.css.parser.LexicalUnit in project LoboEvolution by LoboEvolution.
the class CSS3Parser method mediaExpression.
//
// expression
// : '(' S* media_feature S* [ ':' S* expr ]? ')' S*
// ;
//
public final Property mediaExpression() throws ParseException {
String p;
LexicalUnit e = null;
Property prop;
jj_consume_token(LROUND);
label_18: while (true) {
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case S:
{
;
break;
}
default:
jj_la1[30] = jj_gen;
break label_18;
}
jj_consume_token(S);
}
p = property();
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case COLON:
{
jj_consume_token(COLON);
label_19: while (true) {
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case S:
{
;
break;
}
default:
jj_la1[31] = jj_gen;
break label_19;
}
jj_consume_token(S);
}
e = expr();
break;
}
default:
jj_la1[32] = jj_gen;
;
}
jj_consume_token(RROUND);
label_20: while (true) {
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case S:
{
;
break;
}
default:
jj_la1[33] = jj_gen;
break label_20;
}
jj_consume_token(S);
}
if (e == null) {
prop = new Property(p, null, false);
} else {
prop = new Property(p, new CSSValueImpl(e), false);
}
return prop;
}
use of com.gargoylesoftware.css.parser.LexicalUnit in project LoboEvolution by LoboEvolution.
the class CSS3Parser method calcNumberValue.
//
// calcNumberValue()
// <calc-number-value> = <number> | ( <calc-number-sum> )
//
public final LexicalUnit calcNumberValue(LexicalUnit prev) throws ParseException {
Token t;
char op = ' ';
String funct = "(";
LexicalUnit head = LexicalUnitImpl.createIdent(null, "");
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case NUMBER:
case MINUS:
case PLUS:
{
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case MINUS:
case PLUS:
{
op = unaryOperator();
break;
}
default:
jj_la1[133] = jj_gen;
;
}
prev = number(prev, op);
break;
}
case FUNCTION_VAR:
{
prev = var(prev);
break;
}
case LROUND:
case FUNCTION_CALC:
{
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case FUNCTION_CALC:
{
t = jj_consume_token(FUNCTION_CALC);
funct = unescape(t.image, false);
break;
}
case LROUND:
{
t = jj_consume_token(LROUND);
funct = unescape(t.image, false);
break;
}
default:
jj_la1[134] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
calcNumberSum(head);
jj_consume_token(RROUND);
// use an empty function as block scope
prev = functionInternal(prev, funct, head.getNextLexicalUnit());
break;
}
default:
jj_la1[135] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
label_80: while (true) {
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case S:
{
;
break;
}
default:
jj_la1[136] = jj_gen;
break label_80;
}
jj_consume_token(S);
}
if (prev != null) {
prev.setLocator(createLocator(token));
}
return prev;
}
use of com.gargoylesoftware.css.parser.LexicalUnit in project LoboEvolution by LoboEvolution.
the class CSS3Parser method calcValue.
//
// calcValue()
// <calc-value> = <number> | <dimension> | <percentage> | ( <calc-sum> )
//
public final LexicalUnit calcValue(LexicalUnit prev) throws ParseException {
char op = ' ';
LexicalUnit head = LexicalUnitImpl.createIdent(null, "");
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case NUMBER:
case MINUS:
case PLUS:
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:
{
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case MINUS:
case PLUS:
{
op = unaryOperator();
break;
}
default:
jj_la1[121] = jj_gen;
;
}
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case NUMBER:
{
prev = number(prev, op);
break;
}
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:
{
prev = dimension(prev, op);
break;
}
case PERCENTAGE:
{
prev = percentage(prev, op);
break;
}
default:
jj_la1[122] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
break;
}
case FUNCTION_VAR:
{
prev = var(prev);
break;
}
case LROUND:
case FUNCTION_CALC:
{
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case FUNCTION_CALC:
{
jj_consume_token(FUNCTION_CALC);
break;
}
case LROUND:
{
jj_consume_token(LROUND);
break;
}
default:
jj_la1[123] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
calcSum(head);
jj_consume_token(RROUND);
// use an empty function as block scope
prev = functionInternal(prev, "(", head.getNextLexicalUnit());
break;
}
default:
jj_la1[124] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
label_74: while (true) {
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case S:
{
;
break;
}
default:
jj_la1[125] = jj_gen;
break label_74;
}
jj_consume_token(S);
}
if (prev != null) {
prev.setLocator(createLocator(token));
}
return prev;
}
use of com.gargoylesoftware.css.parser.LexicalUnit in project LoboEvolution by LoboEvolution.
the class CSS3Parser method term.
//
// term
// : unary_operator?
// [ NUMBER | PERCENTAGE | LENGTH | EMS | REM | EXS | ANGLE | TIME | FREQ | function ]
// | STRING | IDENT | URI | hexcolor | DIMENSION
// S*
// ;
//
public final LexicalUnit term(LexicalUnit prev) throws ParseException {
Token t;
char op = ' ';
LexicalUnit value = null;
Locator locator = null;
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case MINUS:
case PLUS:
{
op = unaryOperator();
break;
}
default:
jj_la1[102] = jj_gen;
;
}
if (op != ' ') {
locator = createLocator(token);
}
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case NUMBER:
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 FUNCTION_CALC:
case FUNCTION_VAR:
case FUNCTION_RGB:
case FUNCTION_HSL:
case FUNCTION:
{
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case NUMBER:
{
value = number(prev, op);
break;
}
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:
{
value = dimension(prev, op);
break;
}
case PERCENTAGE:
{
value = percentage(prev, op);
break;
}
case FUNCTION:
{
value = function(prev);
break;
}
case FUNCTION_RGB:
{
value = rgbColor(prev);
break;
}
case FUNCTION_HSL:
{
value = hslColor(prev);
break;
}
case FUNCTION_CALC:
{
value = calc(prev);
break;
}
case FUNCTION_VAR:
{
value = var(prev);
break;
}
default:
jj_la1[103] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
break;
}
case STRING:
{
t = jj_consume_token(STRING);
value = LexicalUnitImpl.createString(prev, unescape(t.image, false));
break;
}
case 118:
{
t = jj_consume_token(118);
value = LexicalUnitImpl.createIdent(prev, skipUnit().trim());
break;
}
case IDENT:
{
t = jj_consume_token(IDENT);
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case COLON:
{
jj_consume_token(COLON);
throw toCSSParseException("invalidExprColon", new String[] { unescape(t.image, false) }, createLocator(t));
}
default:
jj_la1[104] = jj_gen;
;
}
value = LexicalUnitImpl.createIdent(prev, unescape(t.image, false));
break;
}
case URI:
{
t = jj_consume_token(URI);
value = LexicalUnitImpl.createURI(prev, unescape(t.image, true));
break;
}
case UNICODE_RANGE:
{
value = unicodeRange(prev);
break;
}
case HASH:
{
value = hexcolor(prev);
break;
}
case DIMENSION:
{
t = jj_consume_token(DIMENSION);
int n = getLastNumPos(t.image);
value = LexicalUnitImpl.createDimension(prev, doubleValue(op, t.image.substring(0, n + 1)), t.image.substring(n + 1));
break;
}
case INHERIT:
{
t = jj_consume_token(INHERIT);
value = new LexicalUnitImpl(prev, LexicalUnitType.INHERIT, t.image);
break;
}
default:
jj_la1[105] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
if (locator == null) {
locator = createLocator(token);
}
label_64: while (true) {
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case S:
{
;
break;
}
default:
jj_la1[106] = jj_gen;
break label_64;
}
jj_consume_token(S);
}
if (value != null) {
value.setLocator(locator);
}
return value;
}
use of com.gargoylesoftware.css.parser.LexicalUnit in project LoboEvolution by LoboEvolution.
the class CSSValueImpl method getValues.
private static List<CSSValueImpl> getValues(final LexicalUnit value) {
final List<CSSValueImpl> values = new ArrayList<>();
LexicalUnit lu = value;
while (lu != null) {
values.add(new CSSValueImpl(lu, true));
lu = lu.getNextLexicalUnit();
}
return values;
}
Aggregations