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/SmallPtrSet.h"
26#include "llvm/ADT/StringSet.h"
27#include "llvm/Support/Regex.h"
44 llvm::SpecificBumpPtrAllocator<FormatToken> &Allocator,
52 void tryMergePreviousTokens();
54 bool tryMergeLessLess();
55 bool tryMergeGreaterGreater();
56 bool tryMergeNSStringLiteral();
57 bool tryMergeJSPrivateIdentifier();
58 bool tryMergeCSharpStringLiteral();
59 bool tryMergeCSharpKeywordVariables();
60 bool tryMergeNullishCoalescingEqual();
61 bool tryTransformCSharpForEach();
62 bool tryMergeForEach();
63 bool tryTransformTryUsageForC();
69 bool tryMergeTokens(
size_t Count,
TokenType NewType);
83 void tryParseJSRegexLiteral();
94 void handleTemplateStrings();
96 void handleCSharpVerbatimAndInterpolatedStrings();
98 void tryParsePythonComment();
100 bool tryMerge_TMacro();
102 bool tryMergeConflictMarkers();
104 void truncateToken(
size_t NewLen);
112 std::stack<LexerState> StateStack;
114 unsigned TrailingWhitespace;
115 std::unique_ptr<Lexer> Lex;
123 llvm::SpecificBumpPtrAllocator<FormatToken> &Allocator;
125 unsigned FirstInLineIndex;
128 llvm::SmallMapVector<IdentifierInfo *, TokenType, 8> Macros;
132 bool FormattingDisabled;
134 llvm::Regex MacroBlockBeginRegex;
135 llvm::Regex MacroBlockEndRegex;
138 static const llvm::StringSet<> CSharpAttributeTargets;
141 bool readRawTokenVerilogSpecific(
Token &Tok);
145 void resetLexer(
unsigned Offset);
Contains functions for text encoding manipulation.
Defines the clang::LangOptions interface.
Defines the clang::SourceLocation class and associated facilities.
Defines the SourceManager interface.
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.