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 tryMergeNSStringLiteral();
52 bool tryMergeJSPrivateIdentifier();
53 bool tryMergeCSharpStringLiteral();
54 bool tryMergeCSharpKeywordVariables();
55 bool tryMergeNullishCoalescingEqual();
56 bool tryTransformCSharpForEach();
57 bool tryMergeForEach();
58 bool tryTransformTryUsageForC();
64 bool tryMergeTokens(
size_t Count,
TokenType NewType);
78 void tryParseJSRegexLiteral();
89 void handleTemplateStrings();
91 void handleCSharpVerbatimAndInterpolatedStrings();
94 void handleTableGenMultilineString();
98 void handleTableGenNumericLikeIdentifier();
100 void tryParsePythonComment();
102 bool tryMerge_TMacro();
104 bool tryMergeConflictMarkers();
106 void truncateToken(
size_t NewLen);
114 std::stack<LexerState> StateStack;
116 unsigned TrailingWhitespace;
117 std::unique_ptr<Lexer> Lex;
125 llvm::SpecificBumpPtrAllocator<FormatToken> &Allocator;
127 unsigned FirstInLineIndex;
130 llvm::SmallMapVector<IdentifierInfo *, TokenType, 8> Macros;
134 bool FormattingDisabled;
136 llvm::Regex MacroBlockBeginRegex;
137 llvm::Regex MacroBlockEndRegex;
140 static const llvm::StringSet<> CSharpAttributeTargets;
143 bool readRawTokenVerilogSpecific(
Token &Tok);
147 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.