35 #ifndef LLVM_CLANG_ASTMATCHERS_DYNAMIC_PARSER_H 36 #define LLVM_CLANG_ASTMATCHERS_DYNAMIC_PARSER_H 41 #include "llvm/ADT/ArrayRef.h" 42 #include "llvm/ADT/Optional.h" 43 #include "llvm/ADT/StringMap.h" 44 #include "llvm/ADT/StringRef.h" 123 virtual std::vector<MatcherCompletion>
143 llvm::ArrayRef<std::pair<MatcherCtor, unsigned>> Context)
override;
145 std::vector<MatcherCompletion>
215 static std::vector<MatcherCompletion>
218 static std::vector<MatcherCompletion>
222 static std::vector<MatcherCompletion>
236 bool parseBindID(std::string &BindID);
238 bool parseMatcherExpressionImpl(
const TokenInfo &NameToken,
242 void addCompletion(
const TokenInfo &CompToken,
244 void addExpressionCompletions();
246 std::vector<MatcherCompletion>
254 using ContextStackTy = std::vector<std::pair<MatcherCtor, unsigned>>;
256 ContextStackTy ContextStack;
257 std::vector<MatcherCompletion> Completions;
264 #endif // LLVM_CLANG_AST_MATCHERS_DYNAMIC_PARSER_H static std::vector< MatcherCompletion > completeExpression(StringRef Code, unsigned CompletionOffset, Sema *S, const NamedValueMap *NamedValues)
Complete an expression at the given offset.
static bool parseExpression(StringRef Code, Sema *S, const NamedValueMap *NamedValues, VariantValue *Value, Diagnostics *Error)
Parse an expression.
static bool parseExpression(StringRef Code, VariantValue *Value, Diagnostics *Error)
Registry of all known matchers.
llvm::StringMap< VariantValue > NamedValueMap
virtual llvm::Optional< MatcherCtor > lookupMatcherCtor(StringRef MatcherName)=0
Look up a matcher by name.
Matcher descriptor interface.
Simple tokenizer for the parser.
static llvm::Optional< DynTypedMatcher > parseMatcherExpression(StringRef MatcherCode, Sema *S, Diagnostics *Error)
Matcher expression parser.
Sema implementation that uses the matcher registry to process the tokens.
static std::vector< MatcherCompletion > completeExpression(StringRef Code, unsigned CompletionOffset, Sema *S)
virtual VariantMatcher actOnMatcherExpression(MatcherCtor Ctor, SourceRange NameRange, StringRef BindID, ArrayRef< ParserValue > Args, Diagnostics *Error)=0
Process a matcher expression.
static std::vector< MatcherCompletion > completeExpression(StringRef Code, unsigned CompletionOffset)
static llvm::Optional< DynTypedMatcher > parseMatcherExpression(StringRef MatcherCode, Diagnostics *Error)
Helper class to manage error messages.
static llvm::Optional< DynTypedMatcher > parseMatcherExpression(StringRef MatcherCode, Sema *S, const NamedValueMap *NamedValues, Diagnostics *Error)
Parse a matcher expression.
static bool parseExpression(StringRef Code, Sema *S, VariantValue *Value, Diagnostics *Error)
Dataflow Directional Tag Classes.
Interface to connect the parser with the registry and more.
Simple structure to hold information for one token from the parser.
virtual std::vector< ArgKind > getAcceptedCompletionTypes(llvm::ArrayRef< std::pair< MatcherCtor, unsigned >> Context)
Compute the list of completion types for Context.
A variant matcher object.
virtual std::vector< MatcherCompletion > getMatcherCompletions(llvm::ArrayRef< ArgKind > AcceptedTypes)
Compute the list of completions that match any of AcceptedTypes.