• Home
  • Raw
  • Download

Lines Matching refs:tok

39     Contexts.push_back(Context(tok::unknown, 1, /*IsExpression=*/false));  in AnnotatingParser()
54 if (Previous.Previous->is(tok::r_paren) && Contexts.size() > 1 && in parseAngle()
62 ScopedContextCreator ContextCreator(*this, tok::less, 12); in parseAngle()
72 Left->Previous && Left->Previous->Tok.isNot(tok::kw_template); in parseAngle()
75 CurrentToken->is(tok::question)) in parseAngle()
79 if (CurrentToken->is(tok::greater)) { in parseAngle()
86 if (CurrentToken->is(tok::question) && in parseAngle()
91 if (CurrentToken->isOneOf(tok::r_paren, tok::r_square, tok::r_brace) || in parseAngle()
92 (CurrentToken->isOneOf(tok::colon, tok::question) && InExprContext)) in parseAngle()
100 if (CurrentToken->Previous->isOneOf(tok::pipepipe, tok::ampamp) && in parseAngle()
103 !Line.startsWith(tok::kw_template)) in parseAngle()
117 ScopedContextCreator ContextCreator(*this, tok::l_paren, 1); in parseParens()
124 if (CurrentToken->is(tok::caret)) { in parseParens()
129 if (MaybeSel->isObjCAtKeyword(tok::objc_selector) && MaybeSel->Previous && in parseParens()
130 MaybeSel->Previous->is(tok::at)) { in parseParens()
138 Line.startsWith(Keywords.kw_type, tok::identifier)) { in parseParens()
142 (Left->Previous->isOneOf(tok::kw_static_assert, tok::kw_decltype, in parseParens()
143 tok::kw_if, tok::kw_while, tok::l_paren, in parseParens()
144 tok::comma) || in parseParens()
150 (Left->Previous->endsSequence(tok::identifier, in parseParens()
158 } else if (Left->Previous && Left->Previous->is(tok::r_square) && in parseParens()
164 (!Left->Previous || !Left->Previous->is(tok::identifier))) { in parseParens()
169 } else if (Left->Previous && Left->Previous->is(tok::kw___attribute)) { in parseParens()
180 Left->Previous && Left->Previous->isOneOf(tok::kw_for, tok::kw_catch); in parseParens()
190 bool ProbablyFunctionType = CurrentToken->isOneOf(tok::star, tok::amp); in parseParens()
194 Left->Previous && Left->Previous->is(tok::kw_for); in parseParens()
205 if (PrevPrev && PrevPrev->is(tok::identifier) && in parseParens()
206 Prev->isOneOf(tok::star, tok::amp, tok::ampamp) && in parseParens()
207 CurrentToken->is(tok::identifier) && Next->isNot(tok::equal)) { in parseParens()
215 CurrentToken->Previous->Previous->isOneOf(tok::l_paren, in parseParens()
216 tok::coloncolon)) in parseParens()
218 if (CurrentToken->is(tok::comma)) in parseParens()
222 if (CurrentToken->is(tok::r_paren)) { in parseParens()
224 (CurrentToken->Next->is(tok::l_paren) || in parseParens()
225 (CurrentToken->Next->is(tok::l_square) && Line.MustBeDeclaration))) in parseParens()
230 if (CurrentToken->Next && CurrentToken->Next->is(tok::l_brace) && in parseParens()
231 Left->Previous && Left->Previous->is(tok::l_paren)) { in parseParens()
237 Tok->isOneOf(tok::star, tok::amp, tok::ampamp)) in parseParens()
267 if (CurrentToken->isOneOf(tok::r_square, tok::r_brace)) in parseParens()
270 if (CurrentToken->is(tok::l_brace)) in parseParens()
272 if (CurrentToken->is(tok::comma) && CurrentToken->Next && in parseParens()
276 if (CurrentToken->isOneOf(tok::kw_const, tok::kw_auto) || in parseParens()
279 if (CurrentToken->isOneOf(tok::semi, tok::colon)) in parseParens()
285 if (CurrentToken->is(tok::comma)) in parseParens()
311 CurrentToken->isNot(tok::l_brace) && in parseSquare()
313 Parent->isOneOf(tok::colon, tok::l_square, tok::l_paren, in parseSquare()
314 tok::kw_return, tok::kw_throw) || in parseSquare()
325 Contexts.back().ContextKind == tok::l_brace && in parseSquare()
326 Parent->isOneOf(tok::l_brace, tok::comma)) { in parseSquare()
330 Parent->isOneOf(TT_BinaryOperator, TT_TemplateCloser, tok::at, in parseSquare()
331 tok::comma, tok::l_paren, tok::l_square, in parseSquare()
332 tok::question, tok::colon, tok::kw_return, in parseSquare()
334 tok::kw_default))) { in parseSquare()
342 ScopedContextCreator ContextCreator(*this, tok::l_square, BindingIncrease); in parseSquare()
347 if (CurrentToken->is(tok::r_square)) { in parseSquare()
348 if (CurrentToken->Next && CurrentToken->Next->is(tok::l_paren) && in parseSquare()
374 if (CurrentToken->isOneOf(tok::r_paren, tok::r_brace)) in parseSquare()
376 if (CurrentToken->is(tok::colon)) { in parseSquare()
381 if (Parent && Parent->is(tok::r_paren)) in parseSquare()
386 if (CurrentToken->is(tok::comma) && Left->is(TT_ObjCMethodExpr) && in parseSquare()
406 ScopedContextCreator ContextCreator(*this, tok::l_brace, 1); in parseBrace()
412 if (CurrentToken->is(tok::r_brace)) { in parseBrace()
418 if (CurrentToken->isOneOf(tok::r_paren, tok::r_square)) in parseBrace()
421 if (CurrentToken->isOneOf(tok::colon, tok::l_brace)) { in parseBrace()
423 if (((CurrentToken->is(tok::colon) && in parseBrace()
428 Previous->is(tok::string_literal))) in parseBrace()
430 if (CurrentToken->is(tok::colon) || in parseBrace()
442 if (Current->is(tok::l_brace) && Current->BlockKind == BK_Block) in updateParameterCount()
444 if (Current->is(tok::comma)) { in updateParameterCount()
449 } else if (Left->ParameterCount == 0 && Current->isNot(tok::comment)) { in updateParameterCount()
456 if (CurrentToken->is(tok::colon)) { in parseConditional()
468 if (CurrentToken && CurrentToken->is(tok::less)) { in parseTemplateDeclaration()
484 case tok::plus: in consumeToken()
485 case tok::minus: in consumeToken()
489 case tok::colon: in consumeToken()
496 !Line.First->isOneOf(tok::kw_enum, tok::kw_case)) || in consumeToken()
497 Contexts.back().ContextKind == tok::l_paren || // function params in consumeToken()
498 Contexts.back().ContextKind == tok::l_square || // array type in consumeToken()
519 } else if (CurrentToken && CurrentToken->is(tok::numeric_constant)) { in consumeToken()
522 !Line.First->isOneOf(tok::kw_enum, tok::kw_case)) { in consumeToken()
523 if (Tok->Previous->isOneOf(tok::r_paren, tok::kw_noexcept)) in consumeToken()
527 } else if (Tok->Previous->is(tok::identifier) && Tok->Next && in consumeToken()
528 Tok->Next->isOneOf(tok::r_paren, tok::comma)) { in consumeToken()
532 } else if (Contexts.back().ContextKind == tok::l_paren) { in consumeToken()
536 case tok::pipe: in consumeToken()
537 case tok::amp: in consumeToken()
544 case tok::kw_if: in consumeToken()
545 case tok::kw_while: in consumeToken()
546 if (CurrentToken && CurrentToken->is(tok::l_paren)) { in consumeToken()
552 case tok::kw_for: in consumeToken()
554 Tok->Previous->is(tok::period)) in consumeToken()
561 case tok::l_paren: in consumeToken()
567 Tok->Previous->is(tok::r_paren) && in consumeToken()
580 !Tok->Previous->isOneOf(tok::kw_decltype, tok::kw___attribute, in consumeToken()
584 case tok::l_square: in consumeToken()
588 case tok::l_brace: in consumeToken()
592 case tok::less: in consumeToken()
602 case tok::r_paren: in consumeToken()
603 case tok::r_square: in consumeToken()
605 case tok::r_brace: in consumeToken()
610 case tok::greater: in consumeToken()
613 case tok::kw_operator: in consumeToken()
615 !CurrentToken->isOneOf(tok::l_paren, tok::semi, tok::r_paren)) { in consumeToken()
616 if (CurrentToken->isOneOf(tok::star, tok::amp)) in consumeToken()
620 CurrentToken->Previous->isOneOf(TT_BinaryOperator, tok::comma)) in consumeToken()
629 case tok::question: in consumeToken()
631 Tok->Next->isOneOf(tok::semi, tok::comma, tok::colon, tok::r_paren, in consumeToken()
632 tok::r_brace)) { in consumeToken()
647 case tok::kw_template: in consumeToken()
650 case tok::comma: in consumeToken()
654 (Contexts.size() == 1 || Line.startsWith(tok::kw_for))) { in consumeToken()
668 if (CurrentToken && CurrentToken->is(tok::less)) { in parseIncludeDirective()
671 if (CurrentToken->isNot(tok::comment) || CurrentToken->Next) in parseIncludeDirective()
723 if (CurrentToken->Tok.is(tok::numeric_constant)) { in parsePreprocessorDirective()
732 case tok::pp_include: in parsePreprocessorDirective()
733 case tok::pp_include_next: in parsePreprocessorDirective()
734 case tok::pp_import: in parsePreprocessorDirective()
739 case tok::pp_error: in parsePreprocessorDirective()
740 case tok::pp_warning: in parsePreprocessorDirective()
743 case tok::pp_pragma: in parsePreprocessorDirective()
746 case tok::pp_if: in parsePreprocessorDirective()
747 case tok::pp_elif: in parsePreprocessorDirective()
762 if (CurrentToken->is(tok::hash)) in parseLine()
771 (Info && Info->getPPKeywordID() == tok::pp_import && in parseLine()
773 CurrentToken->Next->isOneOf(tok::string_literal, tok::identifier, in parseLine()
774 tok::kw_static))) { in parseLine()
782 if (CurrentToken->is(tok::less) && Line.Last->is(tok::greater)) { in parseLine()
792 if (CurrentToken && CurrentToken->is(tok::identifier)) in parseLine()
805 if (CurrentToken->is(tok::kw_virtual)) in parseLine()
814 if (Line.First->is(tok::kw_export) && in parseLine()
843 return Tok.TokenText == "goog" && Tok.Next && Tok.Next->is(tok::period) && in isClosureImportStatement()
849 Tok.Next->Next->Next && Tok.Next->Next->Next->is(tok::l_paren); in isClosureImportStatement()
884 Context(tok::TokenKind ContextKind, unsigned BindingStrength, in Context()
889 tok::TokenKind ContextKind;
910 ScopedContextCreator(AnnotatingParser &P, tok::TokenKind ContextKind, in ScopedContextCreator()
923 !Line.First->isOneOf(tok::kw_template, tok::kw_using, tok::kw_return) && in modifyContext()
926 Line.startsWith(Keywords.kw_type, tok::identifier)) && in modifyContext()
927 (!Current.Previous || Current.Previous->isNot(tok::kw_operator))) { in modifyContext()
932 !Previous->Previous->isOneOf(tok::comma, tok::semi); in modifyContext()
934 if (Previous->isOneOf(tok::r_square, tok::r_paren)) { in modifyContext()
942 Previous->isOneOf(tok::star, tok::amp, tok::ampamp) && in modifyContext()
943 Previous->Previous && Previous->Previous->isNot(tok::equal)) in modifyContext()
947 } else if (Current.is(tok::lessless) && in modifyContext()
948 (!Current.Previous || !Current.Previous->is(tok::kw_operator))) { in modifyContext()
950 } else if (Current.isOneOf(tok::kw_return, tok::kw_throw)) { in modifyContext()
960 } else if (Current.isOneOf(tok::r_paren, tok::greater, tok::comma)) { in modifyContext()
962 Previous && Previous->isOneOf(tok::star, tok::amp); in modifyContext()
967 } else if (Current.is(tok::kw_new)) { in modifyContext()
969 } else if (Current.isOneOf(tok::semi, tok::exclaim)) { in modifyContext()
989 } else if (Current.isOneOf(tok::kw_auto, tok::kw___auto_type)) { in determineTokenType()
991 } else if (Current.is(tok::arrow) && in determineTokenType()
994 } else if (Current.is(tok::arrow) && AutoFound && Line.MustBeDeclaration && in determineTokenType()
997 } else if (Current.isOneOf(tok::star, tok::amp, tok::ampamp)) { in determineTokenType()
1002 } else if (Current.isOneOf(tok::minus, tok::plus, tok::caret)) { in determineTokenType()
1004 if (Current.is(TT_UnaryOperator) && Current.is(tok::caret)) in determineTokenType()
1006 } else if (Current.isOneOf(tok::minusminus, tok::plusplus)) { in determineTokenType()
1008 } else if (Current.isOneOf(tok::exclaim, tok::tilde)) { in determineTokenType()
1010 } else if (Current.is(tok::question)) { in determineTokenType()
1020 (!Current.Previous || Current.Previous->isNot(tok::l_square))) { in determineTokenType()
1022 } else if (Current.is(tok::comment)) { in determineTokenType()
1029 Current.Tok.setKind(tok::unknown); in determineTokenType()
1033 } else if (Current.is(tok::r_paren)) { in determineTokenType()
1038 !Current.Next->isOneOf(tok::semi, tok::colon, tok::l_brace, in determineTokenType()
1039 tok::period, tok::arrow, tok::coloncolon)) in determineTokenType()
1041 if (BeforeParen->is(tok::identifier) && in determineTokenType()
1046 } else if (Current.is(tok::at) && Current.Next) { in determineTokenType()
1051 case tok::objc_interface: in determineTokenType()
1052 case tok::objc_implementation: in determineTokenType()
1053 case tok::objc_protocol: in determineTokenType()
1056 case tok::objc_property: in determineTokenType()
1063 } else if (Current.is(tok::period)) { in determineTokenType()
1066 PreviousNoComment->isOneOf(tok::comma, tok::l_brace)) in determineTokenType()
1073 } else if (Current.isOneOf(tok::identifier, tok::kw_const) && in determineTokenType()
1075 !Current.Previous->isOneOf(tok::equal, tok::at) && in determineTokenType()
1083 if (Current.Previous->is(tok::at) && in determineTokenType()
1091 } else if (Current.Previous->is(tok::period) && in determineTokenType()
1105 if (Tok.isNot(tok::identifier) || !Tok.Previous) in isStartOfName()
1116 while (PreviousNotConst && PreviousNotConst->is(tok::kw_const)) in isStartOfName()
1122 bool IsPPKeyword = PreviousNotConst->is(tok::identifier) && in isStartOfName()
1124 PreviousNotConst->Previous->is(tok::hash); in isStartOfName()
1129 PreviousNotConst->MatchingParen->Previous->isNot(tok::period) && in isStartOfName()
1130 PreviousNotConst->MatchingParen->Previous->isNot(tok::kw_template); in isStartOfName()
1132 if (PreviousNotConst->is(tok::r_paren) && PreviousNotConst->MatchingParen && in isStartOfName()
1134 PreviousNotConst->MatchingParen->Previous->is(tok::kw_decltype)) in isStartOfName()
1138 PreviousNotConst->isOneOf(tok::identifier, tok::kw_auto)) || in isStartOfName()
1158 if (LeftOfParens->is(tok::r_paren)) { in rParenEndsCast()
1168 !LeftOfParens->isOneOf(Keywords.kw_in, tok::kw_return, tok::kw_case, in rParenEndsCast()
1169 tok::kw_delete)) in rParenEndsCast()
1174 if (LeftOfParens->isOneOf(tok::at, tok::r_square, TT_OverloadedOperator, in rParenEndsCast()
1175 TT_TemplateCloser, tok::ellipsis)) in rParenEndsCast()
1179 if (Tok.Next->is(tok::question)) in rParenEndsCast()
1184 if (Style.Language == FormatStyle::LK_Java && Tok.Next->is(tok::l_paren)) in rParenEndsCast()
1188 if (Tok.Next->isNot(tok::string_literal) && in rParenEndsCast()
1190 Tok.Next->isOneOf(tok::kw_sizeof, tok::kw_alignof))) in rParenEndsCast()
1199 Tok.Next->isOneOf(tok::equal, tok::semi, tok::l_brace, tok::greater); in rParenEndsCast()
1211 if (Tok.Next->isOneOf(tok::identifier, tok::kw_this)) in rParenEndsCast()
1221 Tok.Next->isUnaryOperator() || Tok.Next->isOneOf(tok::amp, tok::star); in rParenEndsCast()
1222 if (!NextIsUnary || Tok.Next->is(tok::plus) || in rParenEndsCast()
1223 !Tok.Next->Next->isOneOf(tok::identifier, tok::numeric_constant)) in rParenEndsCast()
1228 if (!Prev->isOneOf(tok::kw_const, tok::identifier, tok::coloncolon)) in rParenEndsCast()
1246 NextToken->isOneOf(tok::arrow, Keywords.kw_final, in determineStarAmpUsage()
1248 (NextToken->is(tok::l_brace) && !NextToken->getNextNonComment())) in determineStarAmpUsage()
1251 if (PrevToken->is(tok::coloncolon)) in determineStarAmpUsage()
1254 if (PrevToken->isOneOf(tok::l_paren, tok::l_square, tok::l_brace, in determineStarAmpUsage()
1255 tok::comma, tok::semi, tok::kw_return, tok::colon, in determineStarAmpUsage()
1256 tok::equal, tok::kw_delete, tok::kw_sizeof) || in determineStarAmpUsage()
1261 if (NextToken->is(tok::l_square) && NextToken->isNot(TT_LambdaLSquare)) in determineStarAmpUsage()
1263 if (NextToken->is(tok::kw_operator) && !IsExpression) in determineStarAmpUsage()
1265 if (NextToken->isOneOf(tok::comma, tok::semi)) in determineStarAmpUsage()
1268 if (PrevToken->is(tok::r_paren) && PrevToken->MatchingParen && in determineStarAmpUsage()
1270 PrevToken->MatchingParen->Previous->isOneOf(tok::kw_typeof, in determineStarAmpUsage()
1271 tok::kw_decltype)) in determineStarAmpUsage()
1275 PrevToken->isOneOf(tok::r_paren, tok::r_square, tok::kw_true, in determineStarAmpUsage()
1276 tok::kw_false, tok::r_brace) || in determineStarAmpUsage()
1278 NextToken->isOneOf(tok::kw_true, tok::kw_false) || in determineStarAmpUsage()
1287 if (Tok.is(tok::ampamp) && NextToken && NextToken->is(tok::l_paren)) in determineStarAmpUsage()
1293 if (NextNextToken && NextNextToken->is(tok::arrow)) in determineStarAmpUsage()
1310 if (PrevToken->isOneOf(tok::equal, tok::l_paren, tok::comma, tok::l_square, in determinePlusMinusCaretUsage()
1311 tok::question, tok::colon, tok::kw_return, in determinePlusMinusCaretUsage()
1312 tok::kw_case, tok::at, tok::l_brace)) in determinePlusMinusCaretUsage()
1328 if (PrevToken->isOneOf(tok::r_paren, tok::r_square, tok::identifier)) in determineIncrementUsage()
1364 while (Current && (Current->is(tok::kw_return) || in parse()
1365 (Current->is(tok::colon) && in parse()
1407 Precedence == prec::Assignment && Current->is(tok::colon))) { in parse()
1450 if (NextNonComment && NextNonComment->is(tok::colon) && in getCurrentPrecedence()
1457 if (Current->isOneOf(tok::semi, TT_InlineASMColon, TT_SelectorName, in getCurrentPrecedence()
1459 (Current->is(tok::comment) && NextNonComment && in getCurrentPrecedence()
1471 if (Current->is(TT_BinaryOperator) || Current->is(tok::comma)) in getCurrentPrecedence()
1473 if (Current->isOneOf(tok::period, tok::arrow)) in getCurrentPrecedence()
1490 while (Previous->is(tok::comment) && Previous->Previous) in addFakeParenthesis()
1520 if (!Current || !Current->is(tok::question)) in parseConditionalExpr()
1553 if (NextNonCommentLine && (*I)->First->is(tok::comment) && in setCommentLineLevels()
1557 NextNonCommentLine = (*I)->First->isNot(tok::r_brace) ? (*I) : nullptr; in setCommentLineLevels()
1598 if (Next->isOneOf(tok::kw_new, tok::kw_delete)) { in isFunctionDeclarationName()
1600 if (Next->Next && Next->Next->is(tok::l_square) && in isFunctionDeclarationName()
1601 Next->Next->Next && Next->Next->Next->is(tok::r_square)) in isFunctionDeclarationName()
1613 if (Current.is(tok::kw_operator)) { in isFunctionDeclarationName()
1614 if (Current.Previous && Current.Previous->is(tok::coloncolon)) in isFunctionDeclarationName()
1623 } else if (Next->is(tok::coloncolon)) { in isFunctionDeclarationName()
1627 if (Next->is(tok::kw_operator)) { in isFunctionDeclarationName()
1631 if (!Next->is(tok::identifier)) in isFunctionDeclarationName()
1633 } else if (Next->is(tok::l_paren)) { in isFunctionDeclarationName()
1642 if (!Next || !Next->is(tok::l_paren) || !Next->MatchingParen) in isFunctionDeclarationName()
1645 if (Line.Last->is(tok::l_brace)) in isFunctionDeclarationName()
1655 if (Tok->is(tok::kw_const) || Tok->isSimpleTypeSpecifier() || in isFunctionDeclarationName()
1656 Tok->isOneOf(TT_PointerOrReference, TT_StartOfName, tok::ellipsis)) in isFunctionDeclarationName()
1658 if (Tok->isOneOf(tok::l_brace, tok::string_literal, TT_ObjCMethodExpr) || in isFunctionDeclarationName()
1721 if (Parameter->isOneOf(tok::comment, tok::r_brace)) in calculateFormattingInformation()
1723 if (Parameter->Previous && Parameter->Previous->is(tok::comma)) { in calculateFormattingInformation()
1788 Current->isOneOf(tok::comment, tok::string_literal)) { in calculateUnbreakableTailLengths()
1804 if (Left.is(tok::semi)) in splitPenalty()
1812 if (Left.is(tok::comma) && Left.NestingLevel == 0) in splitPenalty()
1815 if (Right.is(Keywords.kw_function) && Left.isNot(tok::comma)) in splitPenalty()
1821 if (Left.is(tok::comma) || (Right.is(tok::identifier) && Right.Next && in splitPenalty()
1824 if (Right.is(tok::l_square)) { in splitPenalty()
1827 if (Left.is(tok::r_square)) in splitPenalty()
1830 if (Right.is(TT_LambdaLSquare) && Left.is(tok::equal)) in splitPenalty()
1838 Right.is(tok::kw_operator)) { in splitPenalty()
1839 if (Line.startsWith(tok::kw_for) && Right.PartOfMultiVariableDeclStmt) in splitPenalty()
1851 if (Left.is(tok::equal) && Right.is(tok::l_brace)) in splitPenalty()
1855 if (Left.is(tok::coloncolon) || in splitPenalty()
1856 (Right.is(tok::period) && Style.Language == FormatStyle::LK_Proto)) in splitPenalty()
1858 if (Left.isOneOf(tok::kw_class, tok::kw_struct)) in splitPenalty()
1860 if (Left.is(tok::comment)) in splitPenalty()
1892 (!Right.Next || Right.Next->isNot(tok::l_paren))) { in splitPenalty()
1903 return (Left.is(tok::r_paren) ? 100 : 120) + (is_short_annotation ? 50 : 0); in splitPenalty()
1907 if (Line.startsWith(tok::kw_for) && Left.is(tok::equal)) in splitPenalty()
1914 if (Left.is(tok::colon) && Left.is(TT_ObjCMethodExpr)) in splitPenalty()
1917 if (Left.is(tok::l_paren) && InFunctionDecl && in splitPenalty()
1920 if (Left.is(tok::l_paren) && Left.Previous && in splitPenalty()
1921 Left.Previous->isOneOf(tok::kw_if, tok::kw_for)) in splitPenalty()
1923 if (Left.is(tok::equal) && InFunctionDecl) in splitPenalty()
1925 if (Right.is(tok::r_brace)) in splitPenalty()
1938 if (Right.is(tok::lessless)) { in splitPenalty()
1939 if (Left.is(tok::string_literal) && in splitPenalty()
1968 if (Left.is(tok::kw_return) && Right.isNot(tok::semi)) in spaceRequiredBetween()
1971 Left.Tok.getObjCKeywordID() == tok::objc_property) in spaceRequiredBetween()
1973 if (Right.is(tok::hashhash)) in spaceRequiredBetween()
1974 return Left.is(tok::hash); in spaceRequiredBetween()
1975 if (Left.isOneOf(tok::hashhash, tok::hash)) in spaceRequiredBetween()
1976 return Right.is(tok::hash); in spaceRequiredBetween()
1977 if (Left.is(tok::l_paren) && Right.is(tok::r_paren)) in spaceRequiredBetween()
1979 if (Left.is(tok::l_paren) || Right.is(tok::r_paren)) in spaceRequiredBetween()
1984 if (Right.isOneOf(tok::semi, tok::comma)) in spaceRequiredBetween()
1986 if (Right.is(tok::less) && in spaceRequiredBetween()
1987 (Left.is(tok::kw_template) || in spaceRequiredBetween()
1990 if (Left.isOneOf(tok::exclaim, tok::tilde)) in spaceRequiredBetween()
1992 if (Left.is(tok::at) && in spaceRequiredBetween()
1993 Right.isOneOf(tok::identifier, tok::string_literal, tok::char_constant, in spaceRequiredBetween()
1994 tok::numeric_constant, tok::l_paren, tok::l_brace, in spaceRequiredBetween()
1995 tok::kw_true, tok::kw_false)) in spaceRequiredBetween()
1997 if (Left.is(tok::colon)) in spaceRequiredBetween()
1999 if (Left.is(tok::coloncolon)) in spaceRequiredBetween()
2001 if (Left.is(tok::less) || Right.isOneOf(tok::greater, tok::less)) in spaceRequiredBetween()
2003 if (Right.is(tok::ellipsis)) in spaceRequiredBetween()
2004 return Left.Tok.isLiteral() || (Left.is(tok::identifier) && Left.Previous && in spaceRequiredBetween()
2005 Left.Previous->is(tok::kw_case)); in spaceRequiredBetween()
2006 if (Left.is(tok::l_square) && Right.is(tok::amp)) in spaceRequiredBetween()
2009 return (Left.is(tok::r_paren) && Line.MightBeFunctionDecl) || in spaceRequiredBetween()
2010 (Left.Tok.isLiteral() || (Left.is(tok::kw_const) && Left.Previous && in spaceRequiredBetween()
2011 Left.Previous->is(tok::r_paren)) || in spaceRequiredBetween()
2012 (!Left.isOneOf(TT_PointerOrReference, tok::l_paren) && in spaceRequiredBetween()
2015 if (Right.is(TT_FunctionTypeLParen) && Left.isNot(tok::l_paren) && in spaceRequiredBetween()
2024 (Right.is(tok::l_brace) && Right.BlockKind == BK_Block) || in spaceRequiredBetween()
2026 tok::l_paren) && in spaceRequiredBetween()
2030 !Left.Previous->isOneOf(tok::l_paren, tok::coloncolon)); in spaceRequiredBetween()
2031 if (Right.is(tok::star) && Left.is(tok::l_paren)) in spaceRequiredBetween()
2033 if (Left.is(tok::l_square)) in spaceRequiredBetween()
2035 Style.SpacesInContainerLiterals && Right.isNot(tok::r_square)) || in spaceRequiredBetween()
2037 Right.isNot(tok::r_square)); in spaceRequiredBetween()
2038 if (Right.is(tok::r_square)) in spaceRequiredBetween()
2044 if (Right.is(tok::l_square) && in spaceRequiredBetween()
2046 !Left.isOneOf(tok::numeric_constant, TT_DictLiteral)) in spaceRequiredBetween()
2048 if (Left.is(tok::l_brace) && Right.is(tok::r_brace)) in spaceRequiredBetween()
2050 if ((Left.is(tok::l_brace) && Left.BlockKind != BK_Block) || in spaceRequiredBetween()
2051 (Right.is(tok::r_brace) && Right.MatchingParen && in spaceRequiredBetween()
2056 if (Right.is(tok::l_paren)) { in spaceRequiredBetween()
2057 if (Left.is(tok::r_paren) && Left.is(TT_AttributeParen)) in spaceRequiredBetween()
2059 return Line.Type == LT_ObjCDecl || Left.is(tok::semi) || in spaceRequiredBetween()
2061 (Left.isOneOf(tok::kw_if, tok::pp_elif, tok::kw_for, tok::kw_while, in spaceRequiredBetween()
2062 tok::kw_switch, tok::kw_case, TT_ForEachMacro, in spaceRequiredBetween()
2064 (Left.isOneOf(tok::kw_try, Keywords.kw___except, tok::kw_catch, in spaceRequiredBetween()
2065 tok::kw_new, tok::kw_delete) && in spaceRequiredBetween()
2066 (!Left.Previous || Left.Previous->isNot(tok::period))))) || in spaceRequiredBetween()
2068 (Left.is(tok::identifier) || Left.isFunctionLikeKeyword() || in spaceRequiredBetween()
2069 Left.is(tok::r_paren)) && in spaceRequiredBetween()
2072 if (Left.is(tok::at) && Right.Tok.getObjCKeywordID() != tok::objc_not_keyword) in spaceRequiredBetween()
2075 return !Left.isOneOf(tok::l_paren, tok::l_square, tok::at) && in spaceRequiredBetween()
2076 (Left.isNot(tok::colon) || Left.isNot(TT_ObjCMethodExpr)); in spaceRequiredBetween()
2077 if ((Left.isOneOf(tok::identifier, tok::greater, tok::r_square, in spaceRequiredBetween()
2078 tok::r_paren) || in spaceRequiredBetween()
2080 Right.is(tok::l_brace) && Right.getNextNonComment() && in spaceRequiredBetween()
2083 if (Left.is(tok::period) || Right.is(tok::period)) in spaceRequiredBetween()
2085 if (Right.is(tok::hash) && Left.is(tok::identifier) && Left.TokenText == "L") in spaceRequiredBetween()
2089 Left.MatchingParen->Previous->is(tok::period)) in spaceRequiredBetween()
2092 if (Left.is(TT_TemplateCloser) && Right.is(tok::l_square)) in spaceRequiredBetween()
2103 if (Left.is(tok::kw_operator)) in spaceRequiredBefore()
2104 return Right.is(tok::coloncolon); in spaceRequiredBefore()
2106 if (Right.is(tok::period) && in spaceRequiredBefore()
2110 if (Right.is(tok::l_paren) && in spaceRequiredBefore()
2116 if (Right.is(tok::star) && in spaceRequiredBefore()
2120 Keywords.kw_of, tok::kw_const) && in spaceRequiredBefore()
2121 (!Left.Previous || !Left.Previous->is(tok::period))) in spaceRequiredBefore()
2123 if (Left.is(tok::kw_default) && Left.Previous && in spaceRequiredBefore()
2124 Left.Previous->is(tok::kw_export)) in spaceRequiredBefore()
2126 if (Left.is(Keywords.kw_is) && Right.is(tok::l_brace)) in spaceRequiredBefore()
2132 if ((Left.is(tok::l_brace) || Right.is(tok::r_brace)) && in spaceRequiredBefore()
2133 Line.First->isOneOf(Keywords.kw_import, tok::kw_export)) in spaceRequiredBefore()
2135 if (Left.is(tok::ellipsis)) in spaceRequiredBefore()
2138 !Right.isOneOf(tok::equal, tok::l_brace, tok::comma, tok::l_square, in spaceRequiredBefore()
2145 if (Right.is(tok::exclaim) && (Left.isOneOf(tok::identifier, tok::r_paren, in spaceRequiredBefore()
2146 tok::r_square, tok::r_brace) || in spaceRequiredBefore()
2150 if (Left.is(tok::r_square) && Right.is(tok::l_brace)) in spaceRequiredBefore()
2152 if (Left.is(Keywords.kw_synchronized) && Right.is(tok::l_paren)) in spaceRequiredBefore()
2154 if ((Left.isOneOf(tok::kw_static, tok::kw_public, tok::kw_private, in spaceRequiredBefore()
2155 tok::kw_protected) || in spaceRequiredBefore()
2166 if (Left.is(tok::r_paren) && Right.is(tok::identifier)) in spaceRequiredBefore()
2171 (Right.is(tok::equal) || Left.is(tok::equal))) in spaceRequiredBefore()
2179 if (Left.is(tok::comma)) in spaceRequiredBefore()
2181 if (Right.is(tok::comma)) in spaceRequiredBefore()
2185 if (Right.is(tok::colon)) { in spaceRequiredBefore()
2186 if (Line.First->isOneOf(tok::kw_case, tok::kw_default) || in spaceRequiredBefore()
2187 !Right.getNextNonComment() || Right.getNextNonComment()->is(tok::semi)) in spaceRequiredBefore()
2191 if (Left.is(tok::question)) in spaceRequiredBefore()
2193 if (Right.is(TT_InlineASMColon) && Left.is(tok::coloncolon)) in spaceRequiredBefore()
2208 if (Left.is(tok::greater) && Right.is(tok::greater)) in spaceRequiredBefore()
2211 if (Right.isOneOf(tok::arrow, tok::period, tok::arrowstar, tok::periodstar) || in spaceRequiredBefore()
2212 Left.isOneOf(tok::arrow, tok::period, tok::arrowstar, tok::periodstar)) in spaceRequiredBefore()
2217 if (Right.is(tok::coloncolon) && !Left.isOneOf(tok::l_brace, tok::comment)) in spaceRequiredBefore()
2220 !(Left.isOneOf(tok::identifier, tok::l_paren, tok::r_paren, in spaceRequiredBefore()
2221 tok::l_square) || in spaceRequiredBefore()
2225 if ((Right.is(TT_BinaryOperator) && !Left.is(tok::l_paren)) || in spaceRequiredBefore()
2227 !Right.is(tok::r_paren))) in spaceRequiredBefore()
2229 if (Left.is(TT_TemplateCloser) && Right.is(tok::l_paren) && in spaceRequiredBefore()
2232 if (Right.is(TT_TemplateOpener) && Left.is(tok::r_paren) && in spaceRequiredBefore()
2235 if (Right.is(tok::less) && Left.isNot(tok::l_paren) && in spaceRequiredBefore()
2236 Line.startsWith(tok::hash)) in spaceRequiredBefore()
2247 return Tok.is(tok::l_brace) && Tok.BlockKind == BK_Block && in isAllmanBrace()
2259 if (Right.is(tok::string_literal) && Left.is(tok::plus) && Left.Previous && in mustBreakBefore()
2260 Left.Previous->is(tok::string_literal)) in mustBreakBefore()
2262 if (Left.is(TT_DictLiteral) && Left.is(tok::l_brace) && Line.Level == 0 && in mustBreakBefore()
2263 Left.Previous && Left.Previous->is(tok::equal) && in mustBreakBefore()
2264 Line.First->isOneOf(tok::identifier, Keywords.kw_import, tok::kw_export, in mustBreakBefore()
2265 tok::kw_const) && in mustBreakBefore()
2272 if (Left.is(tok::l_brace) && Line.Level == 0 && in mustBreakBefore()
2273 (Line.startsWith(tok::kw_enum) || in mustBreakBefore()
2274 Line.startsWith(tok::kw_export, tok::kw_enum))) in mustBreakBefore()
2278 if (Right.is(tok::r_brace) && Left.is(tok::l_brace) && in mustBreakBefore()
2287 if (Right.is(tok::plus) && Left.is(tok::string_literal) && Right.Next && in mustBreakBefore()
2288 Right.Next->is(tok::string_literal)) in mustBreakBefore()
2296 if (Left.isOneOf(tok::l_brace, TT_ArrayInitializerLSquare) && in mustBreakBefore()
2300 Right.MatchingParen->isOneOf(tok::l_brace, in mustBreakBefore()
2303 if (BeforeClosingBrace && (BeforeClosingBrace->is(tok::comma) || in mustBreakBefore()
2307 if (Right.is(tok::comment)) in mustBreakBefore()
2318 if (Right.is(tok::lessless) && Right.Next && in mustBreakBefore()
2319 Right.Previous->is(tok::string_literal) && in mustBreakBefore()
2320 Right.Next->is(tok::string_literal)) in mustBreakBefore()
2331 if (Right.is(tok::string_literal) && Right.TokenText.startswith("R\"")) in mustBreakBefore()
2336 if (Right.Previous->is(tok::l_brace) && Right.NestingLevel == 1 && in mustBreakBefore()
2343 return (Line.startsWith(tok::kw_enum) && Style.BraceWrapping.AfterEnum) || in mustBreakBefore()
2344 (Line.startsWith(tok::kw_class) && Style.BraceWrapping.AfterClass) || in mustBreakBefore()
2345 (Line.startsWith(tok::kw_struct) && Style.BraceWrapping.AfterStruct); in mustBreakBefore()
2352 Right.isNot(TT_LeadingJavaAnnotation) && Right.isNot(tok::l_paren) && in mustBreakBefore()
2353 (Line.Last->is(tok::l_brace) || Style.BreakAfterJavaFieldAnnotations)) in mustBreakBefore()
2372 if (Left.is(tok::kw_return)) in canBreakBefore()
2374 if (Left.is(TT_JsFatArrow) && Right.is(tok::l_brace)) in canBreakBefore()
2388 if (Left.is(tok::at)) in canBreakBefore()
2390 if (Left.Tok.getObjCKeywordID() == tok::objc_interface) in canBreakBefore()
2393 return !Right.is(tok::l_paren); in canBreakBefore()
2399 Right.is(tok::kw_operator)) in canBreakBefore()
2410 if (Left.is(tok::question) && Right.is(tok::colon)) in canBreakBefore()
2412 if (Right.is(TT_ConditionalExpr) || Right.is(tok::question)) in canBreakBefore()
2414 if (Left.is(TT_ConditionalExpr) || Left.is(tok::question)) in canBreakBefore()
2418 if (Right.is(tok::colon) && in canBreakBefore()
2421 if (Left.is(tok::colon) && (Left.isOneOf(TT_DictLiteral, TT_ObjCMethodExpr))) in canBreakBefore()
2423 if (Right.is(TT_SelectorName) || (Right.is(tok::identifier) && Right.Next && in canBreakBefore()
2425 return Left.isNot(tok::period); // FIXME: Properly parse ObjC calls. in canBreakBefore()
2426 if (Left.is(tok::r_paren) && Line.Type == LT_ObjCProperty) in canBreakBefore()
2438 Left.is(tok::kw_operator)) in canBreakBefore()
2440 if (Left.is(tok::equal) && !Right.isOneOf(tok::kw_default, tok::kw_delete) && in canBreakBefore()
2443 if (Left.is(tok::l_paren) && Left.is(TT_AttributeParen)) in canBreakBefore()
2445 if (Left.is(tok::l_paren) && Left.Previous && in canBreakBefore()
2451 if (Right.is(tok::r_paren) || Right.is(TT_TemplateCloser)) in canBreakBefore()
2453 if (Right.is(tok::r_square) && Right.MatchingParen && in canBreakBefore()
2459 if (Right.is(tok::r_brace)) in canBreakBefore()
2465 return !Right.isOneOf(tok::l_brace, tok::semi, tok::equal, tok::l_paren, in canBreakBefore()
2466 tok::less, tok::coloncolon); in canBreakBefore()
2468 if (Right.is(tok::kw___attribute)) in canBreakBefore()
2471 if (Left.is(tok::identifier) && Right.is(tok::string_literal)) in canBreakBefore()
2474 if (Right.is(tok::identifier) && Right.Next && Right.Next->is(TT_DictLiteral)) in canBreakBefore()
2483 if ((Left.is(tok::greater) && Right.is(tok::greater)) || in canBreakBefore()
2484 (Left.is(tok::less) && Right.is(tok::less))) in canBreakBefore()
2493 if (Right.is(tok::kw_typename) && Left.isNot(tok::kw_const)) in canBreakBefore()
2496 !Left.isOneOf(tok::arrowstar, tok::lessless) && in canBreakBefore()
2501 return Left.isOneOf(tok::comma, tok::coloncolon, tok::semi, tok::l_brace, in canBreakBefore()
2502 tok::kw_class, tok::kw_struct, tok::comment) || in canBreakBefore()
2504 Right.isOneOf(TT_TrailingReturnArrow, TT_LambdaArrow, tok::lessless, in canBreakBefore()
2505 tok::colon, tok::l_square, tok::at) || in canBreakBefore()
2506 (Left.is(tok::r_paren) && in canBreakBefore()
2507 Right.isOneOf(tok::identifier, tok::kw_const)) || in canBreakBefore()
2508 (Left.is(tok::l_paren) && !Right.is(tok::r_paren)); in canBreakBefore()