clang  6.0.0svn
Classes | Public Types | Static Public Member Functions | List of all members
clang::ast_matchers::dynamic::Parser Class Reference

Matcher expression parser. More...

#include "clang/ASTMatchers/Dynamic/Parser.h"

Classes

class  CodeTokenizer
 Simple tokenizer for the parser. More...
 
class  RegistrySema
 Sema implementation that uses the matcher registry to process the tokens. More...
 
struct  ScopedContextEntry
 
class  Sema
 Interface to connect the parser with the registry and more. More...
 
struct  TokenInfo
 Simple structure to hold information for one token from the parser. More...
 

Public Types

using NamedValueMap = llvm::StringMap< VariantValue >
 

Static Public Member Functions

static llvm::Optional< DynTypedMatcher > parseMatcherExpression (StringRef MatcherCode, Sema *S, const NamedValueMap *NamedValues, Diagnostics *Error)
 Parse a matcher expression. More...
 
static llvm::Optional< DynTypedMatcher > parseMatcherExpression (StringRef MatcherCode, Sema *S, Diagnostics *Error)
 
static llvm::Optional< DynTypedMatcher > parseMatcherExpression (StringRef MatcherCode, Diagnostics *Error)
 
static bool parseExpression (StringRef Code, Sema *S, const NamedValueMap *NamedValues, VariantValue *Value, Diagnostics *Error)
 Parse an expression. More...
 
static bool parseExpression (StringRef Code, Sema *S, VariantValue *Value, Diagnostics *Error)
 
static bool parseExpression (StringRef Code, VariantValue *Value, Diagnostics *Error)
 
static std::vector< MatcherCompletioncompleteExpression (StringRef Code, unsigned CompletionOffset, Sema *S, const NamedValueMap *NamedValues)
 Complete an expression at the given offset. More...
 
static std::vector< MatcherCompletioncompleteExpression (StringRef Code, unsigned CompletionOffset, Sema *S)
 
static std::vector< MatcherCompletioncompleteExpression (StringRef Code, unsigned CompletionOffset)
 

Detailed Description

Matcher expression parser.

Definition at line 56 of file Parser.h.

Member Typedef Documentation

◆ NamedValueMap

Definition at line 150 of file Parser.h.

Member Function Documentation

◆ completeExpression() [1/3]

std::vector< MatcherCompletion > clang::ast_matchers::dynamic::Parser::completeExpression ( StringRef  Code,
unsigned  CompletionOffset,
Sema S,
const NamedValueMap NamedValues 
)
static

Complete an expression at the given offset.

Parameters
SThe Sema instance that will help the parser construct the matchers. If null, it uses the default registry.
NamedValuesA map of precomputed named values. This provides the dictionary for the <NamedValue> rule of the grammar. If null, it is ignored.
Returns
The list of completions, which may be empty if there are no available completions or if an error occurred.

Definition at line 613 of file Parser.cpp.

References P, clang::ast_matchers::dynamic::MatcherCompletion::Specificity, and clang::ast_matchers::dynamic::MatcherCompletion::TypedText.

Referenced by completeExpression(), and parseExpression().

◆ completeExpression() [2/3]

static std::vector<MatcherCompletion> clang::ast_matchers::dynamic::Parser::completeExpression ( StringRef  Code,
unsigned  CompletionOffset,
Sema S 
)
inlinestatic

Definition at line 220 of file Parser.h.

References completeExpression().

◆ completeExpression() [3/3]

static std::vector<MatcherCompletion> clang::ast_matchers::dynamic::Parser::completeExpression ( StringRef  Code,
unsigned  CompletionOffset 
)
inlinestatic

Definition at line 224 of file Parser.h.

References completeExpression().

◆ parseExpression() [1/3]

bool clang::ast_matchers::dynamic::Parser::parseExpression ( StringRef  Code,
Sema S,
const NamedValueMap NamedValues,
VariantValue Value,
Diagnostics Error 
)
static

Parse an expression.

Parses any expression supported by this parser. In general, the parseMatcherExpression function is a better approach to get a matcher object.

Parameters
SThe Sema instance that will help the parser construct the matchers. If null, it uses the default registry.
NamedValuesA map of precomputed named values. This provides the dictionary for the <NamedValue> rule of the grammar. If null, it is ignored.

Definition at line 598 of file Parser.cpp.

References clang::ast_matchers::dynamic::Diagnostics::addError(), clang::ast_matchers::dynamic::Diagnostics::ET_ParserTrailingCode, clang::ast_matchers::dynamic::Parser::TokenInfo::Kind, clang::ast_matchers::dynamic::Parser::CodeTokenizer::peekNextToken(), clang::ast_matchers::dynamic::Parser::TokenInfo::Range, and clang::ast_matchers::dynamic::Parser::TokenInfo::TK_Eof.

Referenced by parseExpression(), and parseMatcherExpression().

◆ parseExpression() [2/3]

static bool clang::ast_matchers::dynamic::Parser::parseExpression ( StringRef  Code,
Sema S,
VariantValue Value,
Diagnostics Error 
)
inlinestatic

Definition at line 196 of file Parser.h.

References parseExpression().

◆ parseExpression() [3/3]

static bool clang::ast_matchers::dynamic::Parser::parseExpression ( StringRef  Code,
VariantValue Value,
Diagnostics Error 
)
inlinestatic

Definition at line 200 of file Parser.h.

References completeExpression(), and parseExpression().

◆ parseMatcherExpression() [1/3]

llvm::Optional< DynTypedMatcher > clang::ast_matchers::dynamic::Parser::parseMatcherExpression ( StringRef  MatcherCode,
Sema S,
const NamedValueMap NamedValues,
Diagnostics Error 
)
static

Parse a matcher expression.

Parameters
MatcherCodeThe matcher expression to parse.
SThe Sema instance that will help the parser construct the matchers. If null, it uses the default registry.
NamedValuesA map of precomputed named values. This provides the dictionary for the <NamedValue> rule of the grammar. If null, it is ignored.
Returns
The matcher object constructed by the processor, or an empty Optional if an error occurred. In that case, Error will contain a description of the error. The caller takes ownership of the DynTypedMatcher object returned.

Definition at line 633 of file Parser.cpp.

References clang::ast_matchers::dynamic::Diagnostics::addError(), clang::ast_matchers::dynamic::Diagnostics::ET_ParserNotAMatcher, clang::ast_matchers::dynamic::Diagnostics::ET_ParserOverloadedType, clang::ast_matchers::dynamic::VariantValue::getMatcher(), clang::ast_matchers::dynamic::VariantMatcher::getSingleMatcher(), clang::ast_matchers::dynamic::VariantValue::getTypeAsString(), clang::ast_matchers::dynamic::VariantValue::isMatcher(), and parseExpression().

Referenced by parseMatcherExpression().

◆ parseMatcherExpression() [2/3]

static llvm::Optional<DynTypedMatcher> clang::ast_matchers::dynamic::Parser::parseMatcherExpression ( StringRef  MatcherCode,
Sema S,
Diagnostics Error 
)
inlinestatic

Definition at line 172 of file Parser.h.

References parseMatcherExpression().

◆ parseMatcherExpression() [3/3]

static llvm::Optional<DynTypedMatcher> clang::ast_matchers::dynamic::Parser::parseMatcherExpression ( StringRef  MatcherCode,
Diagnostics Error 
)
inlinestatic

Definition at line 177 of file Parser.h.

References parseExpression(), and parseMatcherExpression().


The documentation for this class was generated from the following files: