| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_QUERY_QUERY_PARSER_H |
| 10 |
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_QUERY_QUERY_PARSER_H |
| 11 |
|
| 12 |
#include "Query.h" |
| 13 |
#include "QuerySession.h" |
| 14 |
#include "llvm/LineEditor/LineEditor.h" |
| 15 |
#include <cstddef> |
| 16 |
|
| 17 |
namespace clang { |
| 18 |
namespace query { |
| 19 |
|
| 20 |
class QuerySession; |
| 21 |
|
| 22 |
class QueryParser { |
| 23 |
public: |
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
static QueryRef parse(StringRef Line, const QuerySession &QS); |
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
static std::vector<llvm::LineEditor::Completion> |
| 35 |
complete(StringRef Line, size_t Pos, const QuerySession &QS); |
| 36 |
|
| 37 |
private: |
| 38 |
QueryParser(StringRef Line, const QuerySession &QS) |
| 39 |
: Line(Line), CompletionPos(nullptr), QS(QS) {} |
| 40 |
|
| 41 |
StringRef lexWord(); |
| 42 |
|
| 43 |
template <typename T> struct LexOrCompleteWord; |
| 44 |
|
| 45 |
QueryRef parseSetBool(bool QuerySession::*Var); |
| 46 |
QueryRef parseSetTraversalKind(TraversalKind QuerySession::*Var); |
| 47 |
template <typename QueryType> QueryRef parseSetOutputKind(); |
| 48 |
QueryRef completeMatcherExpression(); |
| 49 |
|
| 50 |
QueryRef endQuery(QueryRef Q); |
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
QueryRef doParse(); |
| 57 |
|
| 58 |
StringRef Line; |
| 59 |
|
| 60 |
const char *CompletionPos; |
| 61 |
std::vector<llvm::LineEditor::Completion> Completions; |
| 62 |
|
| 63 |
const QuerySession &QS; |
| 64 |
}; |
| 65 |
|
| 66 |
} |
| 67 |
} |
| 68 |
|
| 69 |
#endif |