19 #include <ansi-c/ansi_c_y.tab.h>
29 static unsigned __indent;
33 indenter() { __indent+=2; }
34 ~indenter() { __indent-=2; }
40 lex.LookAhead(0, _tk); \
41 std::cout << std::string(__indent, ' ') << "Text [" << _tk.line_no << "]: " \
42 << _tk.text << '\n'; \
118 return "CLASS_TEMPLATE";
120 return "MEMBER_TEMPLATE";
122 return "FUNCTION_TEMPLATE";
126 return "NON_TYPE_TEMPLATE_PARAMETER";
128 return "TYPE_TEMPLATE_PARAMETER";
130 return "TEMPLATE_TEMPLATE_PARAMETER";
136 typedef std::map<irep_idt, new_scopet>
id_mapt;
143 inline void print(std::ostream &out)
const
161 void print_rec(std::ostream &,
unsigned indent)
const;
184 for(id_mapt::const_iterator
189 out << std::string(indent,
' ') << it->first <<
": "
191 it->second.print_rec(out, indent+2);
199 lex(_cpp_parser.token_buffer),
276 typet &trailing_return_type);
398 if(p->
id()==ID_merged_type)
401 p = &merged_type.last_type();
417 if(cpp_name.
get_sub().size()==1 &&
418 cpp_name.
get_sub().front().id()==ID_name)
419 id=cpp_name.
get_sub().front().get(ID_identifier);
466 if(dest.
id()!=ID_merged_type)
479 sub.emplace(sub.begin(), src);
485 #define ERROR_TOKENS 4
495 source_location.
set_file(t[0].filename);
498 std::string message =
"parse error before '";
553 std::cout << std::string(__indent,
' ') <<
"Parser::rDefinition 1 " << t
559 else if(t==TOK_TYPEDEF)
561 else if(t==TOK_TEMPLATE)
565 else if(t==TOK_EXTERN &&
lex.
LookAhead(1)==TOK_TEMPLATE)
567 else if(t==TOK_NAMESPACE)
569 else if(t==TOK_INLINE &&
lex.
LookAhead(1)==TOK_NAMESPACE)
571 else if(t==TOK_USING &&
575 else if(t==TOK_USING)
577 else if(t==TOK_STATIC_ASSERT)
608 std::cout << std::string(__indent,
' ') <<
"Parser::rTypedef 1\n";
637 std::cout << std::string(__indent,
' ') <<
"Parser::rTypedefUsing 1\n";
653 std::cout << std::string(__indent,
' ') <<
"Parser::rTypedefUsing 2\n";
670 std::cout << std::string(__indent,
' ') <<
"Parser::rTypedefUsing 3\n";
694 std::cout << std::string(__indent,
' ') <<
"Parser::rTypeSpecifier 0\n";
705 std::cout << std::string(__indent,
' ') <<
"Parser::rTypeSpecifier 0.1\n";
717 std::cout << std::string(__indent,
' ') <<
"Parser::rTypeSpecifier 1\n";
725 std::cout << std::string(__indent,
' ') <<
"Parser::rTypeSpecifier 2\n";
733 std::cout << std::string(__indent,
' ') <<
"Parser::rTypeSpecifier 3\n";
742 std::cout << std::string(__indent,
' ') <<
"Parser::rTypeSpecifier 4\n";
754 if(t==TOK_IDENTIFIER || t==TOK_SCOPE
755 || t==TOK_CONSTEXPR || t==TOK_CONST || t==TOK_VOLATILE || t==TOK_RESTRICT
756 || t==TOK_CHAR || t==TOK_INT || t==TOK_SHORT || t==TOK_LONG
757 || t==TOK_CHAR16_T || t==TOK_CHAR32_T
758 || t==TOK_WCHAR_T || t==TOK_COMPLEX
759 || t==TOK_SIGNED || t==TOK_UNSIGNED || t==TOK_FLOAT || t==TOK_DOUBLE
760 || t==TOK_INT8 || t==TOK_INT16 || t==TOK_INT32 || t==TOK_INT64
762 || t==TOK_PTR32 || t==TOK_PTR64
763 || t==TOK_GCC_FLOAT80 || t==TOK_GCC_FLOAT128
764 || t==TOK_VOID || t==TOK_BOOL || t==TOK_CPROVER_BOOL
765 || t==TOK_CLASS || t==TOK_STRUCT || t==TOK_UNION || t==TOK_ENUM
770 || t==TOK_UNDERLYING_TYPE
809 linkage_spec.
items().push_back(item);
825 bool is_inline=
false;
842 name=tk2.
data.
get(ID_C_base_name);
972 items.push_back(item);
976 items.push_back(item);
1008 typet template_type;
1027 std::cout << std::string(__indent,
' ') <<
"BODY: "
1028 << body.
pretty() <<
'\n';
1029 std::cout << std::string(__indent,
' ') <<
"TEMPLATE_TYPE: "
1030 << template_type.
pretty() <<
'\n';
1032 body.
add(ID_template_type).
swap(template_type);
1033 body.
set(ID_is_template,
true);
1043 body.
add(ID_template_type).
swap(template_type);
1044 body.
set(ID_is_template,
true);
1064 decl=
typet(ID_template);
1077 irept &template_parameters=decl.
add(ID_template_parameters);
1101 if(template_parameters.
get_sub().empty())
1126 args.
get_sub().back().swap(a);
1137 args.
get_sub().back().swap(a);
1154 std::cout << std::string(__indent,
' ') <<
"Parser::rTempArgDeclaration 0\n";
1159 if((t0==TOK_CLASS || t0==TOK_TYPENAME))
1169 declaration.
set(ID_is_type,
true);
1170 declaration.
type()=
typet(
"cpp-template-type");
1180 bool has_ellipsis=
false;
1229 std::cout << std::string(__indent,
' ') <<
"Parser::rTempArgDeclaration 1\n";
1232 if(t0==TOK_TEMPLATE)
1236 typet template_type;
1267 std::cout << std::string(__indent,
' ')
1268 <<
"Parser::rTempArgDeclaration 2\n";
1272 declaration.
set(ID_is_type,
false);
1278 std::cout << std::string(__indent,
' ')
1279 <<
"Parser::rTempArgDeclaration 3\n";
1282 bool has_ellipsis=
false;
1299 std::cout << std::string(__indent,
' ')
1300 <<
"Parser::rTempArgDeclaration 4\n";
1386 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclaration 0.1 token: "
1398 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclaration 0.2\n";
1406 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclaration 1\n";
1414 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclaration 3\n";
1417 typet cv_q, integral;
1431 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclaration 4\n";
1445 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclaration 5\n";
1449 declaration, storage_spec, member_spec, integral, cv_q);
1456 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclaration 6 " << t
1461 ((t==TOK_IDENTIFIER &&
lex.
LookAhead(1)==
'=') || t==
'*'))
1472 typet cv_q, integral;
1498 integral.
swap(cv_q);
1537 std::cout << std::string(__indent,
' ')
1538 <<
"Parser::rIntegralDeclaration 1 token: "
1546 std::cout << std::string(__indent,
' ') <<
"Parser::rIntegralDeclaration 2\n";
1552 std::cout << std::string(__indent,
' ') <<
"Parser::rIntegralDeclaration 3\n";
1565 std::cout << std::string(__indent,
' ')
1566 <<
"Parser::rIntegralDeclaration 4\n";
1574 std::cout << std::string(__indent,
' ')
1575 <<
"Parser::rIntegralDeclaration 5\n";
1595 std::cout << std::string(__indent,
' ') <<
"Parser::rIntegralDeclaration 6 "
1604 declaration.
type().
id() == ID_auto &&
1606 declaration.
declarators().front().type().id() == ID_function_type &&
1607 declaration.
declarators().front().type().subtype().is_not_nil())
1609 declaration.
type() = declaration.
declarators().front().type().subtype();
1610 declaration.
declarators().front().type().subtype().make_nil();
1614 std::cout << std::string(__indent,
' ')
1615 <<
"Parser::rIntegralDeclaration 7\n";
1621 std::cout << std::string(__indent,
' ')
1622 <<
"Parser::rIntegralDeclaration 8 "
1623 << declaration.
pretty() <<
'\n';
1631 std::cout << std::string(__indent,
' ')
1632 <<
"Parser::rIntegralDeclaration 9\n";
1642 std::cout << std::string(__indent,
' ')
1643 <<
"Parser::rIntegralDeclaration 10\n";
1655 std::cout << std::string(__indent,
' ') <<
"Parser::rConstDeclaration\n";
1680 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 1\n";
1683 if(!
rName(type_name))
1689 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 2\n";
1703 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 3\n";
1707 bool is_operator =
false;
1712 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 4\n";
1715 assert(!type_name.
get_sub().empty());
1717 for(std::size_t i=0; i < type_name.
get_sub().size(); i++)
1719 if(type_name.
get_sub()[i].id() == ID_operator)
1730 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 5\n";
1734 typet type = type_name;
1738 typet trailing_return_type;
1740 conv_operator_declarator, type_name, trailing_return_type))
1743 type_name=
typet(
"cpp-cast-operator");
1745 declaration.
declarators().push_back(conv_operator_declarator);
1750 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 6\n";
1753 assert(!type_name.
get_sub().empty());
1755 bool is_destructor=
false;
1756 for(
const auto &irep : type_name.
get_sub())
1758 if(irep.id() ==
"~")
1766 typet trailing_return_type;
1768 constructor_declarator, type_name, trailing_return_type))
1772 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 7\n";
1777 type_name=trailing_return_type;
1779 type_name=
typet(is_destructor?ID_destructor:ID_constructor);
1781 declaration.
declarators().push_back(constructor_declarator);
1786 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 8\n";
1804 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 9\n";
1816 declaration.
type().
swap(type_name);
1821 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 10\n";
1827 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 11\n";
1836 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 12\n";
1860 std::cout << std::string(__indent,
' ') <<
"Parser::isConstructorDecl "
1869 if(t==
'*' || t==
'&' || t==
'(')
1871 else if(t==TOK_STDCALL || t==TOK_FASTCALL || t==TOK_CLRCALL || t==TOK_CDECL)
1875 else if(t==TOK_IDENTIFIER)
1899 while(t0==TOK_IDENTIFIER)
1922 else if(v==
'\0' || v==
';' || v==
'}')
1926 else if(u==
'\0' || u==
';' || u==
'}')
1951 member_spec.
clear();
1956 t == TOK_FRIEND || t == TOK_INLINE || t == TOK_VIRTUAL ||
1957 t == TOK_EXPLICIT || t == TOK_MSC_FORCEINLINE)
1965 case TOK_MSC_FORCEINLINE:
1968 case TOK_VIRTUAL: member_spec.
set_virtual(
true);
break;
1969 case TOK_FRIEND: member_spec.
set_friend(
true);
break;
1970 case TOK_EXPLICIT: member_spec.
set_explicit(
true);
break;
1994 t==TOK_THREAD_LOCAL)
2001 case TOK_STATIC: storage_spec.
set_static();
break;
2002 case TOK_EXTERN: storage_spec.
set_extern();
break;
2003 case TOK_AUTO: storage_spec.
set_auto();
break;
2005 case TOK_MUTABLE: storage_spec.
set_mutable();
break;
2006 case TOK_GCC_ASM: storage_spec.
set_asm();
break;
2025 if(t==TOK_CONSTEXPR ||
2026 t==TOK_CONST || t==TOK_VOLATILE || t==TOK_RESTRICT ||
2027 t==TOK_PTR32 || t==TOK_PTR64 ||
2028 t==TOK_GCC_ATTRIBUTE || t==TOK_GCC_ASM)
2037 p=
typet(ID_constexpr);
2049 p=
typet(ID_volatile);
2055 p=
typet(ID_restrict);
2072 case TOK_GCC_ATTRIBUTE:
2127 exprt exp(ID_alignof);
2128 exp.
add(ID_type_arg).
swap(tname);
2131 typet attr(ID_aligned);
2133 attr.
add(ID_size, exp);
2150 typet attr(ID_aligned);
2152 attr.
add(ID_size, exp);
2166 std::cout << std::string(__indent,
' ') <<
"Parser::rAttribute "
2183 case TOK_GCC_ATTRIBUTE_PACKED:
2185 typet attr(ID_packed);
2191 case TOK_GCC_ATTRIBUTE_TRANSPARENT_UNION:
2193 typet attr(ID_transparent_union);
2199 case TOK_GCC_ATTRIBUTE_VECTOR_SIZE:
2214 attr.
set(ID_size, exp);
2220 case TOK_GCC_ATTRIBUTE_ALIGNED:
2222 typet attr(ID_aligned);
2239 attr.
add(ID_size, exp);
2246 case TOK_GCC_ATTRIBUTE_MODE:
2260 typet attr(ID_gcc_attribute_mode);
2267 case TOK_GCC_ATTRIBUTE_GNU_INLINE:
2269 typet attr(ID_static);
2275 case TOK_GCC_ATTRIBUTE_WEAK:
2277 typet attr(ID_weak);
2283 case TOK_GCC_ATTRIBUTE_ALIAS:
2296 typet attr(ID_alias);
2303 case TOK_GCC_ATTRIBUTE_SECTION:
2316 typet attr(ID_section);
2323 case TOK_GCC_ATTRIBUTE_NORETURN:
2325 typet attr(ID_noreturn);
2331 case TOK_GCC_ATTRIBUTE_CONSTRUCTOR:
2333 typet attr(ID_constructor);
2339 case TOK_GCC_ATTRIBUTE_DESTRUCTOR:
2341 typet attr(ID_destructor);
2385 typet attr(ID_noreturn);
2412 std::cout << std::string(__indent,
' ')
2413 <<
"Parser::optIntegralTypeOrClassSpec 0\n";
2423 bool is_integral=
false;
2433 std::cout << std::string(__indent,
' ')
2434 <<
"Parser::optIntegralTypeOrClassSpec 1\n";
2441 case TOK_CHAR: type_id=ID_char;
break;
2442 case TOK_CHAR16_T: type_id=ID_char16_t;
break;
2443 case TOK_CHAR32_T: type_id=ID_char32_t;
break;
2444 case TOK_INT: type_id=ID_int;
break;
2445 case TOK_SHORT: type_id=ID_short;
break;
2446 case TOK_LONG: type_id=ID_long;
break;
2447 case TOK_SIGNED: type_id=ID_signed;
break;
2448 case TOK_WCHAR_T: type_id=ID_wchar_t;
break;
2449 case TOK_COMPLEX: type_id=ID_complex;
break;
2450 case TOK_UNSIGNED: type_id=ID_unsigned;
break;
2451 case TOK_FLOAT: type_id=ID_float;
break;
2452 case TOK_DOUBLE: type_id=ID_double;
break;
2453 case TOK_VOID: type_id=ID_void;
break;
2454 case TOK_INT8: type_id=ID_int8;
break;
2455 case TOK_INT16: type_id=ID_int16;
break;
2456 case TOK_INT32: type_id=ID_int32;
break;
2457 case TOK_INT64: type_id=ID_int64;
break;
2458 case TOK_GCC_INT128: type_id=ID_gcc_int128;
break;
2459 case TOK_GCC_FLOAT80: type_id=ID_gcc_float80;
break;
2460 case TOK_GCC_FLOAT128: type_id=ID_gcc_float128;
break;
2462 type_id = ID_c_bool;
2464 case TOK_CPROVER_BOOL: type_id=ID_proper_bool;
break;
2465 case TOK_AUTO: type_id = ID_auto;
break;
2469 if(!type_id.
empty())
2486 std::cout << std::string(__indent,
' ')
2487 <<
"Parser::optIntegralTypeOrClassSpec 2\n";
2494 std::cout << std::string(__indent,
' ')
2495 <<
"Parser::optIntegralTypeOrClassSpec 3\n";
2498 if(t==TOK_CLASS || t==TOK_STRUCT || t==TOK_UNION || t==TOK_INTERFACE)
2500 else if(t==TOK_ENUM)
2502 else if(t==TOK_TYPEOF)
2505 std::cout << std::string(__indent,
' ')
2506 <<
"Parser::optIntegralTypeOrClassSpec 4\n";
2513 std::cout << std::string(__indent,
' ')
2514 <<
"Parser::optIntegralTypeOrClassSpec 5\n";
2534 p.
add(ID_type_arg).
swap(tname);
2543 std::cout << std::string(__indent,
' ')
2544 <<
"Parser::optIntegralTypeOrClassSpec 6\n";
2552 std::cout << std::string(__indent,
' ')
2553 <<
"Parser::optIntegralTypeOrClassSpec 7\n";
2560 std::cout << std::string(__indent,
' ')
2561 <<
"Parser::optIntegralTypeOrClassSpec 8\n";
2564 p.
add(ID_expr_arg).
swap(expr);
2568 else if(t==TOK_DECLTYPE)
2573 p=
typet(ID_decltype);
2589 p.
add(ID_expr_arg).
swap(expr);
2593 else if(t==TOK_UNDERLYING_TYPE)
2600 p=
typet(ID_msc_underlying_type);
2617 p.
add(ID_type_arg).
swap(tname);
2636 typet &trailing_return_type)
2640 std::cout << std::string(__indent,
' ') <<
"Parser::rConstructorDecl 0\n";
2647 constructor.
name().
swap(type_name);
2654 std::cout << std::string(__indent,
' ') <<
"Parser::rConstructorDecl 1\n";
2657 irept ¶meters=constructor.
type().
add(ID_parameters);
2667 std::cout << std::string(__indent,
' ') <<
"Parser::rConstructorDecl 2\n";
2670 typet &cv=
static_cast<typet &
>(constructor.
add(ID_method_qualifier));
2679 std::cout << std::string(__indent,
' ') <<
"Parser::rConstructorDecl 3\n";
2691 std::cout << std::string(__indent,
' ') <<
"Parser::rConstructorDecl 4\n";
2705 std::cout << std::string(__indent,
' ') <<
"Parser::rConstructorDecl 5\n";
2717 constructor.
value()=
codet(
"cpp-pure-virtual");
2787 else if(t==TOK_ELLIPSIS)
2833 bool should_be_declarator,
2844 declarators.push_back(declarator);
2862 bool should_be_declarator,
2875 typet bit_field_type(ID_c_bit_field);
2876 bit_field_type.
set(ID_size, e);
2889 declarator,
kDeclarator, should_be_declarator, is_statement))
2934 if(declarator.
type().
id()!=ID_function_type)
2950 typet bit_field_type(ID_c_bit_field);
2951 bit_field_type.
set(ID_size, e);
2958 dw.
swap(declarator);
2975 while(t==TOK_STDCALL || t==TOK_FASTCALL || t==TOK_CLRCALL || t==TOK_CDECL)
3005 bool should_be_declarator,
3012 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 1\n";
3019 typet d_outer, d_inner;
3034 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 2\n";
3042 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 3\n";
3053 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 4\n";
3061 if(!should_be_declarator)
3066 if(t!=
'[' && t!=
'(')
3072 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 5\n";
3079 (kind==
kDeclarator || t==TOK_IDENTIFIER || t==TOK_SCOPE))
3082 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 6\n";
3091 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 7\n";
3104 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 8\n";
3124 typet function_type(ID_function_type);
3126 function_type.
add(ID_parameters).
swap(args);
3130 d_outer.
swap(d_inner);
3136 init_args.
swap(args);
3141 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 9\n";
3150 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 10\n";
3171 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 11\n";
3189 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 12\n";
3204 std::list<typet> tl;
3205 tl.push_back(d_outer);
3206 while(tl.back().id() == ID_array)
3208 tl.push_back(tl.back().subtype());
3213 d_outer.
swap(array_type);
3216 tl.back().subtype().swap(d_outer);
3217 d_outer.
swap(tl.back());
3233 d_outer.
swap(merged_type);
3237 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 13\n";
3263 std::cout << std::string(__indent,
' ') <<
"Parser::optPtrOperator 1\n";
3266 std::list<typet> t_list;
3273 std::cout << std::string(__indent,
' ') <<
"Parser::optPtrOperator 2 " << t
3279 typet op(ID_frontend_pointer);
3290 t_list.push_back(op);
3295 typet op(ID_block_pointer);
3306 t_list.push_back(op);
3320 t_list.push_back(cv);
3323 t_list.push_back(op);
3336 typet op(ID_frontend_pointer);
3337 op.
set(ID_C_reference,
true);
3339 t_list.push_front(op);
3341 else if(t==TOK_ANDAND)
3345 typet op(ID_frontend_pointer);
3346 op.
set(ID_C_rvalue_reference,
true);
3348 t_list.push_front(op);
3352 for(std::list<typet>::reverse_iterator
3357 if(it->id()==ID_merged_type)
3360 merged_type.last_type().subtype().swap(ptrs);
3364 assert(it->is_not_nil());
3365 it->subtype().swap(ptrs);
3385 init=
irept(ID_member_initializers);
3415 std::cout << std::string(__indent,
' ') <<
"Parser::rMemberInit 1\n";
3424 std::cout << std::string(__indent,
' ') <<
"Parser::rMemberInit 2\n";
3427 init=
codet(ID_member_initializer);
3428 init.
add(ID_member).
swap(name);
3438 std::cout << std::string(__indent,
' ') <<
"Parser::rMemberInit 3\n";
3457 std::cout << std::string(__indent,
' ') <<
"Parser::rMemberInit 4\n";
3497 std::cout << std::string(__indent,
' ') <<
"Parser::rName 0\n";
3507 name.
set(ID_typename,
true);
3517 std::cout << std::string(__indent,
' ') <<
"Parser::rName 1\n";
3525 std::cout << std::string(__indent,
' ') <<
"Parser::rName 2 "
3533 std::cout << std::string(__indent,
' ') <<
"Parser::rName 3\n";
3543 std::cout << std::string(__indent,
' ') <<
"Parser::rName 4\n";
3550 components.push_back(
irept(ID_template_args));
3551 components.back().
add(ID_arguments).
swap(args);
3559 case TOK_IDENTIFIER:
3561 std::cout << std::string(__indent,
' ') <<
"Parser::rName 5\n";
3570 if(t!=TOK_SCOPE && t!=
'<')
3577 std::cout << std::string(__indent,
' ') <<
"Parser::rName 6\n";
3580 components.push_back(
irept(
"::"));
3586 std::cout << std::string(__indent,
' ') <<
"Parser::rName 7\n";
3594 components.push_back(
irept(
"~"));
3600 std::cout << std::string(__indent,
' ') <<
"Parser::rName 8\n";
3604 components.push_back(
irept(ID_operator));
3607 components.push_back(
irept());
3660 operator_id = std::string(1,
static_cast<char>(t));
3663 case TOK_MULTASSIGN: operator_id=
"*=";
break;
3664 case TOK_DIVASSIGN: operator_id=
"/=";
break;
3665 case TOK_MODASSIGN: operator_id=
"%=";
break;
3666 case TOK_PLUSASSIGN: operator_id=
"+=";
break;
3667 case TOK_MINUSASSIGN: operator_id=
"-=";
break;
3668 case TOK_SHLASSIGN: operator_id=
"<<=";
break;
3669 case TOK_SHRASSIGN: operator_id=
">>=";
break;
3670 case TOK_ANDASSIGN: operator_id=
"&=";
break;
3671 case TOK_XORASSIGN: operator_id=
"^=";
break;
3672 case TOK_ORASSIGN: operator_id=
"|=";
break;
3673 case TOK_SHIFTLEFT: operator_id=
"<<";
break;
3674 case TOK_SHIFTRIGHT: operator_id=
">>";
break;
3675 case TOK_EQ: operator_id=
"==";
break;
3676 case TOK_NE: operator_id=
"!=";
break;
3677 case TOK_LE: operator_id=
"<=";
break;
3678 case TOK_GE: operator_id=
">=";
break;
3679 case TOK_ANDAND: operator_id=
"&&";
break;
3680 case TOK_OROR: operator_id=
"||";
break;
3681 case TOK_INCR: operator_id=
"++";
break;
3682 case TOK_DECR: operator_id=
"--";
break;
3683 case TOK_DOTPM: operator_id=
".*";
break;
3684 case TOK_ARROWPM: operator_id=
"->*";
break;
3685 case TOK_ARROW: operator_id=
"->";
break;
3694 name=
irept(t==TOK_NEW?ID_cpp_new:ID_cpp_delete);
3699 name=
irept(t==TOK_NEW?ID_cpp_new_array:ID_cpp_delete_array);
3726 assert(!operator_id.
empty());
3728 name=
irept(operator_id);
3742 typet cv1, cv2, type_name, ptr;
3757 if(!
rName(type_name))
3784 std::cout << std::string(__indent,
' ') <<
"Parser::rPtrToMember 0\n";
3787 typet ptm(ID_frontend_pointer);
3788 irept &name = ptm.
add(ID_to_member);
3798 bool loop_cond =
true;
3818 components.push_back(
irept(ID_template_args));
3819 components.back().
add(ID_arguments).
swap(args);
3826 case TOK_IDENTIFIER:
3833 if(t!=TOK_SCOPE && t!=
'<')
3840 components.push_back(
irept(
"::"));
3847 ptr_to_mem.
swap(ptm);
3850 std::cout << std::string(__indent,
' ') <<
"Parser::rPtrToMember 1\n";
3881 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 0\n";
3892 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 1\n";
3904 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 2\n";
3913 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 3\n";
3928 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 4\n";
3940 exp.
id(ID_ambiguous);
3942 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 4.1\n";
3954 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 4.2\n";
3961 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 5\n";
3979 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 6\n";
3983 template_args.
get_sub().back().swap(exp);
3995 case TOK_SHIFTRIGHT:
4076 else if(t==TOK_ELLIPSIS)
4088 list.
get_sub().back().swap(declaration);
4092 else if(t==TOK_ELLIPSIS)
4097 else if(t!=
')' && t!=TOK_ELLIPSIS)
4126 header=
typet(ID_register);
4144 declaration.
declarators().push_back(arg_declarator);
4174 expr.
id(ID_initializer_list);
4183 if(t==TOK_MSC_IF_EXISTS ||
4184 t==TOK_MSC_IF_NOT_EXISTS)
4294 std::cout << std::string(__indent,
' ') <<
"Parser::rEnumSpec 1\n";
4311 spec.
set(ID_C_class,
true);
4328 std::cout << std::string(__indent,
' ') <<
"Parser::rEnumSpec 2\n";
4340 std::cout << std::string(__indent,
' ') <<
"Parser::rEnumSpec 3\n";
4363 std::cout << std::string(__indent,
' ') <<
"Parser::rEnumSpec 4\n";
4435 std::cout << std::string(__indent,
' ') <<
"Parser::rClassSpec 1\n";
4439 if(t!=TOK_CLASS && t!=TOK_STRUCT &&
4440 t!=TOK_UNION && t!=TOK_INTERFACE)
4444 std::cout << std::string(__indent,
' ') <<
"Parser::rClassSpec 2\n";
4449 spec=
typet(ID_struct);
4450 spec.
set(ID_C_class,
true);
4452 else if(t==TOK_INTERFACE)
4454 spec=
typet(ID_struct);
4455 spec.
set(ID_C_interface,
true);
4457 else if(t==TOK_STRUCT)
4458 spec=
typet(ID_struct);
4459 else if(t==TOK_UNION)
4460 spec=
typet(ID_union);
4467 std::cout << std::string(__indent,
' ') <<
"Parser::rClassSpec 3\n";
4474 std::cout << std::string(__indent,
' ') <<
"Parser::rClassSpec 4\n";
4498 std::cout << std::string(__indent,
' ') <<
"Parser::rClassSpec 5\n";
4518 std::cout << std::string(__indent,
' ') <<
"Parser::rClassSpec 6\n";
4530 std::cout << std::string(__indent,
' ') <<
"Parser::rClassSpec 7\n";
4554 irept base(ID_base);
4559 base.
set(ID_virtual,
true);
4563 if(t==TOK_PUBLIC || t==TOK_PROTECTED || t==TOK_PRIVATE)
4568 base.
set(ID_protection, ID_public);
4572 base.
set(ID_protection, ID_protected);
4576 base.
set(ID_protection, ID_private);
4589 base.
set(ID_virtual,
true);
4603 bases.
get_sub().back().swap(base);
4621 std::cout << std::string(__indent,
' ') <<
"Parser::rClassBody 0\n";
4646 std::cout << std::string(__indent,
' ') <<
"Parser::rClassBody "
4647 << member.
pretty() <<
'\n';
4651 std::move(
static_cast<exprt &
>(
static_cast<irept &
>(member))));
4683 std::cout << std::string(__indent,
' ') <<
"Parser::rClassMember 0 " << t
4687 if(t==TOK_PUBLIC || t==TOK_PROTECTED || t==TOK_PRIVATE)
4692 member.
id(
"cpp-public");
4696 member.
id(
"cpp-protected");
4700 member.
id(
"cpp-private");
4716 else if(t==TOK_TYPEDEF)
4718 else if(t==TOK_TEMPLATE)
4720 else if(t==TOK_USING &&
4724 else if(t==TOK_USING)
4726 else if(t==TOK_STATIC_ASSERT)
4755 name_decl.
name() = name;
4772 std::cout << std::string(__indent,
' ') <<
"Parser::rCommaExpression 0\n";
4779 std::cout << std::string(__indent,
' ') <<
"Parser::rCommaExpression 1\n";
4795 exp=
exprt(ID_comma);
4801 std::cout << std::string(__indent,
' ') <<
"Parser::rCommaExpression 2\n";
4817 std::cout << std::string(__indent,
' ') <<
"Parser::rExpression 0\n";
4824 std::cout << std::string(__indent,
' ') <<
"Parser::rExpression 1\n";
4830 t==TOK_MULTASSIGN || t==TOK_DIVASSIGN || t==TOK_MODASSIGN ||
4831 t==TOK_PLUSASSIGN || t==TOK_MINUSASSIGN || t==TOK_SHLASSIGN ||
4832 t==TOK_SHRASSIGN || t==TOK_ANDASSIGN ||
4833 t==TOK_XORASSIGN || t==TOK_ORASSIGN)
4838 std::cout << std::string(__indent,
' ') <<
"Parser::rExpression 2\n";
4846 std::cout << std::string(__indent,
' ') <<
"Parser::rExpression 3\n";
4852 exp=
exprt(ID_side_effect);
4855 exp.
set(ID_statement, ID_assign);
4856 else if(t==TOK_PLUSASSIGN)
4857 exp.
set(ID_statement, ID_assign_plus);
4858 else if(t==TOK_MINUSASSIGN)
4859 exp.
set(ID_statement, ID_assign_minus);
4860 else if(t==TOK_MULTASSIGN)
4861 exp.
set(ID_statement, ID_assign_mult);
4862 else if(t==TOK_DIVASSIGN)
4863 exp.
set(ID_statement, ID_assign_div);
4864 else if(t==TOK_MODASSIGN)
4865 exp.
set(ID_statement, ID_assign_mod);
4866 else if(t==TOK_SHLASSIGN)
4867 exp.
set(ID_statement, ID_assign_shl);
4868 else if(t==TOK_SHRASSIGN)
4869 exp.
set(ID_statement, ID_assign_shr);
4870 else if(t==TOK_ANDASSIGN)
4871 exp.
set(ID_statement, ID_assign_bitand);
4872 else if(t==TOK_XORASSIGN)
4873 exp.
set(ID_statement, ID_assign_bitxor);
4874 else if(t==TOK_ORASSIGN)
4875 exp.
set(ID_statement, ID_assign_bitor);
4882 std::cout << std::string(__indent,
' ') <<
"Parser::rExpression 4\n";
4896 std::cout << std::string(__indent,
' ') <<
"Parser::rConditionalExpr 0\n";
4903 std::cout << std::string(__indent,
' ') <<
"Parser::rConditionalExpr 1\n";
4909 exprt then, otherwise;
4916 std::cout << std::string(__indent,
' ') <<
"Parser::rConditionalExpr 2\n";
4929 if_exprt(std::move(cond), std::move(then), std::move(otherwise),
typet());
4945 std::cout << std::string(__indent,
' ') <<
"Parser::rLogicalOrExpr 0\n";
4952 std::cout << std::string(__indent,
' ') <<
"Parser::rLogicalOrExpr 1\n";
4984 std::cout << std::string(__indent,
' ') <<
"Parser::rLogicalAndExpr 1\n";
4991 std::cout << std::string(__indent,
' ') <<
"Parser::rLogicalAndExpr 1\n";
5023 std::cout << std::string(__indent,
' ') <<
"Parser::rInclusiveOrExpr 0\n";
5030 std::cout << std::string(__indent,
' ') <<
"Parser::rInclusiveOrExpr 1\n";
5045 exp=
exprt(ID_bitor);
5062 std::cout << std::string(__indent,
' ') <<
"Parser::rExclusiveOrExpr 0\n";
5069 std::cout << std::string(__indent,
' ') <<
"Parser::rExclusiveOrExpr 1\n";
5078 if(!
rAndExpr(right, template_args))
5084 exp=
exprt(ID_bitxor);
5101 std::cout << std::string(__indent,
' ') <<
"Parser::rAndExpr 0\n";
5108 std::cout << std::string(__indent,
' ') <<
"Parser::rAndExpr 1\n";
5123 exp=
exprt(ID_bitand);
5140 std::cout << std::string(__indent,
' ') <<
"Parser::rEqualityExpr 0\n";
5147 std::cout << std::string(__indent,
' ') <<
"Parser::rEqualityExpr 1\n";
5163 exp=
exprt(tk.
kind==TOK_EQ?ID_equal:ID_notequal);
5180 std::cout << std::string(__indent,
' ') <<
"Parser::rRelationalExpr 0\n";
5187 std::cout << std::string(__indent,
' ') <<
"Parser::rRelationalExpr 1\n";
5193 (t==TOK_LE || t==TOK_GE || t==
'<' || (t==
'>' && !template_args)))
5209 case TOK_LE:
id=ID_le;
break;
5210 case TOK_GE:
id=ID_ge;
break;
5211 case '<':
id=ID_lt;
break;
5212 case '>':
id=ID_gt;
break;
5232 std::cout << std::string(__indent,
' ') <<
"Parser::rShiftExpr 0\n";
5239 std::cout << std::string(__indent,
' ') <<
"Parser::rShiftExpr 1\n";
5255 exp=
exprt((tk.
kind==TOK_SHIFTRIGHT)?ID_shr:ID_shl);
5272 std::cout << std::string(__indent,
' ') <<
"Parser::rAdditiveExpr 0\n";
5279 std::cout << std::string(__indent,
' ') <<
"Parser::rAdditiveExpr 1\n";
5298 case '+':
id=ID_plus;
break;
5299 case '-':
id=ID_minus;
break;
5319 std::cout << std::string(__indent,
' ') <<
"Parser::rMultiplyExpr 0\n";
5326 std::cout << std::string(__indent,
' ') <<
"Parser::rMultiplyExpr 1\n";
5330 while(t=
lex.
LookAhead(0), (t==
'*' || t==
'/' || t==
'%'))
5345 case '*':
id=ID_mult;
break;
5346 case '/':
id=ID_div;
break;
5347 case '%':
id=ID_mod;
break;
5356 std::cout << std::string(__indent,
' ') <<
"Parser::rMultiplyExpr 2\n";
5372 std::cout << std::string(__indent,
' ') <<
"Parser::rPmExpr 0\n";
5379 std::cout << std::string(__indent,
' ') <<
"Parser::rPmExpr 1\n";
5395 exp =
exprt(ID_pointer_to_member);
5401 std::cout << std::string(__indent,
' ') <<
"Parser::rPmExpr 2\n";
5416 std::cout << std::string(__indent,
' ') <<
"Parser::rCastExpr 0\n";
5432 std::cout << std::string(__indent,
' ') <<
"Parser::rCastExpr 1\n";
5453 exp=
exprt(
"explicit-typecast");
5476 std::cout << std::string(__indent,
' ') <<
"Parser::rTypeName 0\n";
5485 std::cout << std::string(__indent,
' ') <<
"Parser::rTypeName 1\n";
5505 std::cout << std::string(__indent,
' ') <<
"Parser::rTypeName 2\n";
5520 std::cout << std::string(__indent,
' ')
5521 <<
"Parser::rTypeNameOrFunctionType 0\n";
5529 std::cout << std::string(__indent,
' ')
5530 <<
"Parser::rTypeNameOrFunctionType 1\n";
5542 std::cout << std::string(__indent,
' ')
5543 <<
"Parser::rTypeNameOrFunctionType 2\n";
5551 std::cout << std::string(__indent,
' ')
5552 <<
"Parser::rTypeNameOrFunctionType 3\n";
5557 tname.
swap(return_type);
5566 std::cout << std::string(__indent,
' ')
5567 <<
"Parser::rTypeNameOrFunctionType 4\n";
5594 type.set(ID_identifier, op.data.get(ID_C_base_name));
5605 type.set(ID_identifier, op.data.get(ID_C_base_name));
5615 std::cout << std::string(__indent,
' ')
5616 <<
"Parser::rTypeNameOrFunctionType 5\n";
5622 else if(t==TOK_ELLIPSIS)
5626 type.make_ellipsis();
5635 parameter.
swap(parameter_declaration);
5636 type.parameters().push_back(parameter);
5644 else if(t==TOK_ELLIPSIS)
5650 type.make_ellipsis();
5658 std::cout << std::string(__indent,
' ')
5659 <<
"Parser::rTypeNameOrFunctionType 6\n";
5670 std::cout << std::string(__indent,
' ')
5671 <<
"Parser::rTypeNameOrFunctionType 7\n";
5681 std::cout << std::string(__indent,
' ')
5682 <<
"Parser::rTypeNameOrFunctionType 8\n";
5704 std::cout << std::string(__indent,
' ') <<
"Parser::rUnaryExpr 0\n";
5707 if(t==
'*' || t==
'&' || t==
'+' ||
5708 t==
'-' || t==
'!' || t==
'~' ||
5709 t==TOK_INCR || t==TOK_DECR)
5715 std::cout << std::string(__indent,
' ') <<
"Parser::rUnaryExpr 1\n";
5723 std::cout << std::string(__indent,
' ') <<
"Parser::rUnaryExpr 2\n";
5729 exp=
exprt(ID_dereference);
5733 exp=
exprt(ID_address_of);
5737 exp=
exprt(ID_unary_plus);
5741 exp=
exprt(ID_unary_minus);
5749 exp=
exprt(ID_bitnot);
5753 exp=
exprt(ID_side_effect);
5754 exp.
set(ID_statement, ID_preincrement);
5758 exp=
exprt(ID_side_effect);
5759 exp.
set(ID_statement, ID_predecrement);
5771 else if(t==TOK_SIZEOF)
5773 else if(t==TOK_ALIGNOF)
5775 else if(t==TOK_THROW)
5777 else if(t==TOK_NOEXCEPT)
5779 else if(t==TOK_REAL || t==TOK_IMAG)
5790 exp=
exprt(t==TOK_REAL?ID_complex_real:ID_complex_imag);
5811 std::cout << std::string(__indent,
' ') <<
"Parser::rThrowExpr 0\n";
5822 if(t==
':' || t==
';')
5850 std::cout << std::string(__indent,
' ') <<
"Parser::rTypeidExpr 0\n";
5872 exp =
exprt(ID_typeid);
5891 exp =
exprt(ID_typeid);
5916 std::cout << std::string(__indent,
' ') <<
"Parser::rSizeofExpr 0\n";
5934 exp=
exprt(ID_sizeof);
5935 exp.
add(ID_type_arg).
swap(tname);
5956 exp=
exprt(ID_sizeof);
5957 exp.
add(ID_type_arg).
swap(tname);
5971 exp=
exprt(ID_sizeof);
6000 exp=
exprt(ID_alignof);
6001 exp.
add(ID_type_arg).
swap(tname);
6016 std::cout << std::string(__indent,
' ') <<
"Parser::rNoexceptExpr 0\n";
6034 exp=
exprt(ID_noexcept);
6052 return t==TOK_NEW || t==TOK_DELETE;
6067 std::cout << std::string(__indent,
' ') <<
"Parser::rAllocateExpr 0\n";
6078 std::cout << std::string(__indent,
' ') <<
"Parser::rAllocateExpr 1\n";
6084 std::cout << std::string(__indent,
' ') <<
"Parser::rAllocateExpr 2\n";
6098 exp=
exprt(ID_side_effect);
6099 exp.
set(ID_statement, ID_cpp_delete_array);
6103 exp=
exprt(ID_side_effect);
6104 exp.
set(ID_statement, ID_cpp_delete);
6119 std::cout << std::string(__indent,
' ') <<
"Parser::rAllocateExpr 3\n";
6122 exp=
exprt(ID_side_effect);
6123 exp.
set(ID_statement, ID_cpp_new);
6126 exprt arguments, initializer;
6132 std::cout << std::string(__indent,
' ') <<
"Parser::rAllocateExpr 4\n";
6135 exp.
add(ID_initializer).
swap(initializer);
6267 decl.
swap(array_type);
6338 std::cout << std::string(__indent,
' ') <<
"Parser::rPostfixExpr 0\n";
6345 std::cout << std::string(__indent,
' ') <<
"Parser::rPostfixExpr 1\n";
6362 std::cout << std::string(__indent,
' ') <<
"Parser::rPostfixExpr 2\n";
6372 exp=
exprt(ID_index);
6380 std::cout << std::string(__indent,
' ') <<
"Parser::rPostfixExpr 3\n";
6391 std::cout << std::string(__indent,
' ') <<
"Parser::rPostfixExpr 4\n";
6401 fc.arguments().push_back(*it);
6434 std::cout << std::string(__indent,
' ') <<
"Parser::rPostfixExpr 5\n";
6441 std::cout << std::string(__indent,
' ') <<
"Parser::rPostfixExpr 6\n";
6449 exp=
exprt(ID_member);
6451 exp=
exprt(ID_ptrmember);
6457 exp.
add(ID_component_cpp_name).
swap(e);
6493 expr=
exprt(ID_msc_uuidof);
6494 expr.
add(ID_type_arg).
swap(tname);
6511 expr=
exprt(ID_msc_uuidof);
6528 if(tk1.
kind!=TOK_MSC_IF_EXISTS &&
6529 tk1.
kind!=TOK_MSC_IF_NOT_EXISTS)
6557 tk1.
kind==TOK_MSC_IF_EXISTS?ID_msc_if_exists:
6558 ID_msc_if_not_exists);
6573 if(tk1.
kind != TOK_MSC_IF_EXISTS && tk1.
kind != TOK_MSC_IF_NOT_EXISTS)
6597 block.
add(std::move(*statement));
6606 tk1.
kind == TOK_MSC_IF_EXISTS ? ID_msc_if_exists : ID_msc_if_not_exists);
6612 return std::move(code);
6631 typet tname1, tname2;
6635 case TOK_UNARY_TYPE_PREDICATE:
6642 expr.
add(ID_type_arg).
swap(tname1);
6645 case TOK_BINARY_TYPE_PREDICATE:
6656 expr.
add(
"type_arg1").
swap(tname1);
6657 expr.
add(
"type_arg2").
swap(tname2);
6690 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 0 "
6703 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 1\n";
6712 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 2\n";
6718 exp=
exprt(
"cpp-this");
6721 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 3\n";
6730 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 4\n";
6739 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 5\n";
6749 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 6\n";
6755 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 7\n";
6763 exp =
exprt(ID_side_effect);
6764 exp.
set(ID_statement, ID_statement_expression);
6782 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 8\n";
6792 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 9\n";
6798 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 10\n";
6805 case TOK_UNARY_TYPE_PREDICATE:
6806 case TOK_BINARY_TYPE_PREDICATE:
6808 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 11\n";
6812 case TOK_MSC_UUIDOF:
6814 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 12\n";
6820 case TOK_MSC_IF_EXISTS:
6821 case TOK_MSC_IF_NOT_EXISTS:
6823 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 13\n";
6829 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 14\n";
6838 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 15\n";
6851 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 16\n";
6861 exp=
exprt(
"explicit-constructor-call");
6877 exp=
exprt(
"explicit-constructor-call");
6901 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 17\n";
6922 std::cout << std::string(__indent,
' ') <<
"Parser::rVarName 0\n";
6935 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 0\n";
6945 name.
set(ID_typename,
true);
6955 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 1\n";
6963 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 1.1 "
6973 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 2\n";
6981 case TOK_IDENTIFIER:
6983 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 3\n";
6996 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 4\n";
7006 components.push_back(
irept(ID_template_args));
7007 components.back().add(ID_arguments).swap(args);
7016 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 5\n";
7020 components.push_back(
irept(
"::"));
7026 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 6\n";
7034 components.push_back(
irept(
"~"));
7040 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 7\n";
7045 components.push_back(
irept(ID_operator));
7053 components.push_back(op);
7068 if(t==TOK_IDENTIFIER || t==
'~' || t==TOK_OPERATOR || t==TOK_TEMPLATE)
7087 std::cout << std::string(__indent,
' ') <<
"Parser::maybeTemplateArgs 0\n";
7096 if(u==
'\0' || u==
';' || u==
'}')
7098 else if((u==
'>' || u==TOK_SHIFTRIGHT) &&
7109 std::cout << std::string(__indent,
' ')
7110 <<
"Parser::maybeTemplateArgs 1\n";
7116 std::cout << std::string(__indent,
' ')
7117 <<
"Parser::maybeTemplateArgs 2\n";
7132 std::cout << std::string(__indent,
' ')
7133 <<
"Parser::maybeTemplateArgs 3\n";
7140 else if(v==
'\0' || v==
';' || v==
'}')
7144 else if(u==
'\0' || u==
';' || u==
'}')
7146 else if(u==TOK_SHIFTRIGHT && n>=2)
7150 std::cout << std::string(__indent,
' ')
7151 <<
"Parser::maybeTemplateArgs 4\n";
7156 std::cout << std::string(__indent,
' ') <<
"Parser::maybeTemplateArgs 5\n";
7162 std::cout << std::string(__indent,
' ') <<
"Parser::maybeTemplateArgs 6\n";
7165 return t==TOK_SCOPE || t==
'(';
7170 std::cout << std::string(__indent,
' ') <<
"Parser::maybeTemplateArgs 7\n";
7201 declarator.
value()=body;
7211 declarator.
value() = std::move(*body);
7234 std::cout << std::string(__indent,
' ') <<
"Parser::rCompoundStatement 1\n";
7241 std::cout << std::string(__indent,
' ') <<
"Parser::rCompoundStatement 2\n";
7250 statement.
add(std::move(*statement2));
7258 return std::move(statement);
7265 return std::move(statement);
7296 std::cout << std::string(__indent,
' ') <<
"Parser::rStatement 0 "
7337 codet statement(k == TOK_BREAK ? ID_break : ID_continue);
7343 return std::move(statement);
7348 std::cout << std::string(__indent,
' ') <<
"Parser::rStatement RETURN 0\n";
7359 std::cout << std::string(__indent,
' ')
7360 <<
"Parser::rStatement RETURN 1\n";
7367 std::cout << std::string(__indent,
' ')
7368 <<
"Parser::rStatement RETURN 2\n";
7375 std::cout << std::string(__indent,
' ')
7376 <<
"Parser::rStatement RETURN 3\n";
7383 return std::move(statement);
7398 return std::move(statement);
7424 std::move(case_expr), std::move(range_end), std::move(*statement2));
7426 return std::move(code);
7439 std::move(case_expr), std::move(*statement2));
7441 return std::move(statement);
7460 return std::move(statement);
7472 case TOK_MSC_IF_EXISTS:
7473 case TOK_MSC_IF_NOT_EXISTS:
7476 case TOK_IDENTIFIER:
7488 return std::move(label);
7507 return std::move(statement);
7518 case TOK_STATIC_ASSERT:
7525 codet statement(ID_static_assert);
7527 statement.
operands().swap(cpp_static_assert.operands());
7529 return std::move(statement);
7559 if(!then.has_value())
7569 std::move(exp), std::move(*then), std::move(*otherwise));
7571 return std::move(statement);
7580 return std::move(statement);
7607 code_switcht statement(std::move(exp), std::move(*body));
7609 return std::move(statement);
7638 code_whilet statement(std::move(exp), std::move(*body));
7640 return std::move(statement);
7658 if(!body.has_value())
7679 return std::move(statement);
7699 if(!exp1.has_value())
7729 std::move(*exp1), std::move(exp2), std::move(exp3), std::move(*body));
7731 return std::move(statement);
7753 if(!try_body.has_value())
7776 codet ellipsis(ID_ellipsis);
7778 catch_op = std::move(ellipsis);
7790 if(declaration.
declarators().front().name().is_nil())
7797 catch_op = std::move(code_decl);
7816 return std::move(statement);
7831 if(!body1.has_value())
7836 codet statement(ID_msc_try_except);
7856 std::move(*body1), std::move(exp), std::move(*body2));
7857 return std::move(statement);
7864 codet statement(ID_msc_try_finally);
7872 return std::move(statement);
7891 codet statement(ID_msc_leave);
7894 return std::move(statement);
7903 std::cout << std::string(__indent,
' ') <<
"Parser::rGCCAsmStatement 1\n";
7918 std::cout << std::string(__indent,
' ') <<
"Parser::rGCCAsmStatement 3\n";
7929 std::cout << std::string(__indent,
' ') <<
"Parser::rGCCAsmStatement 3\n";
7935 std::cout << std::string(__indent,
' ') <<
"Parser::rGCCAsmStatement 4\n";
7956 std::cout << std::string(__indent,
' ')
7957 <<
"Parser::rGCCAsmStatement 5\n";
7965 std::cout << std::string(__indent,
' ')
7966 <<
"Parser::rGCCAsmStatement 6\n";
7981 std::cout << std::string(__indent,
' ') <<
"Parser::rGCCAsmStatement 7\n";
7990 std::cout << std::string(__indent,
' ') <<
"Parser::rGCCAsmStatement 8\n";
7993 return std::move(statement);
8002 std::cout << std::string(__indent,
' ') <<
"Parser::rMSCAsmStatement 1\n";
8016 std::cout << std::string(__indent,
' ') <<
"Parser::rMSCAsmStatement 2\n";
8024 std::cout << std::string(__indent,
' ') <<
"Parser::rMSCAsmStatement 3\n";
8037 std::cout << std::string(__indent,
' ') <<
"Parser::rMSCAsmStatement 4\n";
8043 std::cout << std::string(__indent,
' ') <<
"Parser::rMSCAsmStatement 5\n";
8047 return std::move(statement);
8053 std::cout << std::string(__indent,
' ') <<
"Parser::rMSCAsmStatement 6\n";
8058 std::cout << std::string(__indent,
' ') <<
"Parser::rMSCAsmStatement 7\n";
8061 return std::move(statement);
8078 std::cout << std::string(__indent,
' ') <<
"Parser::rExprStatement 0\n";
8084 std::cout << std::string(__indent,
' ') <<
"Parser::rExprStatement 1\n";
8090 return std::move(statement);
8095 std::cout << std::string(__indent,
' ') <<
"Parser::rExprStatement 2\n";
8103 std::cout << std::string(__indent,
' ') <<
"rDe " << statement->pretty()
8115 std::cout << std::string(__indent,
' ') <<
"Parser::rExprStatement 3\n";
8122 std::cout << std::string(__indent,
' ') <<
"Parser::rExprStatement 4\n";
8126 std::cout << std::string(__indent,
' ') <<
"Parser::rExprStatement 5 "
8134 std::cout << std::string(__indent,
' ') <<
"Parser::rExprStatement 6\n";
8139 return std::move(expr_statement);
8154 statement=
codet(ID_decl);
8186 typet cv_q, integral;
8191 std::cout << std::string(__indent,
' ')
8192 <<
"Parser::rDeclarationStatement 1\n";
8214 std::cout << std::string(__indent,
' ')
8215 <<
"Parser::rDeclarationStatement 2\n";
8225 std::cout << std::string(__indent,
' ')
8226 <<
"Parser::rDeclarationStatement 3 " << t <<
'\n';
8230 ((t==TOK_IDENTIFIER &&
lex.
LookAhead(1)==
'=') || t==
'*'))
8233 std::cout << std::string(__indent,
' ')
8234 <<
"Parser::rDeclarationStatement 4\n";
8274 return std::move(statement);
8287 return std::move(statement);
8303 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclStatement 1\n";
8306 if(!
rName(type_name))
8310 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclStatement 2\n";
8317 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclStatement 3\n";
8323 declaration.
type().
swap(type_name);
8330 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclStatement 4\n";
8339 return std::move(statement);
8354 if(t==token || t==
'\0')