15#ifndef LLVM_CLANG_LIB_FORMAT_FORMATTOKENLEXER_H
16#define LLVM_CLANG_LIB_FORMAT_FORMATTOKENLEXER_H
20#include "llvm/ADT/MapVector.h"
21#include "llvm/ADT/SmallPtrSet.h"
22#include "llvm/ADT/StringSet.h"
39 llvm::SpecificBumpPtrAllocator<FormatToken> &Allocator,
47 void tryMergePreviousTokens();
49 bool tryMergeLessLess();
50 bool tryMergeGreaterGreater();
51 bool tryMergeUserDefinedLiteral();
52 bool tryMergeNSStringLiteral();
53 bool tryMergeJSPrivateIdentifier();
54 bool tryMergeCSharpStringLiteral();
55 bool tryMergeCSharpKeywordVariables();
56 bool tryMergeNullishCoalescingEqual();
57 bool tryTransformCSharpForEach();
58 bool tryMergeForEach();
64 bool tryMergeTokens(
size_t Count,
TokenType NewType);
74 void tryParseJavaTextBlock();
80 void tryParseJSRegexLiteral();
91 void handleTemplateStrings();
93 void handleCSharpVerbatimAndInterpolatedStrings();
96 void handleTableGenMultilineString();
100 void handleTableGenNumericLikeIdentifier();
102 void tryParsePythonComment();
104 bool tryMerge_TMacro();
106 bool tryMergeConflictMarkers();
108 void truncateToken(
size_t NewLen);
116 std::stack<LexerState> StateStack;
118 unsigned TrailingWhitespace;
119 std::unique_ptr<Lexer> Lex;
123 const FormatStyle &Style;
127 llvm::SpecificBumpPtrAllocator<FormatToken> &Allocator;
129 unsigned FirstInLineIndex;
132 llvm::SmallMapVector<IdentifierInfo *, TokenType, 8>
Macros;
137 bool FormattingDisabled;
138 llvm::Regex FormatOffRegex;
140 llvm::Regex MacroBlockBeginRegex;
141 llvm::Regex MacroBlockEndRegex;
144 static const llvm::StringSet<> CSharpAttributeTargets;
147 bool readRawTokenVerilogSpecific(
Token &
Tok);
151 void resetLexer(
unsigned Offset);
Contains functions for text encoding manipulation.
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
Implements an efficient mapping from strings to IdentifierInfo nodes.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
This class handles loading and caching of source files into memory.
Token - This structure provides full information about a lexed token.
The JSON file list parser is used to communicate input to InstallAPI.
std::vector< std::string > Macros
A list of macros of the form <definition>=<expansion> .
std::vector< std::string > TypeNames
A vector of non-keyword identifiers that should be interpreted as type names.
std::vector< std::string > MacrosSkippedByRemoveParentheses
A vector of function-like macros whose invocations should be skipped by RemoveParentheses.
std::vector< std::string > TemplateNames
A vector of non-keyword identifiers that should be interpreted as template names.
std::vector< std::string > VariableTemplates
A vector of non-keyword identifiers that should be interpreted as variable template names.
Encapsulates keywords that are context sensitive or for languages not properly supported by Clang's l...