1//===- Parser.h - MLIR PDLL Frontend Parser ---------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef MLIR_TOOLS_PDLL_PARSER_PARSER_H_
10#define MLIR_TOOLS_PDLL_PARSER_PARSER_H_
11
12#include <memory>
13
14#include "mlir/Support/LogicalResult.h"
15
16namespace llvm {
17class SourceMgr;
18} // namespace llvm
19
20namespace mlir {
21namespace pdll {
22class CodeCompleteContext;
23
24namespace ast {
25class Context;
26class Module;
27} // namespace ast
28
29/// Parse an AST module from the main file of the given source manager.
30/// `enableDocumentation` is an optional flag that, when set, indicates that the
31/// parser should also include documentation when building the AST when
32/// possible. `codeCompleteContext` is an optional code completion context that
33/// may be provided to receive code completion suggestions. If a completion is
34/// hit, this method returns a failure.
35FailureOr<ast::Module *>
36parsePDLLAST(ast::Context &ctx, llvm::SourceMgr &sourceMgr,
37 bool enableDocumentation = false,
38 CodeCompleteContext *codeCompleteContext = nullptr);
39} // namespace pdll
40} // namespace mlir
41
42#endif // MLIR_TOOLS_PDLL_PARSER_PARSER_H_
43

source code of mlir/include/mlir/Tools/PDLL/Parser/Parser.h