Lines Matching refs:tok

36     Contexts.push_back(Context(tok::unknown, 1, /*IsExpression=*/false));
43 ScopedContextCreator ContextCreator(*this, tok::less, 10);
47 if (CurrentToken->is(tok::greater)) {
54 if (CurrentToken->isOneOf(tok::r_paren, tok::r_square, tok::r_brace,
55 tok::question, tok::colon))
63 if (CurrentToken->Previous->isOneOf(tok::pipepipe, tok::ampamp) &&
66 Line.First->isNot(tok::kw_template))
78 ScopedContextCreator ContextCreator(*this, tok::l_paren, 1);
86 if (CurrentToken->is(tok::caret)) {
91 if (MaybeSel->isObjCAtKeyword(tok::objc_selector) && MaybeSel->Previous &&
92 MaybeSel->Previous->is(tok::at)) {
97 if (Left->Previous && Left->Previous->isOneOf(tok::kw_static_assert,
98 tok::kw_if, tok::kw_while)) {
101 } else if (Left->Previous && Left->Previous->is(tok::r_square) &&
113 bool MightBeFunctionType = CurrentToken->is(tok::star);
126 if (PrevPrev && PrevPrev->is(tok::identifier) &&
127 Prev->isOneOf(tok::star, tok::amp, tok::ampamp) &&
128 CurrentToken->is(tok::identifier) && Next->isNot(tok::equal)) {
136 CurrentToken->Previous->Previous->isOneOf(tok::l_paren,
137 tok::coloncolon))
139 if (CurrentToken->is(tok::r_paren)) {
141 (CurrentToken->Next->is(tok::l_paren) ||
142 (CurrentToken->Next->is(tok::l_square) &&
166 if (CurrentToken->isOneOf(tok::r_square, tok::r_brace))
169 if (CurrentToken->is(tok::comma) && CurrentToken->Next &&
192 (!Parent || Parent->isOneOf(tok::colon, tok::l_square, tok::l_paren,
193 tok::kw_return, tok::kw_throw) ||
197 ScopedContextCreator ContextCreator(*this, tok::l_square, 10);
204 } else if (Parent && Parent->is(tok::at)) {
211 if (CurrentToken->is(tok::r_square)) {
212 if (CurrentToken->Next && CurrentToken->Next->is(tok::l_paren) &&
235 if (CurrentToken->isOneOf(tok::r_paren, tok::r_brace))
237 if (CurrentToken->is(tok::colon))
239 if (CurrentToken->is(tok::comma) &&
253 ScopedContextCreator ContextCreator(*this, tok::l_brace, 1);
257 if (CurrentToken->is(tok::r_brace)) {
263 if (CurrentToken->isOneOf(tok::r_paren, tok::r_square))
266 if (CurrentToken->is(tok::colon))
278 if (Current->is(tok::comma)) {
283 } else if (Left->ParameterCount == 0 && Current->isNot(tok::comment)) {
290 if (CurrentToken->is(tok::colon)) {
302 if (CurrentToken != NULL && CurrentToken->is(tok::less)) {
318 case tok::plus:
319 case tok::minus:
323 case tok::colon:
327 if (Tok->Previous->is(tok::r_paren) && Contexts.size() == 1) {
344 CurrentToken->is(tok::numeric_constant)) {
346 } else if (Contexts.size() == 1 && Line.First->isNot(tok::kw_enum)) {
348 } else if (Contexts.back().ContextKind == tok::l_paren) {
352 case tok::kw_if:
353 case tok::kw_while:
354 if (CurrentToken != NULL && CurrentToken->is(tok::l_paren)) {
360 case tok::kw_for:
366 case tok::l_paren:
373 case tok::l_square:
377 case tok::l_brace:
381 case tok::less:
390 case tok::r_paren:
391 case tok::r_square:
393 case tok::r_brace:
398 case tok::greater:
401 case tok::kw_operator:
403 !CurrentToken->isOneOf(tok::l_paren, tok::semi, tok::r_paren)) {
404 if (CurrentToken->isOneOf(tok::star, tok::amp))
416 case tok::question:
419 case tok::kw_template:
422 case tok::identifier:
423 if (Line.First->is(tok::kw_for) &&
427 case tok::comma:
441 if (CurrentToken != NULL && CurrentToken->is(tok::less)) {
444 if (CurrentToken->isNot(tok::comment) || CurrentToken->Next)
450 if (CurrentToken->is(tok::string_literal))
474 if (CurrentToken->Tok.is(tok::numeric_constant)) {
483 case tok::pp_include:
484 case tok::pp_import:
487 case tok::pp_error:
488 case tok::pp_warning:
491 case tok::pp_if:
492 case tok::pp_elif:
504 if (CurrentToken->is(tok::hash)) {
509 if (CurrentToken->is(tok::kw_virtual))
553 Context(tok::TokenKind ContextKind, unsigned BindingStrength,
562 tok::TokenKind ContextKind;
580 ScopedContextCreator(AnnotatingParser &P, tok::TokenKind ContextKind,
593 !Line.First->isOneOf(tok::kw_template, tok::kw_using) &&
594 (!Current.Previous || Current.Previous->isNot(tok::kw_operator))) {
597 Previous && !Previous->isOneOf(tok::comma, tok::semi);
599 if (Previous->is(tok::r_square))
602 Previous->isOneOf(tok::star, tok::amp)) {
606 } else if (Current.isOneOf(tok::kw_return, tok::kw_throw) ||
607 (Current.is(tok::l_paren) && !Line.MustBeDeclaration &&
610 !Current.Previous->isOneOf(tok::kw_for, tok::kw_catch)))) {
612 } else if (Current.isOneOf(tok::r_paren, tok::greater, tok::comma)) {
614 Previous && Previous->isOneOf(tok::star, tok::amp);
621 } else if (Current.is(tok::kw_new)) {
623 } else if (Current.is(tok::semi) || Current.is(tok::exclaim)) {
635 } else if (Current.is(tok::kw_auto)) {
637 } else if (Current.is(tok::arrow) && AutoFound &&
640 } else if (Current.isOneOf(tok::star, tok::amp, tok::ampamp)) {
644 } else if (Current.isOneOf(tok::minus, tok::plus, tok::caret)) {
646 } else if (Current.isOneOf(tok::minusminus, tok::plusplus)) {
648 } else if (Current.is(tok::exclaim)) {
652 Current.Previous->isNot(tok::l_square))) {
654 } else if (Current.is(tok::comment)) {
659 } else if (Current.is(tok::r_paren)) {
671 Current.Next->isOneOf(tok::equal, tok::semi, tok::l_brace);
674 LeftOfParens->isOneOf(tok::kw_sizeof, tok::kw_alignof);
679 if (Current.Next && Current.Next->isNot(tok::string_literal) &&
681 Current.Next->isOneOf(tok::kw_sizeof, tok::kw_alignof)))
686 LeftOfParens->is(tok::kw_return)) &&
689 Current.Next->is(tok::identifier))
693 } else if (Current.is(tok::at) && Current.Next) {
695 case tok::objc_interface:
696 case tok::objc_implementation:
697 case tok::objc_protocol:
700 case tok::objc_property:
706 } else if (Current.is(tok::period)) {
709 PreviousNoComment->isOneOf(tok::comma, tok::l_brace))
721 if (Tok.isNot(tok::identifier) || Tok.Previous == NULL)
726 while (PreviousNotConst != NULL && PreviousNotConst->is(tok::kw_const))
732 bool IsPPKeyword = PreviousNotConst->is(tok::identifier) &&
734 PreviousNotConst->Previous->is(tok::hash);
739 PreviousNotConst->MatchingParen->Previous->isNot(tok::kw_template);
741 return (!IsPPKeyword && PreviousNotConst->is(tok::identifier)) ||
756 if (PrevToken->is(tok::coloncolon) ||
757 (PrevToken->is(tok::l_paren) && !IsExpression))
760 if (PrevToken->isOneOf(tok::l_paren, tok::l_square, tok::l_brace,
761 tok::comma, tok::semi, tok::kw_return, tok::colon,
762 tok::equal, tok::kw_delete, tok::kw_sizeof) ||
767 if (NextToken->is(tok::l_square))
770 if (PrevToken->is(tok::r_paren) && PrevToken->MatchingParen &&
772 PrevToken->MatchingParen->Previous->is(tok::kw_typeof))
776 PrevToken->isOneOf(tok::r_paren, tok::r_square) ||
794 if (PrevToken->isOneOf(tok::equal, tok::l_paren, tok::comma, tok::l_square,
795 tok::question, tok::colon, tok::kw_return,
796 tok::kw_case, tok::at, tok::l_brace))
812 if (PrevToken->isOneOf(tok::r_paren, tok::r_square, tok::identifier))
823 case tok::kw_short:
824 case tok::kw_long:
825 case tok::kw___int64:
826 case tok::kw___int128:
827 case tok::kw_signed:
828 case tok::kw_unsigned:
829 case tok::kw_void:
830 case tok::kw_char:
831 case tok::kw_int:
832 case tok::kw_half:
833 case tok::kw_float:
834 case tok::kw_double:
835 case tok::kw_wchar_t:
836 case tok::kw_bool:
837 case tok::kw___underlying_type:
838 case tok::annot_typename:
839 case tok::kw_char16_t:
840 case tok::kw_char32_t:
841 case tok::kw_typeof:
842 case tok::kw_decltype:
868 if (Current->is(tok::r_brace))
877 (Current->is(tok::kw_return) ||
878 (Current->is(tok::colon) && Current->Type == TT_ObjCMethodExpr)))
950 else if (Current->is(tok::semi) || Current->Type == TT_InlineASMColon ||
953 else if (Current->Type == TT_BinaryOperator || Current->is(tok::comma))
955 else if (Current->isOneOf(tok::period, tok::arrow))
991 if (!Current || !Current->is(tok::question))
1020 if (NextNonCommentLine && (*I)->First->is(tok::comment) &&
1024 NextNonCommentLine = (*I)->First->isNot(tok::r_brace) ? (*I) : NULL;
1115 Current->isOneOf(tok::comment, tok::string_literal)) {
1131 if (Left.is(tok::semi))
1133 if (Left.is(tok::comma))
1135 if (Right.is(tok::l_square))
1138 if (Right.Type == TT_StartOfName || Right.is(tok::kw_operator)) {
1139 if (Line.First->is(tok::kw_for) && Right.PartOfMultiVariableDeclStmt)
1148 if (Left.is(tok::equal) && Right.is(tok::l_brace))
1152 if (Left.is(tok::coloncolon))
1154 if (Left.isOneOf(tok::kw_class, tok::kw_struct))
1162 if (Left.isOneOf(tok::r_paren, tok::r_square) && Left.MatchingParen &&
1169 if (Left.is(tok::r_paren) && Line.Type != LT_ObjCProperty &&
1170 (Right.is(tok::kw_const) || (Right.is(tok::identifier) && Right.Next &&
1171 Right.Next->isNot(tok::l_paren))))
1175 if (Line.First->is(tok::kw_for) && Left.is(tok::equal))
1182 if (Left.is(tok::colon) && Left.Type == TT_ObjCMethodExpr)
1185 if (Left.is(tok::l_paren) && InFunctionDecl)
1191 if (Right.is(tok::lessless)) {
1192 if (Left.is(tok::string_literal)) {
1218 if (Right.is(tok::hashhash))
1219 return Left.is(tok::hash);
1220 if (Left.isOneOf(tok::hashhash, tok::hash))
1221 return Right.is(tok::hash);
1222 if (Left.is(tok::l_paren) && Right.is(tok::r_paren))
1224 if (Left.is(tok::l_paren) || Right.is(tok::r_paren))
1232 if (Right.isOneOf(tok::semi, tok::comma))
1234 if (Right.is(tok::less) &&
1235 (Left.is(tok::kw_template) ||
1238 if (Left.is(tok::arrow) || Right.is(tok::arrow))
1240 if (Left.isOneOf(tok::exclaim, tok::tilde))
1242 if (Left.is(tok::at) &&
1243 Right.isOneOf(tok::identifier, tok::string_literal, tok::char_constant,
1244 tok::numeric_constant, tok::l_paren, tok::l_brace,
1245 tok::kw_true, tok::kw_false))
1247 if (Left.is(tok::coloncolon))
1249 if (Right.is(tok::coloncolon))
1250 return (Left.is(tok::less) && Style.Standard == FormatStyle::LS_Cpp03) ||
1251 !Left.isOneOf(tok::identifier, tok::greater, tok::l_paren,
1252 tok::r_paren, tok::less);
1253 if (Left.is(tok::less) || Right.isOneOf(tok::greater, tok::less))
1255 if (Right.is(tok::ellipsis))
1257 if (Left.is(tok::l_square) && Right.is(tok::amp))
1261 ((Left.Type != TT_PointerOrReference) && Left.isNot(tok::l_paren) &&
1263 if (Right.Type == TT_FunctionTypeLParen && Left.isNot(tok::l_paren) &&
1269 Right.isNot(tok::l_paren) && Style.PointerBindsToType &&
1271 !Left.Previous->isOneOf(tok::l_paren, tok::coloncolon));
1272 if (Right.is(tok::star) && Left.is(tok::l_paren))
1274 if (Left.is(tok::l_square))
1276 Right.isNot(tok::r_square);
1277 if (Right.is(tok::r_square))
1280 if (Right.is(tok::l_square) && Right.Type != TT_ObjCMethodExpr &&
1281 Right.Type != TT_LambdaLSquare && Left.isNot(tok::numeric_constant))
1283 if (Left.is(tok::colon))
1285 if (Right.is(tok::colon))
1286 return Right.Type != TT_ObjCMethodExpr && !Left.is(tok::question);
1287 if (Right.is(tok::l_paren)) {
1288 if (Left.is(tok::r_paren) && Left.MatchingParen &&
1290 Left.MatchingParen->Previous->is(tok::kw___attribute))
1293 Left.isOneOf(tok::kw_return, tok::kw_new, tok::kw_delete,
1294 tok::semi) ||
1296 Left.isOneOf(tok::kw_if, tok::kw_for, tok::kw_while, tok::kw_switch,
1297 tok::kw_catch));
1299 if (Left.is(tok::at) && Right.Tok.getObjCKeywordID() != tok::objc_not_keyword)
1301 if (Left.is(tok::l_brace) && Right.is(tok::r_brace))
1303 if (Left.is(tok::l_brace) || Right.is(tok::r_brace))
1306 return !Left.isOneOf(tok::l_paren, tok::l_square, tok::at) &&
1307 (Left.isNot(tok::colon) || Left.Type != TT_ObjCMethodExpr);
1308 if (Left.isOneOf(tok::identifier, tok::greater, tok::r_square) &&
1309 Right.is(tok::l_brace) && Right.getNextNonComment() &&
1312 if (Left.is(tok::period) || Right.is(tok::period))
1316 if (Right.is(tok::hash) && Left.is(tok::identifier) && Left.TokenText == "L")
1330 if (Tok.Previous->is(tok::r_paren) && Tok.is(tok::identifier))
1335 (Tok.is(tok::equal) || Tok.Previous->is(tok::equal)))
1341 if (Tok.Previous->is(tok::comma))
1343 if (Tok.is(tok::comma))
1347 if (Tok.Previous->Tok.is(tok::kw_operator))
1348 return Tok.is(tok::coloncolon);
1351 if (Tok.is(tok::colon))
1352 return !Line.First->isOneOf(tok::kw_case, tok::kw_default) &&
1354 !Tok.Previous->is(tok::question);
1358 if (Tok.Previous->is(tok::greater) && Tok.is(tok::greater)) {
1363 if (Tok.isOneOf(tok::arrowstar, tok::periodstar) ||
1364 Tok.Previous->isOneOf(tok::arrowstar, tok::periodstar))
1369 if ((Tok.Type == TT_BinaryOperator && !Tok.Previous->is(tok::l_paren)) ||
1372 if (Tok.Previous->Type == TT_TemplateCloser && Tok.is(tok::l_paren))
1374 if (Tok.is(tok::less) && Tok.Previous->isNot(tok::l_paren) &&
1375 Line.First->is(tok::hash))
1384 if (Right.is(tok::comment)) {
1387 (Right.is(tok::string_literal) &&
1388 Right.Previous->is(tok::string_literal))) {
1392 } else if (Right.is(tok::lessless) && Right.Next &&
1393 Right.Previous->is(tok::string_literal) &&
1394 Right.Next->is(tok::string_literal)) {
1407 Right.Previous->isNot(tok::r_brace) && Right.isNot(tok::r_brace)) {
1409 } else if (Right.is(tok::l_brace) && (Right.BlockKind == BK_Block)) {
1418 if (Right.Type == TT_StartOfName || Right.is(tok::kw_operator))
1424 if (Left.is(tok::question) && Right.is(tok::colon))
1426 if (Right.Type == TT_ConditionalExpr || Right.is(tok::question))
1428 if (Left.Type == TT_ConditionalExpr || Left.is(tok::question))
1430 if (Right.is(tok::colon) &&
1433 if (Left.is(tok::colon) &&
1438 if (Left.is(tok::r_paren) && Line.Type == LT_ObjCProperty)
1451 Left.Type == TT_UnaryOperator || Left.is(tok::kw_operator))
1453 if (Left.is(tok::equal) && Line.Type == LT_VirtualFunctionDecl)
1456 if (Left.is(tok::l_paren) && Right.is(tok::l_paren) &&
1457 Left.Previous->is(tok::kw___attribute))
1459 if (Left.is(tok::l_paren) && (Left.Previous->Type == TT_BinaryOperator ||
1466 if (Right.is(tok::r_paren) || Right.Type == TT_TemplateCloser)
1471 if (Right.is(tok::r_brace))
1476 if (Left.is(tok::kw_const) && Left.Previous != NULL &&
1477 Left.Previous->is(tok::r_paren))
1478 return !Right.isOneOf(tok::l_brace, tok::semi, tok::equal);
1480 if (Right.is(tok::kw___attribute))
1483 if (Left.is(tok::identifier) && Right.is(tok::string_literal))
1494 if (Left.is(tok::greater) && Right.is(tok::greater) &&
1499 return (Left.isBinaryOperator() && Left.isNot(tok::lessless) &&
1501 Left.isOneOf(tok::comma, tok::coloncolon, tok::semi, tok::l_brace,
1502 tok::kw_class, tok::kw_struct) ||
1503 Right.isOneOf(tok::lessless, tok::arrow, tok::period, tok::colon,
1504 tok::l_square, tok::at) ||
1505 (Left.is(tok::r_paren) &&
1506 Right.isOneOf(tok::identifier, tok::kw_const, tok::kw___attribute)) ||
1507 (Left.is(tok::l_paren) && !Right.is(tok::r_paren));