15 #ifndef LLVM_CLANG_LIB_FORMAT_FORMATTOKENLEXER_H
16 #define LLVM_CLANG_LIB_FORMAT_FORMATTOKENLEXER_H
24 #include "llvm/ADT/MapVector.h"
25 #include "llvm/ADT/StringSet.h"
26 #include "llvm/Support/Regex.h"
43 llvm::SpecificBumpPtrAllocator<FormatToken> &Allocator,
51 void tryMergePreviousTokens();
53 bool tryMergeLessLess();
54 bool tryMergeNSStringLiteral();
55 bool tryMergeJSPrivateIdentifier();
56 bool tryMergeCSharpStringLiteral();
57 bool tryMergeCSharpKeywordVariables();
58 bool tryMergeNullishCoalescingEqual();
59 bool tryTransformCSharpForEach();
60 bool tryMergeForEach();
61 bool tryTransformTryUsageForC();
74 void tryParseJSRegexLiteral();
85 void handleTemplateStrings();
87 void handleCSharpVerbatimAndInterpolatedStrings();
89 void tryParsePythonComment();
91 bool tryMerge_TMacro();
93 bool tryMergeConflictMarkers();
95 void truncateToken(
size_t NewLen);
103 std::stack<LexerState> StateStack;
105 unsigned TrailingWhitespace;
106 std::unique_ptr<Lexer> Lex;
114 llvm::SpecificBumpPtrAllocator<FormatToken> &Allocator;
116 unsigned FirstInLineIndex;
119 llvm::SmallMapVector<IdentifierInfo *, TokenType, 8> Macros;
121 bool FormattingDisabled;
123 llvm::Regex MacroBlockBeginRegex;
124 llvm::Regex MacroBlockEndRegex;
127 static const llvm::StringSet<> CSharpAttributeTargets;
130 bool readRawTokenVerilogSpecific(
Token &Tok);
134 void resetLexer(
unsigned Offset);