private List<AbstractToken> addDataSource(final List<AbstractToken> tokens,
                                                  final Consumer<DocRef> consumer,
                                                  final boolean isLenient) {
            AbstractToken token = tokens.getFirst();

            // The first token must be `FROM`.
            if (!TokenType.FROM.equals(token.getTokenType())) {
                throw new TokenException(token, "Expected from");
            }

            final KeywordGroup keywordGroup = (KeywordGroup) token;
            if (keywordGroup.getChildren().isEmpty()) {
                throw new TokenException(token, "Expected data source value");
            } else if (keywordGroup.getChildren().size() > 1 && !isLenient) {
                throw new TokenException(keywordGroup.getChildren().get(1),
                        "Unexpected data source child tokens: " + keywordGroup.getChildren()
                                .stream()
                                .map(token2 -> token2.getTokenType() + ":[" + token2.getText() + "]")
                                .collect(Collectors.joining(", ")));
            }

            final AbstractToken dataSourceToken = keywordGroup.getChildren().get(0);
            if (!TokenType.isString(dataSourceToken)) {
                throw new TokenException(dataSourceToken, "Expected a token of type string");
            }
            final String dataSourceName = dataSourceToken.getUnescapedText();
            final DocRef dataSourceDocRef = securityContext.useAsReadResult(() ->
                    docResolver.resolveDataSourceRef(dataSourceName));

            consumer.accept(dataSourceDocRef);

            return tokens.subList(1, tokens.size());
        }
@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