switch ( _Scanner_actions[_acts++] )
{
case 0:
// line 44 "Scanner.java.rl"
{
AttributeSpecifier specifier;
if (attributeValue != null) {
specifier = new AttributeSpecifier(attributeName, attributeValue, attributeMatch);
} else {
specifier = new AttributeSpecifier(attributeName);
}
specifiers.add(specifier);
}
break;
case 1:
// line 55 "Scanner.java.rl"
{
attributeName = getSlice(mark, p);
}
break;
case 2:
// line 59 "Scanner.java.rl"
{
String m = getSlice(mark, p);
if ("=".equals(m)) {
attributeMatch = AttributeSpecifier.Match.EXACT;
} else if ("~=".equals(m)) {
attributeMatch = AttributeSpecifier.Match.LIST;
} else if ("|=".equals(m)) {
attributeMatch = AttributeSpecifier.Match.HYPHEN;
} else if ("^=".equals(m)) {
attributeMatch = AttributeSpecifier.Match.PREFIX;
} else if ("$=".equals(m)) {
attributeMatch = AttributeSpecifier.Match.SUFFIX;
} else if ("*=".equals(m)) {
attributeMatch = AttributeSpecifier.Match.CONTAINS;
}
}
break;
case 3:
// line 76 "Scanner.java.rl"
{
String value = getSlice(mark, p);
if (value.charAt(0) == '"' || value.charAt(0) == '\'') {
value = value.substring(1, value.length() - 1);
}
attributeValue = value;
}
break;
case 4:
// line 85 "Scanner.java.rl"
{
specifiers.add(new AttributeSpecifier("class",
getSlice(mark, p), AttributeSpecifier.Match.LIST));
}
break;
case 5:
// line 90 "Scanner.java.rl"
{
switch (data[p]) {
case ' ':
combinator = Selector.Combinator.DESCENDANT;
break;
case '>':
combinator = Selector.Combinator.CHILD;
break;
case '+':
combinator = Selector.Combinator.ADJACENT_SIBLING;
break;
case '~':
combinator = Selector.Combinator.GENERAL_SIBLING;
break;
}
}
break;
case 6:
// line 107 "Scanner.java.rl"
{
parts = new LinkedList<Selector>();
}
break;
case 7:
// line 111 "Scanner.java.rl"
{
selectors.add(parts);
}
break;
case 8:
// line 115 "Scanner.java.rl"
{
specifiers.add(new AttributeSpecifier("id",
getSlice(mark, p), AttributeSpecifier.Match.EXACT));
}
break;
case 9:
// line 120 "Scanner.java.rl"
{
mark = p;
}
break;
case 10:
// line 124 "Scanner.java.rl"
{
isNegation = true;
}
break;
case 11:
// line 128 "Scanner.java.rl"
{
specifiers.add(new NegationSpecifier(negationSelector));
isNegation = false;
}
break;
case 12:
// line 133 "Scanner.java.rl"
{
specifiers.add(new PseudoClassSpecifier(getSlice(mark, p)));
}
break;
case 13:
// line 137 "Scanner.java.rl"
{
specifiers.add(new PseudoNthSpecifier(pseudoNthClass, getSlice(mark, p)));
}
break;
case 14:
// line 141 "Scanner.java.rl"
{
pseudoNthClass = getSlice(mark, p);
}
break;
case 15:
// line 145 "Scanner.java.rl"
{
Selector selector;
List<Specifier> list = specifiers.isEmpty() ? null : specifiers;
if (isNegation) {
negationSelector = new Selector(negationTagName, list);
} else {
if (combinator == null) {
selector = new Selector(tagName, list);
} else {
selector = new Selector(tagName, combinator, list);
}
parts.add(selector);
tagName = Selector.UNIVERSAL_TAG;
combinator = null;
}
negationTagName = Selector.UNIVERSAL_TAG;
attributeName = null;
attributeValue = null;
attributeMatch = null;
pseudoNthClass = null;
specifiers = new LinkedList<Specifier>();
}
break;
case 16:
// line 170 "Scanner.java.rl"
{
if (isNegation) {
negationTagName = getSlice(mark, p);
} else {
tagName = getSlice(mark, p);
}
}
break;
case 17:
// line 28 "ScannerCommon.rl"
{ {stack[top++] = cs; cs = 150; _goto_targ = 2; if (true) continue _goto;} }
case 18:
// line 42 "ScannerCommon.rl"
{ {cs = stack[--top];_goto_targ = 2; if (true) continue _goto;} }
// line 1802 "../java/se/fishtank/css/selectors/scanner/Scanner.java"
}
}
}
case 2:
if ( cs == 0 ) {
_goto_targ = 5;
continue _goto;
}
if ( ++p != pe ) {
_goto_targ = 1;
continue _goto;
}
case 4:
if ( p == eof )
{
int __acts = _Scanner_eof_actions[cs];
int __nacts = (int) _Scanner_actions[__acts++];
while ( __nacts-- > 0 ) {
switch ( _Scanner_actions[__acts++] ) {
case 4:
// line 85 "Scanner.java.rl"
{
specifiers.add(new AttributeSpecifier("class",
getSlice(mark, p), AttributeSpecifier.Match.LIST));
}
break;
case 7:
// line 111 "Scanner.java.rl"
{
selectors.add(parts);
}
break;
case 8:
// line 115 "Scanner.java.rl"
{
specifiers.add(new AttributeSpecifier("id",
getSlice(mark, p), AttributeSpecifier.Match.EXACT));
}
break;
case 12:
// line 133 "Scanner.java.rl"