llvm/mlir/include/mlir/Query/Query.h

//===--- Query.h ------------------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef MLIR_TOOLS_MLIRQUERY_QUERY_H
#define MLIR_TOOLS_MLIRQUERY_QUERY_H

#include "Matcher/VariantValue.h"
#include "llvm/ADT/IntrusiveRefCntPtr.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/LineEditor/LineEditor.h"
#include <string>

namespace mlir::query {

enum class QueryKind {};

class QuerySession;

struct Query : llvm::RefCountedBase<Query> {};

QueryRef;

QueryRef parse(llvm::StringRef line, const QuerySession &qs);

std::vector<llvm::LineEditor::Completion>
complete(llvm::StringRef line, size_t pos, const QuerySession &qs);

// Any query which resulted in a parse error. The error message is in ErrStr.
struct InvalidQuery : Query {};

// No-op query (i.e. a blank line).
struct NoOpQuery : Query {};

// Query for "help".
struct HelpQuery : Query {};

// Query for "quit".
struct QuitQuery : Query {};

// Query for "match MATCHER".
struct MatchQuery : Query {};

} // namespace mlir::query

#endif