sb.append(name);
ignoreWhitespaces();
if (end()) {
throw new ParserException("Unexpected end of selector selector at position " + pos);
}
AttributeOperator operator = null;
if (current == '=') {
operator = AttributeOperator.EQUALS;
next();
} else if (current != ']') {
if (current == '~') operator = AttributeOperator.INCLUDES;
else if (current == '|') operator = AttributeOperator.DASH_MATCH;
else if (current == '^') operator = AttributeOperator.PREFIX_MATCH;
else if (current == '$') operator = AttributeOperator.SUFFIX_MATCH;
else if (current == '*') operator = AttributeOperator.SUBSTRING_MATCH;
else throw new ParserException("Invalid operator ('" + current + "') at position " + pos);
next();
if (end() || current != '=') {
throw new ParserException("Expected '=' sign at position " + pos);
}
next();
}
ignoreWhitespaces();
if (end()) {
throw new ParserException("Unexpected end of attribute selector at position " + pos);
}
//value
String value = null;
if (operator != null) {
sb.append(operator.getSign());
if (current == '\'' || current == '"') {
char quote = current;
value = string();
sb.append(quote);
sb.append(value);