use of com.gargoylesoftware.css.parser.condition.PrefixAttributeCondition in project LoboEvolution by LoboEvolution.
the class CSS3Parser method attrib.
//
// attrib
// : '[' S* IDENT S* [ [ '=' | INCLUDES | DASHMATCH | PREFIXMATCH | SUFFIXMATCH | SUBSTRINGMATCH ] S*
// [ IDENT | STRING ] S* ]? ']'
// ;
//
public final Condition attrib(boolean pseudoElementFound) throws ParseException {
Token t;
String name = null;
String value = null;
int type = 0;
Locator locator;
try {
jj_consume_token(LSQUARE);
locator = createLocator(token);
label_48: while (true) {
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case S:
{
;
break;
}
default:
jj_la1[74] = jj_gen;
break label_48;
}
jj_consume_token(S);
}
if (pseudoElementFound) {
throw generateParseException();
}
t = jj_consume_token(IDENT);
name = unescape(t.image, false);
label_49: while (true) {
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case S:
{
;
break;
}
default:
jj_la1[75] = jj_gen;
break label_49;
}
jj_consume_token(S);
}
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case INCLUDES:
case DASHMATCH:
case PREFIXMATCH:
case SUFFIXMATCH:
case SUBSTRINGMATCH:
case EQUALS:
{
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case PREFIXMATCH:
{
jj_consume_token(PREFIXMATCH);
type = 4;
break;
}
case SUFFIXMATCH:
{
jj_consume_token(SUFFIXMATCH);
type = 5;
break;
}
case SUBSTRINGMATCH:
{
jj_consume_token(SUBSTRINGMATCH);
type = 6;
break;
}
case EQUALS:
{
jj_consume_token(EQUALS);
type = 1;
break;
}
case INCLUDES:
{
jj_consume_token(INCLUDES);
type = 2;
break;
}
case DASHMATCH:
{
jj_consume_token(DASHMATCH);
type = 3;
break;
}
default:
jj_la1[76] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
label_50: while (true) {
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case S:
{
;
break;
}
default:
jj_la1[77] = jj_gen;
break label_50;
}
jj_consume_token(S);
}
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case IDENT:
{
t = jj_consume_token(IDENT);
value = unescape(t.image, false);
break;
}
case STRING:
{
t = jj_consume_token(STRING);
value = unescape(t.image, false);
break;
}
default:
jj_la1[78] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
label_51: while (true) {
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case S:
{
;
break;
}
default:
jj_la1[79] = jj_gen;
break label_51;
}
jj_consume_token(S);
}
break;
}
default:
jj_la1[80] = jj_gen;
;
}
jj_consume_token(RSQUARE);
Condition c = null;
switch(type) {
case 0:
c = new AttributeCondition(name, null);
break;
case 1:
c = new AttributeCondition(name, value);
break;
case 2:
c = new OneOfAttributeCondition(name, value);
break;
case 3:
c = new BeginHyphenAttributeCondition(name, value);
break;
case 4:
c = new PrefixAttributeCondition(name, value);
break;
case 5:
c = new SuffixAttributeCondition(name, value);
break;
case 6:
c = new SubstringAttributeCondition(name, value);
break;
}
c.setLocator(locator);
return c;
} catch (ParseException e) {
throw toCSSParseException("invalidAttrib", e);
}
}
Aggregations