Home | History | Annotate | Download | only in Format

Lines Matching refs:Left

60     FormatToken *Left = CurrentToken->Previous;
61 Left->ParentBracket = Contexts.back().ContextKind;
72 Left->Previous && Left->Previous->Tok.isNot(tok::kw_template);
80 Left->MatchingParen = CurrentToken;
81 CurrentToken->MatchingParen = Left;
105 updateParameterCount(Left, CurrentToken);
115 FormatToken *Left = CurrentToken->Previous;
116 Left->ParentBracket = Contexts.back().ContextKind;
126 Left->Type = TT_ObjCBlockLParen;
127 } else if (FormatToken *MaybeSel = Left->Previous) {
135 if (Left->is(TT_OverloadedOperatorLParen)) {
141 } else if (Left->Previous &&
142 (Left->Previous->isOneOf(tok::kw_static_assert, tok::kw_decltype,
145 Left->Previous->is(TT_BinaryOperator))) {
148 } else if (Style.Language == FormatStyle::LK_JavaScript && Left->Previous &&
149 (Left->Previous->is(Keywords.kw_function) ||
150 (Left->Previous->endsSequence(tok::identifier,
154 } else if (Style.Language == FormatStyle::LK_JavaScript && Left->Previous &&
155 Left->Previous->is(TT_JsTypeColon)) {
158 } else if (Left->Previous && Left->Previous->is(tok::r_square) &&
159 Left->Previous->MatchingParen &&
160 Left->Previous->MatchingParen->is(TT_LambdaLSquare)) {
164 (!Left->Previous || !Left->Previous->is(tok::identifier))) {
169 } else if (Left->Previous && Left->Previous->is(tok::kw___attribute)) {
170 Left->Type = TT_AttributeParen;
171 } else if (Left->Previous && Left->Previous->is(TT_ForEachMacro)) {
175 } else if (Left->Previous && Left->Previous->MatchingParen &&
176 Left->Previous->MatchingParen->is(TT_ObjCBlockLParen)) {
180 Left->Previous && Left->Previous->isOneOf(tok::kw_for, tok::kw_catch);
186 Left->Type = TT_ObjCMethodExpr;
194 Left->Previous && Left->Previous->is(tok::kw_for);
226 Left->Type = TT_FunctionTypeLParen;
227 Left->MatchingParen = CurrentToken;
228 CurrentToken->MatchingParen = Left;
231 Left->Previous && Left->Previous->is(tok::l_paren)) {
235 for (FormatToken *Tok = Left; Tok != CurrentToken; Tok = Tok->Next) {
250 if (Left->is(TT_AttributeParen))
252 if (Left->Previous && Left->Previous->is(TT_JavaAnnotation))
254 if (Left->Previous && Left->Previous->is(TT_LeadingJavaAnnotation))
258 Left->PackingKind = PPK_Inconclusive;
260 Left->PackingKind = PPK_BinPacked;
262 Left->PackingKind = PPK_OnePerLine;
271 Left->Type = TT_Unknown; // Not TT_ObjCBlockLParen
291 updateParameterCount(Left, Tok);
305 FormatToken *Left = CurrentToken->Previous;
306 Left->ParentBracket = Contexts.back().ContextKind;
307 FormatToken *Parent = Left->getPreviousNonComment();
310 Contexts.back().CanBeExpression && Left->isNot(TT_LambdaLSquare) &&
321 if (Left->is(TT_Unknown)) {
323 Left->Type = TT_ObjCMethodExpr;
327 Left->Type = TT_JsComputedPropertyName;
335 Left->Type = TT_ArrayInitializerLSquare;
338 Left->Type = TT_ArraySubscriptLSquare;
349 Left->is(TT_ObjCMethodExpr)) {
353 Left->Type = TT_Unknown;
355 if (StartsObjCMethodExpr && CurrentToken->Previous != Left) {
363 Left->MatchingParen = CurrentToken;
364 CurrentToken->MatchingParen = Left;
368 if (Left->BlockParameterCount > 1)
377 if (Left->is(TT_ArraySubscriptLSquare)) {
378 Left->Type = TT_ObjCMethodExpr;
386 Left->is(TT_ObjCMethodExpr) &&
388 Left->Type = TT_ArrayInitializerLSquare;
392 updateParameterCount(Left, Tok);
399 FormatToken *Left = CurrentToken->Previous;
400 Left->ParentBracket = Contexts.back().ContextKind;
403 Left->Type = TT_ObjCBlockLBrace;
408 if (Left->BlockKind == BK_BracedInit)
413 Left->MatchingParen = CurrentToken;
414 CurrentToken->MatchingParen = Left;
420 updateParameterCount(Left, CurrentToken);
432 Left->Type = TT_DictLiteral;
441 void updateParameterCount(FormatToken *Left, FormatToken *Current) {
443 ++Left->BlockParameterCount;
445 ++Left->ParameterCount;
446 if (!Left->Role)
447 Left->Role.reset(new CommaSeparatedList(Style));
448 Left->Role->CommaFound(Current);
449 } else if (Left->ParameterCount == 0 && Current->isNot(tok::comment)) {
450 Left->ParameterCount = 1;
680 // We still want to format the whitespace left of the first token of the
1156 // If there is a closing parenthesis left of the current parentheses,
1801 const FormatToken &Left = *Tok.Previous;
1804 if (Left.is(tok::semi))
1812 if (Left.is(tok::comma) && Left.NestingLevel == 0)
1815 if (Right.is(Keywords.kw_function) && Left.isNot(tok::comma))
1817 if (Left.is(TT_JsTypeColon))
1821 if (Left.is(tok::comma) || (Right.is(tok::identifier) && Right.Next &&
1827 if (Left.is(tok::r_square))
1830 if (Right.is(TT_LambdaLSquare) && Left.is(tok::equal))
1841 if (Left.is(TT_StartOfName))
1851 if (Left.is(tok::equal) && Right.is(tok::l_brace))
1853 if (Left.is(TT_CastRParen))
1855 if (Left.is(tok::coloncolon) ||
1858 if (Left.isOneOf(tok::kw_class, tok::kw_struct))
1860 if (Left.is(tok::comment))
1863 if (Left.isOneOf(TT_RangeBasedForLoopColon, TT_InheritanceColon))
1903 return (Left.is(tok::r_paren) ? 100 : 120) + (is_short_annotation ? 50 : 0);
1907 if (Line.startsWith(tok::kw_for) && Left.is(tok::equal))
1914 if (Left.is(tok::colon) && Left.is(TT_ObjCMethodExpr))
1917 if (Left.is(tok::l_paren) && InFunctionDecl &&
1920 if (Left.is(tok::l_paren) && Left.Previous &&
1921 Left.Previous->isOneOf(tok::kw_if, tok::kw_for))
1923 if (Left.is(tok::equal) && InFunctionDecl)
1927 if (Left.is(TT_TemplateOpener))
1929 if (Left.opensScope()) {
1932 return Left.ParameterCount > 1 ? Style.PenaltyBreakBeforeFirstCallParameter
1935 if (Left.is(TT_JavaAnnotation))
1939 if (Left.is(tok::string_literal) &&
1941 StringRef Content = Left.TokenText;
1953 if (Left.is(TT_ConditionalExpr))
1955 prec::Level Level = Left.getPrecedence();
1966 const FormatToken &Left,
1968 if (Left.is(tok::kw_return) && Right.isNot(tok::semi))
1971 Left.Tok.getObjCKeywordID() == tok::objc_property)
1974 return Left.is(tok::hash);
1975 if (Left.isOneOf(tok::hashhash, tok::hash))
1977 if (Left.is(tok::l_paren) && Right.is(tok::r_paren))
1979 if (Left.is(tok::l_paren) || Right.is(tok::r_paren))
1981 (Left.MatchingParen && Left.MatchingParen->is(TT_CastRParen)))
1987 (Left.is(tok::kw_template) ||
1990 if (Left.isOneOf(tok::exclaim, tok::tilde))
1992 if (Left.is(tok::at) &&
1997 if (Left.is(tok::colon))
1998 return !Left.is(TT_ObjCMethodExpr);
1999 if (Left.is(tok::coloncolon))
2001 if (Left.is(tok::less) || Right.isOneOf(tok::greater, tok::less))
2004 return Left.Tok.isLiteral() || (Left.is(tok::identifier) && Left.Previous &&
2005 Left.Previous->is(tok::kw_case));
2006 if (Left.is(tok::l_square) && Right.is(tok::amp))
2009 return (Left.is(tok::r_paren) && Line.MightBeFunctionDecl) ||
2010 (Left.Tok.isLiteral() || (Left.is(tok::kw_const) && Left.Previous &&
2011 Left.Previous->is(tok::r_paren)) ||
2012 (!Left.isOneOf(TT_PointerOrReference, tok::l_paren) &&
2015 if (Right.is(TT_FunctionTypeLParen) && Left.isNot(tok::l_paren) &&
2016 (!Left.is(TT_PointerOrReference) ||
2020 if (Left.is(TT_PointerOrReference))
2029 Left.Previous &&
2030 !Left.Previous->isOneOf(tok::l_paren, tok::coloncolon));
2031 if (Right.is(tok::star) && Left.is(tok::l_paren))
2033 if (Left.is(tok::l_square))
2034 return (Left.is(TT_ArrayInitializerLSquare) &&
2036 (Left.is(TT_ArraySubscriptLSquare) && Style.SpacesInSquareBrackets &&
2046 !Left.isOneOf(tok::numeric_constant, TT_DictLiteral))
2048 if (Left.is(tok::l_brace) && Right.is(tok::r_brace))
2049 return !Left.Children.empty(); // No spaces in "{}".
2050 if ((Left.is(tok::l_brace) && Left.BlockKind != BK_Block) ||
2054 if (Left.is(TT_BlockComment))
2055 return !Left.TokenText.endswith("=*/");
2057 if (Left.is(tok::r_paren) && Left.is(TT_AttributeParen))
2059 return Line.Type == LT_ObjCDecl || Left.is(tok::semi) ||
2061 (Left.isOneOf(tok::kw_if, tok::pp_elif, tok::kw_for, tok::kw_while,
2064 (Left.isOneOf(tok::kw_try, Keywords.kw___except, tok::kw_catch,
2066 (!Left.Previous || Left.Previous->isNot(tok::period))))) ||
2068 (Left.is(tok::identifier) || Left.isFunctionLikeKeyword() ||
2069 Left.is(tok::r_paren)) &&
2072 if (Left.is(tok::at) && Right.Tok.getObjCKeywordID() != tok::objc_not_keyword)
2075 return !Left.isOneOf(tok::l_paren, tok::l_square, tok::at) &&
2076 (Left.isNot(tok::colon) || Left.isNot(TT_ObjCMethodExpr));
2077 if ((Left.isOneOf(tok::identifier, tok::greater, tok::r_square,
2079 Left.isSimpleTypeSpecifier()) &&
2083 if (Left.is(tok::period) || Right.is(tok::period))
2085 if (Right.is(tok::hash) && Left.is(tok::identifier) && Left.TokenText == "L")
2087 if (Left.is(TT_TemplateCloser) && Left.MatchingParen &&
2088 Left.MatchingParen->Previous &&
2089 Left.MatchingParen->Previous->is(tok::period))
2092 if (Left.is(TT_TemplateCloser) && Right.is(tok::l_square))
2099 const FormatToken &Left = *Right.Previous;
2100 if (Right.Tok.getIdentifierInfo() && Left.Tok.getIdentifierInfo())
2103 if (Left
2107 Left.isOneOf(Keywords.kw_optional, Keywords.kw_required,
2111 Left.isOneOf(Keywords.kw_returns, Keywords.kw_option))
2114 if (Left.is(TT_JsFatArrow))
2117 Left.isOneOf(Keywords.kw_function, Keywords.kw_yield))
2119 if (Left.isOneOf(Keywords.kw_let, Keywords.kw_var, Keywords.kw_in,
2121 (!Left.Previous || !Left.Previous->is(tok::period)))
2123 if (Left.is(tok::kw_default) && Left.Previous &&
2124 Left.Previous->is(tok::kw_export))
2126 if (Left.is(Keywords.kw_is) && Right.is(tok::l_brace))
2130 if (Left.is(TT_JsTypeOperator) || Right.is(TT_JsTypeOperator))
2132 if ((Left.is(tok::l_brace) || Right.is(tok::r_brace)) &&
2135 if (Left.is(tok::ellipsis))
2137 if (Left.is(TT_TemplateCloser) &&
2145 if (Right.is(tok::exclaim) && (Left.isOneOf(tok::identifier, tok::r_paren,
2147 Left.Tok.isLiteral()))
2150 if (Left.is(tok::r_square) && Right.is(tok::l_brace))
2152 if (Left.is(Keywords.kw_synchronized) && Right.is(tok::l_paren))
2154 if ((Left.isOneOf(tok::kw_static, tok::kw_public, tok::kw_private,
2156 Left.isOneOf(Keywords.kw_final, Keywords.kw_abstract,
2161 if (Left.is(TT_ImplicitStringLiteral))
2164 if (Left.is(TT_ObjCMethodSpecifier))
2166 if (Left.is(tok::r_paren) && Right.is(tok::identifier))
2171 (Right.is(tok::equal) || Left.is(tok::equal)))
2175 Left.isOneOf(TT_TrailingReturnArrow, TT_LambdaArrow))
2179 if (Left.is(tok::comma))
2191 if (Left.is(tok::question))
2193 if (Right.is(TT_InlineASMColon) && Left.is(tok::coloncolon))
2199 if (Left.is(TT_UnaryOperator))
2204 if (Left.is(TT_CastRParen))
2208 if (Left.is(tok::greater) && Right.is(tok::greater))
2209 return Right.is(TT_TemplateCloser) && Left.is(TT_TemplateCloser) &&
2212 Left.isOneOf(tok::arrow, tok::period, tok::arrowstar, tok::periodstar))
2217 if (Right.is(tok::coloncolon) && !Left.isOneOf(tok::l_brace, tok::comment))
2218 return (Left.is(TT_TemplateOpener) &&
2220 !(Left.isOneOf(tok::identifier, tok::l_paren, tok::r_paren,
2222 Left.isOneOf(TT_TemplateCloser, TT_TemplateOpener));
2223 if ((Left.is(TT_TemplateOpener)) != (Right.is(TT_TemplateCloser)))
2225 if ((Right.is(TT_BinaryOperator) && !Left.is(tok::l_paren)) ||
2226 (Left.isOneOf(TT_BinaryOperator, TT_ConditionalExpr) &&
2229 if (Left.is(TT_TemplateCloser) && Right.is(tok::l_paren) &&
2232 if (Right.is(TT_TemplateOpener) && Left.is(tok::r_paren) &&
2233 Left.MatchingParen && Left.MatchingParen->is(TT_OverloadedOperatorLParen))
2235 if (Right.is(tok::less) && Left.isNot(tok::l_paren) &&
2240 if (Left.is(TT_RegexLiteral))
2242 return spaceRequiredBetween(Line, Left, Right);
2253 const FormatToken &Left = *Right.Previous;
2259 if (Right.is(tok::string_literal) && Left.is(tok::plus) && Left.Previous &&
2260 Left.Previous->is(tok::string_literal))
2262 if (Left.is(TT_DictLiteral) && Left.is(tok::l_brace) && Line.Level == 0 &&
2263 Left.Previous && Left.Previous->is(tok::equal) &&
2272 if (Left.is(tok::l_brace) && Line.Level == 0 &&
2278 if (Right.is(tok::r_brace) && Left.is(tok::l_brace) &&
2279 !Left.Children.empty())
2283 (Left.NestingLevel == 0 && Line.Level == 0 &&
2287 if (Right.is(tok::plus) && Left.is(tok::string_literal) && Right.Next &&
2296 if (Left.isOneOf(tok::l_brace, TT_ArrayInitializerLSquare) &&
2297 Left.BlockKind != BK_Block && Left.MatchingParen)
2298 BeforeClosingBrace = Left.MatchingParen->Previous;
2302 BeforeClosingBrace = &Left;
2308 return Left.BlockKind != BK_BracedInit &&
2309 Left.isNot(TT_CtorInitializerColon) &&
2311 if (Left.isTrailingComment())
2313 if (Left.isStringLiteral() &&
2342 if (isAllmanBrace(Left) || isAllmanBrace(Right))
2346 if (Left.is(TT_ObjCBlockLBrace) && !Style.AllowShortBlocksOnASingleLine)
2351 Left.is(TT_LeadingJavaAnnotation) &&
2361 const FormatToken &Left = *Right.Previous;
2365 if (Left.isOneOf(Keywords.kw_throws, Keywords.kw_extends,
2372 if (Left.is(tok::kw_return))
2374 if (Left.is(TT_JsFatArrow) && Right.is(tok::l_brace))
2376 if (Left.is(TT_JsTypeColon))
2380 if (Left.is(Keywords.kw_in))
2388 if (Left.is(tok::at))
2390 if (Left.Tok.getObjCKeywordID() == tok::objc_interface)
2392 if (Left.isOneOf(TT_JavaAnnotation, TT_LeadingJavaAnnotation))
2401 if (Left.is(TT_PointerOrReference))
2409 return Left.BlockKind == BK_BracedInit;
2410 if (Left.is(tok::question) && Right.is(tok::colon))
2414 if (Left.is(TT_ConditionalExpr) || Left.is(tok::question))
2421 if (Left.is(tok::colon) && (Left.isOneOf(TT_DictLiteral, TT_ObjCMethodExpr)))
2425 return Left.isNot(tok::period); // FIXME: Properly parse ObjC calls.
2426 if (Left.is(tok::r_paren) && Line.Type == LT_ObjCProperty)
2428 if (Left.ClosesTemplateDeclaration || Left.is(TT_FunctionAnnotationRParen))
2433 if (Left.is(TT_RangeBasedForLoopColon))
2437 if (Left.isOneOf(TT_TemplateCloser, TT_UnaryOperator) ||
2438 Left.is(tok::kw_operator))
2440 if (Left.is(tok::equal) && !Right.isOneOf(tok::kw_default, tok::kw_delete) &&
2441 Line.Type == LT_VirtualFunctionDecl && Left.NestingLevel == 0)
2443 if (Left.is(tok::l_paren) && Left.is(TT_AttributeParen))
2445 if (Left.is(tok::l_paren) && Left.Previous &&
2446 (Left.Previous->isOneOf(TT_BinaryOperator, TT_CastRParen)))
2464 if (Left.is(TT_TrailingAnnotation))
2471 if (Left.is(tok::identifier) && Right.is(tok::string_literal))
2477 if (Left.is(TT_CtorInitializerComma) &&
2483 if ((Left.is(tok::greater) && Right.is(tok::greater)) ||
2484 (Left.is(tok::less) && Right.is(tok::less)))
2491 if (Left.is(TT_ArrayInitializerLSquare))
2493 if (Right.is(tok::kw_typename) && Left.isNot(tok::kw_const))
2495 if ((Left.isBinaryOperator() || Left.is(TT_BinaryOperator)) &&
2496 !Left.isOneOf(tok::arrowstar, tok::lessless) &&
2499 Left.getPrecedence() == prec::Assignment))
2501 return Left.isOneOf(tok::comma, tok::coloncolon, tok::semi, tok::l_brace,
2506 (Left.is(tok::r_paren) &&
2508 (Left.is(tok::l_paren) && !Right.is(tok::r_paren));