private List<Object> applyNotOperators(final List<Object> in) {
            final List<Object> out = new ArrayList<>(in.size());
            for (int i = 0; i < in.size(); i++) {
                final Object object = in.get(i);
                if (object instanceof final AbstractToken token && TokenType.NOT.equals(token.getTokenType())) {
                    // Get next token.
                    i++;
                    if (i < in.size()) {
                        final Object next = in.get(i);
                        if (next instanceof final ExpressionItem expressionItem) {
                            final ExpressionOperator not = ExpressionOperator
                                    .builder()
                                    .op(Op.NOT)
                                    .children(List.of(expressionItem))
                                    .build();
                            out.add(not);
                        } else {
                            throw new TokenException(token, "Expected term after NOT");
                        }
                    } else {
                        throw new TokenException(token, "Trailing NOT");
                    }

                } else {
                    out.add(object);
                }
            }
            return out;
        }
@param isLenient Ignores any additional child tokens found. This is to support getting just
                 the data source from a partially written query, which is likely to not be
                 a valid query. For example, you may type
                 <pre>{@code from View sel}</pre> and at this point do code completion on 'sel'
                 so if this method is called it will treat 'sel as an extra child.
stroom-query/stroom-query-common/src/main/java/stroom/query/language/SearchRequestFactory.java