clang 20.0.0git
Functions
Parsing.cpp File Reference
#include "clang/Tooling/Transformer/Parsing.h"
#include "clang/AST/Expr.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Basic/CharInfo.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Lex/Lexer.h"
#include "clang/Tooling/Transformer/RangeSelector.h"
#include "clang/Tooling/Transformer/SourceCode.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/Error.h"
#include <optional>
#include <string>
#include <utility>
#include <vector>

Go to the source code of this file.

Functions

static const llvm::StringMap< RangeSelectorOp< std::string > > & getUnaryStringSelectors ()
 
static const llvm::StringMap< RangeSelectorOp< RangeSelector > > & getUnaryRangeSelectors ()
 
static const llvm::StringMap< RangeSelectorOp< std::string, std::string > > & getBinaryStringSelectors ()
 
static const llvm::StringMap< RangeSelectorOp< RangeSelector, RangeSelector > > & getBinaryRangeSelectors ()
 
template<typename Element >
std::optional< Element > findOptional (const llvm::StringMap< Element > &Map, llvm::StringRef Key)
 
template<typename ResultType >
ParseProgress< ResultType > makeParseProgress (ParseState State, ResultType Result)
 
static llvm::Error makeParseError (const ParseState &S, std::string ErrorMsg)
 
static ParseState advance (ParseState S, size_t N)
 
static StringRef consumeWhitespace (StringRef S)
 
static ExpectedProgress< std::nullopt_t > parseChar (char c, ParseState State)
 
static ExpectedProgress< std::string > parseId (ParseState State)
 
static ExpectedProgress< std::string > parseStringId (ParseState State)
 
template<typename T >
ExpectedProgress< RangeSelectorparseSingle (ParseFunction< T > ParseElement, RangeSelectorOp< T > Op, ParseState State)
 
template<typename T >
ExpectedProgress< RangeSelectorparsePair (ParseFunction< T > ParseElement, RangeSelectorOp< T, T > Op, ParseState State)
 
static ExpectedProgress< RangeSelectorparseRangeSelectorImpl (ParseState State)
 

Function Documentation

◆ advance()

static ParseState advance ( ParseState  S,
size_t  N 
)
static

Definition at line 144 of file Parsing.cpp.

Referenced by TokenCollector::Builder::build(), parseChar(), parseId(), and parseStringId().

◆ consumeWhitespace()

static StringRef consumeWhitespace ( StringRef  S)
static

◆ findOptional()

template<typename Element >
std::optional< Element > findOptional ( const llvm::StringMap< Element > &  Map,
llvm::StringRef  Key 
)

Definition at line 123 of file Parsing.cpp.

Referenced by parseRangeSelectorImpl().

◆ getBinaryRangeSelectors()

static const llvm::StringMap< RangeSelectorOp< RangeSelector, RangeSelector > > & getBinaryRangeSelectors ( )
static

Definition at line 116 of file Parsing.cpp.

References clang::transformer::between(), and clang::transformer::enclose().

Referenced by parseRangeSelectorImpl().

◆ getBinaryStringSelectors()

static const llvm::StringMap< RangeSelectorOp< std::string, std::string > > & getBinaryStringSelectors ( )
static

Definition at line 109 of file Parsing.cpp.

References clang::transformer::encloseNodes().

Referenced by parseRangeSelectorImpl().

◆ getUnaryRangeSelectors()

static const llvm::StringMap< RangeSelectorOp< RangeSelector > > & getUnaryRangeSelectors ( )
static

◆ getUnaryStringSelectors()

static const llvm::StringMap< RangeSelectorOp< std::string > > & getUnaryStringSelectors ( )
static

◆ makeParseError()

static llvm::Error makeParseError ( const ParseState &  S,
std::string  ErrorMsg 
)
static

◆ makeParseProgress()

template<typename ResultType >
ParseProgress< ResultType > makeParseProgress ( ParseState  State,
ResultType  Result 
)

Definition at line 132 of file Parsing.cpp.

Referenced by parseChar(), parseId(), parsePair(), parseSingle(), and parseStringId().

◆ parseChar()

static ExpectedProgress< std::nullopt_t > parseChar ( char  c,
ParseState  State 
)
static

Definition at line 155 of file Parsing.cpp.

References advance(), c, consumeWhitespace(), makeParseError(), and makeParseProgress().

Referenced by parsePair(), and parseSingle().

◆ parseId()

static ExpectedProgress< std::string > parseId ( ParseState  State)
static

◆ parsePair()

template<typename T >
ExpectedProgress< RangeSelector > parsePair ( ParseFunction< T >  ParseElement,
RangeSelectorOp< T, T >  Op,
ParseState  State 
)

Definition at line 215 of file Parsing.cpp.

References makeParseProgress(), P, and parseChar().

Referenced by parseRangeSelectorImpl().

◆ parseRangeSelectorImpl()

static ExpectedProgress< RangeSelector > parseRangeSelectorImpl ( ParseState  State)
static

◆ parseSingle()

template<typename T >
ExpectedProgress< RangeSelector > parseSingle ( ParseFunction< T >  ParseElement,
RangeSelectorOp< T >  Op,
ParseState  State 
)

Definition at line 194 of file Parsing.cpp.

References E, makeParseProgress(), P, and parseChar().

Referenced by parseRangeSelectorImpl().

◆ parseStringId()

static ExpectedProgress< std::string > parseStringId ( ParseState  State)
static

Definition at line 175 of file Parsing.cpp.

References advance(), c, consumeWhitespace(), Id, makeParseError(), and makeParseProgress().

Referenced by parseRangeSelectorImpl().