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 tryMergeGreaterGreater();
55 bool tryMergeNSStringLiteral();
56 bool tryMergeJSPrivateIdentifier();
57 bool tryMergeCSharpStringLiteral();
58 bool tryMergeCSharpKeywordVariables();
59 bool tryMergeNullishCoalescingEqual();
60 bool tryTransformCSharpForEach();
61 bool tryMergeForEach();
62 bool tryTransformTryUsageForC();
68 bool tryMergeTokens(
size_t Count,
TokenType NewType);
82 void tryParseJSRegexLiteral();
93 void handleTemplateStrings();
95 void handleCSharpVerbatimAndInterpolatedStrings();
97 void tryParsePythonComment();
99 bool tryMerge_TMacro();
101 bool tryMergeConflictMarkers();
103 void truncateToken(
size_t NewLen);
111 std::stack<LexerState> StateStack;
113 unsigned TrailingWhitespace;
114 std::unique_ptr<Lexer> Lex;
122 llvm::SpecificBumpPtrAllocator<FormatToken> &Allocator;
124 unsigned FirstInLineIndex;
127 llvm::SmallMapVector<IdentifierInfo *, TokenType, 8> Macros;
129 bool FormattingDisabled;
131 llvm::Regex MacroBlockBeginRegex;
132 llvm::Regex MacroBlockEndRegex;
135 static const llvm::StringSet<> CSharpAttributeTargets;
138 bool readRawTokenVerilogSpecific(
Token &Tok);
142 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.