1 //===--- Parsing.h - Parsing library for Transformer ------------*- 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 ///  \file
10 ///  Defines parsing functions for Transformer types.
11 ///  FIXME: Currently, only supports `RangeSelectors` but parsers for other
12 ///  Transformer types are under development.
13 ///
14 //===----------------------------------------------------------------------===//
15 
16 #ifndef LLVM_CLANG_TOOLING_TRANSFORMER_PARSING_H
17 #define LLVM_CLANG_TOOLING_TRANSFORMER_PARSING_H
18 
19 #include "clang/ASTMatchers/ASTMatchFinder.h"
20 #include "clang/Basic/SourceLocation.h"
21 #include "clang/Tooling/Transformer/RangeSelector.h"
22 #include "llvm/Support/Error.h"
23 #include <functional>
24 
25 namespace clang {
26 namespace transformer {
27 
28 /// Parses a string representation of a \c RangeSelector. The grammar of these
29 /// strings is closely based on the (sub)grammar of \c RangeSelectors as they'd
30 /// appear in C++ code. However, this language constrains the set of permissible
31 /// strings (for node ids) -- it does not support escapes in the
32 /// string. Additionally, the \c charRange combinator is not supported, because
33 /// there is no representation of values of type \c CharSourceRange in this
34 /// (little) language.
35 llvm::Expected<RangeSelector> parseRangeSelector(llvm::StringRef Input);
36 
37 } // namespace transformer
38 } // namespace clang
39 
40 #endif // LLVM_CLANG_TOOLING_TRANSFORMER_PARSING_H
41