Home | History | Annotate | Download | only in Parse

Lines Matching refs:is

5 // This file is distributed under the University of Illinois Open Source
71 /// If during the disambiguation process a parsing error is encountered,
73 /// Returns false if the statement is disambiguated as expression.
84 // There is an ambiguity in the grammar involving expression-statements and
88 // cases the statement is a declaration. [Note: To disambiguate, the whole
89 // statement might have to be examined to determine if it is an
93 // The disambiguation is purely syntactic; that is, the meaning of the names
95 // is not generally used in or changed by the disambiguation. Class
97 // is a type-name. Disambiguation precedes parsing, and a statement
101 // an ambiguity if the first decl-specifier is
118 // TryParseInitDeclaratorList is fixed.
154 if (Tok.is(tok::kw_typeof))
157 if (Tok.is(tok::annot_cxxscope))
161 if (getLangOpts().ObjC1 && Tok.is(tok::less))
167 // overwhelmingly common case that the next token is a '('.
212 if (Tok.is(tok::kw_asm) || Tok.is(tok::kw___attribute))
216 if (Tok.is(tok::l_paren)) {
221 } else if (Tok.is(tok::equal) || isTokIdentifier_in()) {
222 // MSVC and g++ won't examine the rest of declarators if '=' is
224 // EDG parses the initializer completely, which is the proper behavior
233 // in any other context 'in' is invalid after a declaration and parser
249 /// If during the disambiguation process a parsing error is encountered,
275 if (Tok.is(tok::kw_typeof))
280 if (getLangOpts().ObjC1 && Tok.is(tok::less))
283 assert(Tok.is(tok::l_paren) && "Expected '('");
295 if (Tok.is(tok::equal) ||
296 Tok.is(tok::kw_asm) || Tok.is(tok::kw___attribute))
298 else if (getLangOpts().CPlusPlus11 && Tok.is(tok::l_brace))
314 /// following the type-id. If the context is TypeIdInParens, we have
316 /// the corresponding ')'. If the context is
321 /// process a parsing error is encountered, the function returns
335 // type. The resolution is that any construct that could possibly be a type-id
352 if (Tok.is(tok::kw_typeof))
357 if (getLangOpts().ObjC1 && Tok.is(tok::less))
361 assert(Tok.is(tok::l_paren) && "Expected '('");
372 // we encounter a ')' this is a type-id, otherwise it's an expression.
373 if (Context == TypeIdInParens && Tok.is(tok::r_paren)) {
379 // ',', this is a type-id. Otherwise, it's an expression.
381 (Tok.is(tok::greater) || Tok.is(tok::comma) ||
382 (getLangOpts().CPlusPlus11 && Tok.is(tok::greatergreater)))) {
396 /// \brief Returns true if this is a C++11 attribute-specifier. Per
401 /// If Disambiguate is true, we try harder to determine whether a '[[' starts
404 /// If OuterMightBeMessageSend is true, we assume the outer '[' is either an
406 /// is not an Obj-C message send.
432 if (Tok.is(tok::kw_alignas))
452 IsAttribute &= Tok.is(tok::r_square);
466 // (1) is an attribute, (2) is ill-formed, and (3) and (4) are accepted.
468 // If we have a lambda-introducer, then this is definitely not a message send.
469 // FIXME: If this disambiguation is too slow, fold the tentative lambda parse
474 bool IsAttribute = Tok.is(tok::r_square);
496 if (Tok.is(tok::comma)) {
505 // requirements of an identifier is contained in an attribute-token,
506 // it is considered an identifier.
512 if (Tok.is(tok::coloncolon)) {
521 if (Tok.is(tok::l_paren)) {
529 if (Tok.is(tok::ellipsis))
540 if (Tok.is(tok::r_square)) {
542 IsAttribute = Tok.is(tok::r_square);
616 if (Tok.is(tok::coloncolon) || Tok.is(tok::identifier))
620 if (Tok.is(tok::star) || Tok.is(tok::amp) || Tok.is(tok::caret) ||
621 Tok.is(tok::ampamp) ||
622 (Tok.is(tok::annot_cxxscope) && NextToken().is(tok::star))) {
625 while (Tok.is(tok::kw_const) ||
626 Tok.is(tok::kw_volatile) ||
627 Tok.is(tok::kw_restrict))
636 if (Tok.is(tok::ellipsis))
639 if ((Tok.is(tok::identifier) ||
640 (Tok.is(tok::annot_cxxscope) && NextToken().is(tok::identifier))) &&
643 if (Tok.is(tok::annot_cxxscope))
648 } else if (Tok.is(tok::l_paren)) {
651 (Tok.is(tok::r_paren) || // 'int()' is a function.
652 // 'int(...)' is a function.
653 (Tok.is(tok::ellipsis) && NextToken().is(tok::r_paren)) ||
654 isDeclarationSpecifier())) { // 'int(int)' is a function.
664 if (Tok.is(tok::kw___attribute) ||
665 Tok.is(tok::kw___declspec) ||
666 Tok.is(tok::kw___cdecl) ||
667 Tok.is(tok::kw___stdcall) ||
668 Tok.is(tok::kw___fastcall) ||
669 Tok.is(tok::kw___thiscall) ||
670 Tok.is(tok::kw___unaligned))
687 if (Tok.is(tok::ellipsis))
690 if (Tok.is(tok::l_paren)) {
702 } else if (Tok.is(tok::l_square)) {
864 /// isCXXDeclarationSpecifier - Returns TPResult::True() if it is a declaration
865 /// specifier, TPResult::False() if it is not, TPResult::Ambiguous() if it could
869 /// If HasMissingTypename is provided, a name with a dependent scope specifier
870 /// will be treated as ambiguous if the 'typename' keyword is missing. If this
977 // In 'foo bar', 'foo' is
978 if (!getLangOpts().ObjC1 && Next.is(tok::identifier))
982 // Determine whether this is a valid expression. If not, we will hit
984 // this is ambiguous. Typo-correct to type and expression keywords and
996 // argument is an error, and was probably intended to be a type.
1015 if (Tok.is(tok::identifier))
1032 if (Next.is(tok::kw_new) || // ::new
1033 Next.is(tok::kw_delete)) // ::delete
1124 assert(Tok.is(tok::annot_typename));
1132 if (!Tok.is(tok::annot_typename)) {
1133 // If the next token is an identifier or a type qualifier, then this
1135 if (Tok.is(tok::annot_cxxscope) && NextToken().is(tok::identifier)) {
1144 bool isIdentifier = Tok.is(tok::identifier);
1156 // We can't tell whether this is a missing 'typename' or a valid
1164 switch (TryAnnotateName(false /* SS is not dependent */)) {
1171 // argument is an error, and was probably intended to be a type.
1210 if (getLangOpts().ObjC1 && NextToken().is(tok::less)) {
1216 bool isFollowedByParen = Tok.is(tok::l_paren);
1217 bool isFollowedByBrace = Tok.is(tok::l_brace);
1250 if (NextToken().is(tok::l_paren))
1253 // This is a function-style cast in all cases we disambiguate other than
1259 if (getLangOpts().CPlusPlus11 && NextToken().is(tok::l_brace))
1275 bool isFollowedByParen = Tok.is(tok::l_paren);
1276 bool isFollowedByBrace = Tok.is(tok::l_brace);
1310 assert(Tok.is(tok::kw_typeof) && "Expected 'typeof'!");
1313 assert(Tok.is(tok::l_paren) && "Expected '('");
1325 assert(Tok.is(tok::less) && "Expected '<' for qualifier list");
1332 if (Tok.is(tok::comma)) {
1337 if (Tok.is(tok::greater)) {
1353 if (Tok.is(tok::kw_typeof))
1356 if (Tok.is(tok::annot_cxxscope))
1360 if (getLangOpts().ObjC1 && Tok.is(tok::less))
1371 /// If during the disambiguation process a parsing error is encountered,
1382 // declaration. In that context, the choice is between a function declaration
1385 // ambiguities mentioned in 6.8, the resolution is to consider any construct
1398 if (Next.is(tok::amp) || Next.is(tok::ampamp) ||
1399 Next.is(tok::kw_const) || Next.is(tok::kw_volatile) ||
1400 Next.is(tok::kw_throw) || Next.is(tok::kw_noexcept) ||
1401 Next.is(tok::l_square) || isCXX11VirtSpecifier(Next) ||
1402 Next.is(tok::l_brace) || Next.is(tok::kw_try) ||
1403 Next.is(tok::equal) || Next.is(tok::arrow))
1443 if (Tok.is(tok::r_paren))
1455 if (Tok.is(tok::ellipsis)) {
1457 if (Tok.is(tok::r_paren))
1458 return TPResult::True(); // '...)' is a sign of a function declarator.
1463 // An attribute-specifier-seq here is a sign of a function declarator.
1473 // decl-specifier-seq '{' is not a parameter in C++11.
1485 if (Tok.is(tok::kw___attribute))
1488 if (Tok.is(tok::equal)) {
1496 if (Tok.is(tok::ellipsis)) {
1498 if (Tok.is(tok::r_paren))
1499 return TPResult::True(); // '...)' is a sign of a function declarator.
1526 // The '(' is already parsed.
1540 while (Tok.is(tok::kw_const) ||
1541 Tok.is(tok::kw_volatile) ||
1542 Tok.is(tok::kw_restrict) )
1546 if (Tok.is(tok::amp) || Tok.is(tok::ampamp))
1550 if (Tok.is(tok::kw_throw)) {
1560 if (Tok.is(tok::kw_noexcept)) {
1563 if (Tok.is(tok::l_paren)) {