private AttributeComparator parseComparator(char next) {
        AttributeComparator comparator;
        switch (next) {
            case '=': // =
                comparator = AttributeComparator.EQUALS;
                break;
            case '!':
                expect('='); // !=
                comparator = AttributeComparator.NOT_EQUALS;
                break;
            case '^':
                expect('='); // ^=
                comparator = AttributeComparator.STARTS_WITH;
                break;
            case '$':
                expect('='); // $=
                comparator = AttributeComparator.ENDS_WITH;
                break;
            case '*':
                expect('='); // *=
                comparator = AttributeComparator.CONTAINS;
                break;
            case '?':
                expect('='); // ?=
                comparator = AttributeComparator.EXISTS;
                break;
            case '>':
                if (peek() == '=') { // >=
                    skip();
                    comparator = AttributeComparator.GTE;
                } else { // >
                    comparator = AttributeComparator.GT;
                }
                break;
            case '<':
                if (peek() == '=') { // <=
                    skip();
                    comparator = AttributeComparator.LTE;
                } else { // <
                    comparator = AttributeComparator.LT;
                }
                break;
            case '{': // projection comparators
                char nextSet = expect('<', '=', '!');
                if (nextSet == '<') {
                    if (peek() == '<') {
                        expect('<'); // {<<}
                        comparator = AttributeComparator.PROPER_SUBSET;
                    } else { // {<}
                        comparator = AttributeComparator.SUBSET;
                    }
                } else if (nextSet == '=') { // {=}
                    comparator = AttributeComparator.PROJECTION_EQUALS;
                } else { // {!=}
                    expect('=');
                    comparator = AttributeComparator.PROJECTION_NOT_EQUALS;
                }
                expect('}');
                break;
            default:
                // Unreachable
                throw syntax("Unknown attribute comparator token '" + next + "'");
        }

        ws();
        return comparator;
    }
Filter out unnecessary identity selectors when creating the finalized AST to evaluate selectors.
smithy-model/src/main/java/software/amazon/smithy/model/selector/SelectorParser.java