use of com.gargoylesoftware.css.parser.Locator 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;
}
Aggregations