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();
59 bool tryTransformTryUsageForC();
65 bool tryMergeTokens(
size_t Count,
TokenType NewType);
75 void tryParseJavaTextBlock();
81 void tryParseJSRegexLiteral();
92 void handleTemplateStrings();
94 void handleCSharpVerbatimAndInterpolatedStrings();
97 void handleTableGenMultilineString();
101 void handleTableGenNumericLikeIdentifier();
103 void tryParsePythonComment();
105 bool tryMerge_TMacro();
107 bool tryMergeConflictMarkers();
109 void truncateToken(
size_t NewLen);
117 std::stack<LexerState> StateStack;
119 unsigned TrailingWhitespace;
120 std::unique_ptr<Lexer> Lex;
124 const FormatStyle &Style;
128 llvm::SpecificBumpPtrAllocator<FormatToken> &Allocator;
130 unsigned FirstInLineIndex;
133 llvm::SmallMapVector<IdentifierInfo *, TokenType, 8>
Macros;
138 bool FormattingDisabled;
139 llvm::Regex FormatOffRegex;
141 llvm::Regex MacroBlockBeginRegex;
142 llvm::Regex MacroBlockEndRegex;
145 static const llvm::StringSet<> CSharpAttributeTargets;
148 bool readRawTokenVerilogSpecific(
Token &
Tok);
152 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...