16 #ifndef LLVM_CLANG_LIB_FORMAT_FORMATTOKEN_H
17 #define LLVM_CLANG_LIB_FORMAT_FORMATTOKEN_H
28 #define LIST_TOKEN_TYPES \
29 TYPE(ArrayInitializerLSquare) \
30 TYPE(ArraySubscriptLSquare) \
31 TYPE(AttributeParen) \
32 TYPE(BinaryOperator) \
36 TYPE(ConditionalExpr) \
37 TYPE(ConflictAlternative) \
40 TYPE(CtorInitializerColon) \
41 TYPE(CtorInitializerComma) \
42 TYPE(DesignatedInitializerPeriod) \
45 TYPE(FunctionAnnotationRParen) \
46 TYPE(FunctionDeclarationName) \
47 TYPE(FunctionLBrace) \
48 TYPE(FunctionTypeLParen) \
49 TYPE(ImplicitStringLiteral) \
50 TYPE(InheritanceColon) \
51 TYPE(InlineASMBrace) \
52 TYPE(InlineASMColon) \
53 TYPE(JavaAnnotation) \
54 TYPE(JsComputedPropertyName) \
57 TYPE(JsTypeOptionalQuestion) \
60 TYPE(LeadingJavaAnnotation) \
62 TYPE(MacroBlockBegin) \
64 TYPE(ObjCBlockLBrace) \
65 TYPE(ObjCBlockLParen) \
68 TYPE(ObjCMethodExpr) \
69 TYPE(ObjCMethodSpecifier) \
71 TYPE(ObjCStringLiteral) \
72 TYPE(OverloadedOperator) \
73 TYPE(OverloadedOperatorLParen) \
74 TYPE(PointerOrReference) \
75 TYPE(PureVirtualSpecifier) \
76 TYPE(RangeBasedForLoopColon) \
80 TYPE(TemplateCloser) \
81 TYPE(TemplateOpener) \
82 TYPE(TemplateString) \
83 TYPE(TrailingAnnotation) \
84 TYPE(TrailingReturnArrow) \
85 TYPE(TrailingUnaryOperator) \
90 #define TYPE(X) TT_##X,
196 std::unique_ptr<TokenRole>
Role;
286 template <
typename A,
typename B>
bool isOneOf(A K1, B K2)
const {
287 return is(K1) ||
is(K2);
289 template <
typename A,
typename B,
typename... Ts>
293 template <
typename T>
bool isNot(T
Kind)
const {
return !
is(Kind); }
302 return isOneOf(tok::kw_public, tok::kw_protected, tok::kw_private) &&
303 (!ColonRequired || (
Next &&
Next->
is(tok::colon)));
318 return isOneOf(tok::l_paren, tok::l_brace, tok::l_square,
323 return isOneOf(tok::r_paren, tok::r_brace, tok::r_square,
329 return isOneOf(tok::arrow, tok::period, tok::arrowstar) &&
330 !
isOneOf(TT_DesignatedInitializerPeriod, TT_TrailingReturnArrow,
339 case tok::minusminus:
343 case tok::kw_alignof:
356 return is(tok::comment) &&
368 case tok::kw_alignof:
369 case tok::kw_alignas:
370 case tok::kw_decltype:
371 case tok::kw_noexcept:
372 case tok::kw_static_assert:
373 case tok::kw___attribute:
396 while (Tok && Tok->
is(tok::comment))
404 while (Tok && Tok->
is(tok::comment))
412 return is(TT_ArrayInitializerLSquare) ||
429 class ContinuationIndenter;
476 bool DryRun)
override;
479 bool DryRun)
override;
483 Commas.push_back(Token);
489 struct ColumnFormat {
505 const ColumnFormat *getColumnFormat(
unsigned RemainingCharacters)
const;
517 bool HasNestedBracedList;
SourceLocation getEnd() const
bool isStringLiteral(TokenKind K)
Return true if this is a C or C++ string-literal (or C++11 user-defined-string-literal) token...
tok::TokenKind getKind() const
Implements an efficient mapping from strings to IdentifierInfo nodes.
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
Defines and computes precedence levels for binary/ternary operators.
ObjCKeywordKind
Provides a namespace for Objective-C keywords which start with an '@'.
Encodes a location in the source. The SourceManager can decode this to get at the full include stack...
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
bool isObjCAtKeyword(tok::ObjCKeywordKind objcKey) const
Return true if we have an ObjC keyword identifier.
TokenKind
Provides a simple uniform namespace for tokens from all C languages.
bool is(tok::TokenKind K) const
prec::Level getBinOpPrecedence(tok::TokenKind Kind, bool GreaterThanIsOperator, bool CPlusPlus11)
Return the precedence of the specified binary operator token.
A trivial tuple used to represent a source range.
IdentifierInfo * getIdentifierInfo() const