processAttribute method
Implementation
AttributeSelector? processAttribute() {
if (_maybeEat(TokenKind.LBRACK)) {
var attrName = identifier();
int op;
switch (_peek()) {
case TokenKind.EQUALS:
case TokenKind.INCLUDES: // ~=
case TokenKind.DASH_MATCH: // |=
case TokenKind.PREFIX_MATCH: // ^=
case TokenKind.SUFFIX_MATCH: // $=
case TokenKind.SUBSTRING_MATCH: // *=
op = _peek();
_next();
break;
default:
op = TokenKind.NO_MATCH;
}
dynamic value;
if (op != TokenKind.NO_MATCH) {
// Operator hit so we require a value too.
if (_peekIdentifier()) {
value = identifier();
} else {
value = processQuotedString(false);
}
if (value == null) {
_error('expected attribute value string or ident');
}
}
_eat(TokenKind.RBRACK);
return AttributeSelector(attrName, op, value);
}
return null;
}