Lines Matching refs:Left
47 FormatToken *Left = CurrentToken->Previous;
48 Left->ParentBracket = Contexts.back().ContextKind;
59 Left->Previous && Left->Previous->Tok.isNot(tok::kw_template);
67 Left->MatchingParen = CurrentToken;
68 CurrentToken->MatchingParen = Left;
92 updateParameterCount(Left, CurrentToken);
102 FormatToken *Left = CurrentToken->Previous;
103 Left->ParentBracket = Contexts.back().ContextKind;
113 Left->Type = TT_ObjCBlockLParen;
114 } else if (FormatToken *MaybeSel = Left->Previous) {
122 if (Left->Previous &&
123 (Left->Previous->isOneOf(tok::kw_static_assert, tok::kw_decltype,
126 Left->Previous->is(TT_BinaryOperator))) {
129 } else if (Left->Previous && Left->Previous->is(tok::r_square) &&
130 Left->Previous->MatchingParen &&
131 Left->Previous->MatchingParen->is(TT_LambdaLSquare)) {
135 (!Left->Previous ||
136 !Left->Previous->isOneOf(tok::identifier,
142 } else if (Left->Previous && Left->Previous->is(tok::kw___attribute)) {
143 Left->Type = TT_AttributeParen;
144 } else if (Left->Previous && Left->Previous->is(TT_ForEachMacro)) {
148 } else if (Left->Previous && Left->Previous->MatchingParen &&
149 Left->Previous->MatchingParen->is(TT_ObjCBlockLParen)) {
155 Left->Type = TT_ObjCMethodExpr;
162 Left->Previous && Left->Previous->is(tok::kw_for);
193 Left->Type = TT_FunctionTypeLParen;
194 Left->MatchingParen = CurrentToken;
195 CurrentToken->MatchingParen = Left;
205 if (Left->is(TT_AttributeParen))
207 if (Left->Previous && Left->Previous->is(TT_JavaAnnotation))
209 if (Left->Previous && Left->Previous->is(TT_LeadingJavaAnnotation))
213 Left->PackingKind = PPK_Inconclusive;
215 Left->PackingKind = PPK_BinPacked;
217 Left->PackingKind = PPK_OnePerLine;
226 Left->Type = TT_Unknown; // Not TT_ObjCBlockLParen
246 updateParameterCount(Left, Tok);
260 FormatToken *Left = CurrentToken->Previous;
261 Left->ParentBracket = Contexts.back().ContextKind;
262 FormatToken *Parent = Left->getPreviousNonComment();
265 Contexts.back().CanBeExpression && Left->isNot(TT_LambdaLSquare) &&
276 if (Left->is(TT_Unknown)) {
278 Left->Type = TT_ObjCMethodExpr;
282 Left->Type = TT_JsComputedPropertyName;
287 Left->Type = TT_ArrayInitializerLSquare;
290 Left->Type = TT_ArraySubscriptLSquare;
301 Left->is(TT_ObjCMethodExpr)) {
305 Left->Type = TT_Unknown;
307 if (StartsObjCMethodExpr && CurrentToken->Previous != Left) {
315 Left->MatchingParen = CurrentToken;
316 CurrentToken->MatchingParen = Left;
320 if (Left->BlockParameterCount > 1)
329 if (Left->is(TT_ArraySubscriptLSquare)) {
330 Left->Type = TT_ObjCMethodExpr;
338 if (CurrentToken->is(tok::comma) && Left->is(TT_ObjCMethodExpr) &&
340 Left->Type = TT_ArrayInitializerLSquare;
344 updateParameterCount(Left, Tok);
351 FormatToken *Left = CurrentToken->Previous;
352 Left->ParentBracket = Contexts.back().ContextKind;
355 Left->Type = TT_ObjCBlockLBrace;
360 if (Left->BlockKind == BK_BracedInit)
365 Left->MatchingParen = CurrentToken;
366 CurrentToken->MatchingParen = Left;
372 updateParameterCount(Left, CurrentToken);
383 Left->Type = TT_DictLiteral;
392 void updateParameterCount(FormatToken *Left, FormatToken *Current) {
394 ++Left->BlockParameterCount;
396 ++Left->ParameterCount;
397 if (!Left->Role)
398 Left->Role.reset(new CommaSeparatedList(Style));
399 Left->Role->CommaFound(Current);
400 } else if (Left->ParameterCount == 0 && Current->isNot(tok::comment)) {
401 Left->ParameterCount = 1;
623 // We still want to format the whitespace left of the first token of the
1071 // If there is an opening parenthesis left of the current parentheses,
1701 const FormatToken &Left = *Tok.Previous;
1704 if (Left.is(tok::semi))
1712 if (Left.is(tok::comma) && Left.NestingLevel == 0)
1715 if (Right.is(Keywords.kw_function) && Left.isNot(tok::comma))
1717 if (Left.is(TT_JsTypeColon))
1721 if (Left.is(tok::comma) || (Right.is(tok::identifier) && Right.Next &&
1728 if (Right.is(TT_LambdaLSquare) && Left.is(tok::equal))
1739 if (Left.is(TT_StartOfName))
1749 if (Left.is(tok::equal) && Right.is(tok::l_brace))
1751 if (Left.is(TT_CastRParen))
1753 if (Left.is(tok::coloncolon) ||
1756 if (Left.isOneOf(tok::kw_class, tok::kw_struct))
1759 if (Left.isOneOf(TT_RangeBasedForLoopColon, TT_InheritanceColon))
1791 return (Left.is(tok::r_paren) ? 100 : 120) + (is_short_annotation ? 50 : 0);
1795 if (Line.startsWith(tok::kw_for) && Left.is(tok::equal))
1802 if (Left.is(tok::colon) && Left.is(TT_ObjCMethodExpr))
1805 if (Left.is(tok::l_paren) && InFunctionDecl &&
1808 if (Left.is(tok::l_paren) && Left.Previous &&
1809 Left.Previous->isOneOf(tok::kw_if, tok::kw_for))
1811 if (Left.is(tok::equal) && InFunctionDecl)
1815 if (Left.is(TT_TemplateOpener))
1817 if (Left.opensScope()) {
1820 return Left.ParameterCount > 1 ? Style.PenaltyBreakBeforeFirstCallParameter
1823 if (Left.is(TT_JavaAnnotation))
1827 if (Left.is(tok::string_literal) &&
1829 StringRef Content = Left.TokenText;
1841 if (Left.is(TT_ConditionalExpr))
1843 prec::Level Level = Left.getPrecedence();
1854 const FormatToken &Left,
1856 if (Left.is(tok::kw_return) && Right.isNot(tok::semi))
1859 Left.Tok.getObjCKeywordID() == tok::objc_property)
1862 return Left.is(tok::hash);
1863 if (Left.isOneOf(tok::hashhash, tok::hash))
1865 if (Left.is(tok::l_paren) && Right.is(tok::r_paren))
1867 if (Left.is(tok::l_paren) || Right.is(tok::r_paren))
1869 (Left.MatchingParen && Left.MatchingParen->is(TT_CastRParen)))
1875 (Left.is(tok::kw_template) ||
1878 if (Left.isOneOf(tok::exclaim, tok::tilde))
1880 if (Left.is(tok::at) &&
1885 if (Left.is(tok::coloncolon))
1887 if (Left.is(tok::less) || Right.isOneOf(tok::greater, tok::less))
1890 return Left.Tok.isLiteral();
1891 if (Left.is(tok::l_square) && Right.is(tok::amp))
1894 return (Left.is(tok::r_paren) && Left.MatchingParen &&
1895 (Left.MatchingParen->is(TT_OverloadedOperatorLParen) ||
1896 (Left.MatchingParen->Previous &&
1897 Left.MatchingParen->Previous->is(TT_FunctionDeclarationName)))) ||
1898 (Left.Tok.isLiteral() ||
1899 (!Left.isOneOf(TT_PointerOrReference, tok::l_paren) &&
1902 if (Right.is(TT_FunctionTypeLParen) && Left.isNot(tok::l_paren) &&
1903 (!Left.is(TT_PointerOrReference) ||
1907 if (Left.is(TT_PointerOrReference))
1916 Left.Previous &&
1917 !Left.Previous->isOneOf(tok::l_paren, tok::coloncolon));
1918 if (Right.is(tok::star) && Left.is(tok::l_paren))
1920 if (Left.is(tok::l_square))
1921 return (Left.is(TT_ArrayInitializerLSquare) &&
1923 (Left.is(TT_ArraySubscriptLSquare) && Style.SpacesInSquareBrackets &&
1933 !Left.isOneOf(tok::numeric_constant, TT_DictLiteral))
1935 if (Left.is(tok::colon))
1936 return !Left.is(TT_ObjCMethodExpr);
1937 if (Left.is(tok::l_brace) && Right.is(tok::r_brace))
1938 return !Left.Children.empty(); // No spaces in "{}".
1939 if ((Left.is(tok::l_brace) && Left.BlockKind != BK_Block) ||
1943 if (Left.is(TT_BlockComment))
1944 return !Left.TokenText.endswith("=*/");
1946 if (Left.is(tok::r_paren) && Left.is(TT_AttributeParen))
1948 return Line.Type == LT_ObjCDecl || Left.is(tok::semi) ||
1950 (Left.isOneOf(tok::kw_if, tok::pp_elif, tok::kw_for, tok::kw_while,
1953 (Left.isOneOf(tok::kw_try, Keywords.kw___except, tok::kw_catch,
1955 (!Left.Previous || Left.Previous->isNot(tok::period))))) ||
1957 (Left.is(tok::identifier) || Left.isFunctionLikeKeyword() ||
1958 Left.is(tok::r_paren)) &&
1961 if (Left.is(tok::at) && Right.Tok.getObjCKeywordID() != tok::objc_not_keyword)
1964 return !Left.isOneOf(tok::l_paren, tok::l_square, tok::at) &&
1965 (Left.isNot(tok::colon) || Left.isNot(TT_ObjCMethodExpr));
1966 if ((Left.isOneOf(tok::identifier, tok::greater, tok::r_square,
1968 Left.isSimpleTypeSpecifier()) &&
1972 if (Left.is(tok::period) || Right.is(tok::period))
1974 if (Right.is(tok::hash) && Left.is(tok::identifier) && Left.TokenText == "L")
1976 if (Left.is(TT_TemplateCloser) && Left.MatchingParen &&
1977 Left.MatchingParen->Previous &&
1978 Left.MatchingParen->Previous->is(tok::period))
1981 if (Left.is(TT_TemplateCloser) && Right.is(tok::l_square))
1988 const FormatToken &Left = *Right.Previous;
1989 if (Right.Tok.getIdentifierInfo() && Left.Tok.getIdentifierInfo())
1992 if (Left.is(tok::kw_operator))
1996 Left.isOneOf(Keywords.kw_optional, Keywords.kw_required,
2000 Left.isOneOf(Keywords.kw_returns, Keywords.kw_option))
2003 if (Left.isOneOf(Keywords.kw_let, Keywords.kw_var, TT_JsFatArrow,
2008 if ((Left.is(tok::l_brace) || Right.is(tok::r_brace)) &&
2011 if (Left.is(tok::ellipsis))
2013 if (Left.is(TT_TemplateCloser) &&
2021 if (Left.is(tok::r_square) && Right.is(tok::l_brace))
2023 if (Left.is(Keywords.kw_synchronized) && Right.is(tok::l_paren))
2025 if ((Left.isOneOf(tok::kw_static, tok::kw_public, tok::kw_private,
2027 Left.isOneOf(Keywords.kw_final, Keywords.kw_abstract,
2032 if (Left.is(TT_ImplicitStringLiteral))
2035 if (Left.is(TT_ObjCMethodSpecifier))
2037 if (Left.is(tok::r_paren) && Right.is(tok::identifier))
2042 (Right.is(tok::equal) || Left.is(tok::equal)))
2046 Left.isOneOf(TT_TrailingReturnArrow, TT_LambdaArrow))
2048 if (Left.is(tok::comma))
2062 if (Left.is(tok::question))
2064 if (Right.is(TT_InlineASMColon) && Left.is(tok::coloncolon))
2070 if (Left.is(TT_UnaryOperator))
2075 if (Left.is(TT_CastRParen))
2079 if (Left.is(tok::greater) && Right.is(tok::greater))
2080 return Right.is(TT_TemplateCloser) && Left.is(TT_TemplateCloser) &&
2083 Left.isOneOf(tok::arrow, tok::period, tok::arrowstar, tok::periodstar))
2088 if (Right.is(tok::coloncolon) && Left.isNot(tok::l_brace))
2089 return (Left.is(TT_TemplateOpener) &&
2091 !(Left.isOneOf(tok::identifier, tok::l_paren, tok::r_paren) ||
2092 Left.isOneOf(TT_TemplateCloser, TT_TemplateOpener));
2093 if ((Left.is(TT_TemplateOpener)) != (Right.is(TT_TemplateCloser)))
2095 if ((Right.is(TT_BinaryOperator) && !Left.is(tok::l_paren)) ||
2096 (Left.isOneOf(TT_BinaryOperator, TT_ConditionalExpr) &&
2099 if (Left.is(TT_TemplateCloser) && Right.is(tok::l_paren) &&
2102 if (Right.is(TT_TemplateOpener) && Left.is(tok::r_paren) &&
2103 Left.MatchingParen && Left.MatchingParen->is(TT_OverloadedOperatorLParen))
2105 if (Right.is(tok::less) && Left.isNot(tok::l_paren) &&
2110 if (Left.is(TT_RegexLiteral))
2112 return spaceRequiredBetween(Line, Left, Right);
2123 const FormatToken &Left = *Right.Previous;
2129 if (Right.is(tok::char_constant) && Left.is(tok::plus) && Left.Previous &&
2130 Left.Previous->is(tok::char_constant))
2132 if (Left.is(TT_DictLiteral) && Left.is(tok::l_brace) && Line.Level == 0 &&
2133 Left.Previous && Left.Previous->is(tok::equal) &&
2142 if (Left.is(tok::l_brace) && Line.Level == 0 &&
2148 if (Right.is(tok::r_brace) && Left.is(tok::l_brace) &&
2149 !Left.Children.empty())
2153 (Left.NestingLevel == 0 && Line.Level == 0 &&
2157 if (Right.is(tok::plus) && Left.is(tok::string_literal) && Right.Next &&
2166 if (Left.isOneOf(tok::l_brace, TT_ArrayInitializerLSquare) &&
2167 Left.BlockKind != BK_Block && Left.MatchingParen)
2168 BeforeClosingBrace = Left.MatchingParen->Previous;
2172 BeforeClosingBrace = &Left;
2178 return Left.BlockKind != BK_BracedInit &&
2179 Left.isNot(TT_CtorInitializerColon) &&
2181 if (Left.isTrailingComment())
2183 if (Left.isStringLiteral() &&
2212 if (isAllmanBrace(Left) || isAllmanBrace(Right))
2216 if (Style.Language == FormatStyle::LK_Proto && Left.isNot(tok::l_brace) &&
2219 if (Left.is(TT_ObjCBlockLBrace) && !Style.AllowShortBlocksOnASingleLine)
2224 Left.is(TT_LeadingJavaAnnotation) &&
2234 const FormatToken &Left = *Right.Previous;
2238 if (Left.isOneOf(Keywords.kw_throws, Keywords.kw_extends,
2245 if (Left.is(TT_JsFatArrow) && Right.is(tok::l_brace))
2247 if (Left.is(TT_JsTypeColon))
2251 if (Left.is(tok::at))
2253 if (Left.Tok.getObjCKeywordID() == tok::objc_interface)
2255 if (Left.isOneOf(TT_JavaAnnotation, TT_LeadingJavaAnnotation))
2264 if (Left.is(TT_PointerOrReference))
2272 return Left.BlockKind == BK_BracedInit;
2273 if (Left.is(tok::question) && Right.is(tok::colon))
2277 if (Left.is(TT_ConditionalExpr) || Left.is(tok::question))
2284 if (Left.is(tok::colon) && (Left.isOneOf(TT_DictLiteral, TT_ObjCMethodExpr)))
2288 return Left.isNot(tok::period); // FIXME: Properly parse ObjC calls.
2289 if (Left.is(tok::r_paren) && Line.Type == LT_ObjCProperty)
2291 if (Left.ClosesTemplateDeclaration || Left.is(TT_FunctionAnnotationRParen))
2296 if (Left.is(TT_RangeBasedForLoopColon))
2300 if (Left.isOneOf(TT_TemplateCloser, TT_UnaryOperator) ||
2301 Left.is(tok::kw_operator))
2303 if (Left.is(tok::equal) && !Right.isOneOf(tok::kw_default, tok::kw_delete) &&
2304 Line.Type == LT_VirtualFunctionDecl && Left.NestingLevel == 0)
2306 if (Left.is(tok::l_paren) && Left.is(TT_AttributeParen))
2308 if (Left.is(tok::l_paren) && Left.Previous &&
2309 (Left.Previous->isOneOf(TT_BinaryOperator, TT_CastRParen)))
2327 if (Left.is(TT_TrailingAnnotation))
2334 if (Left.is(tok::identifier) && Right.is(tok::string_literal))
2340 if (Left.is(TT_CtorInitializerComma) &&
2346 if ((Left.is(tok::greater) && Right.is(tok::greater)) ||
2347 (Left.is(tok::less) && Right.is(tok::less)))
2354 if (Left.is(TT_ArrayInitializerLSquare))
2356 if (Right.is(tok::kw_typename) && Left.isNot(tok::kw_const))
2358 if ((Left.isBinaryOperator() || Left.is(TT_BinaryOperator)) &&
2359 !Left.isOneOf(tok::arrowstar, tok::lessless) &&
2362 Left.getPrecedence() == prec::Assignment))
2364 return Left.isOneOf(tok::comma, tok::coloncolon, tok::semi, tok::l_brace,
2369 (Left.is(tok::r_paren) &&
2371 (Left.is(tok::l_paren) && !Right.is(tok::r_paren));