| 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/LLVM.h" |
| 15 | |
| 16 | namespace llvm { |
| 17 | class SourceMgr; |
| 18 | } // namespace llvm |
| 19 | |
| 20 | namespace mlir { |
| 21 | namespace pdll { |
| 22 | class CodeCompleteContext; |
| 23 | |
| 24 | namespace ast { |
| 25 | class Context; |
| 26 | class 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. |
| 35 | FailureOr<ast::Module *> |
| 36 | parsePDLLAST(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 | |