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();
67 bool tryMergeTokens(
size_t Count,
TokenType NewType);
81 void tryParseJSRegexLiteral();
92 void handleTemplateStrings();
94 void handleCSharpVerbatimAndInterpolatedStrings();
96 void tryParsePythonComment();
98 bool tryMerge_TMacro();
100 bool tryMergeConflictMarkers();
102 void truncateToken(
size_t NewLen);
110 std::stack<LexerState> StateStack;
112 unsigned TrailingWhitespace;
113 std::unique_ptr<Lexer> Lex;
121 llvm::SpecificBumpPtrAllocator<FormatToken> &Allocator;
123 unsigned FirstInLineIndex;
126 llvm::SmallMapVector<IdentifierInfo *, TokenType, 8> Macros;
128 bool FormattingDisabled;
130 llvm::Regex MacroBlockBeginRegex;
131 llvm::Regex MacroBlockEndRegex;
134 static const llvm::StringSet<> CSharpAttributeTargets;
137 bool readRawTokenVerilogSpecific(
Token &Tok);
141 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.