22 #include <ansi-c/ansi_c_y.tab.h>
32 static unsigned __indent;
36 indenter() { __indent+=2; }
37 ~indenter() { __indent-=2; }
43 lex.LookAhead(0, _tk); \
44 std::cout << std::string(__indent, ' ') << "Text [" << _tk.line_no << "]: " \
45 << _tk.text << '\n'; \
121 return "CLASS_TEMPLATE";
123 return "MEMBER_TEMPLATE";
125 return "FUNCTION_TEMPLATE";
129 return "NON_TYPE_TEMPLATE_PARAMETER";
131 return "TYPE_TEMPLATE_PARAMETER";
133 return "TEMPLATE_TEMPLATE_PARAMETER";
139 typedef std::map<irep_idt, new_scopet>
id_mapt;
146 inline void print(std::ostream &out)
const
164 void print_rec(std::ostream &,
unsigned indent)
const;
187 for(id_mapt::const_iterator
192 out << std::string(indent,
' ') << it->first <<
": "
194 it->second.print_rec(out, indent+2);
202 lex(_cpp_parser.token_buffer),
279 typet &trailing_return_type);
401 if(p->
id()==ID_merged_type)
404 p = &merged_type.last_type();
420 if(cpp_name.
get_sub().size()==1 &&
421 cpp_name.
get_sub().front().id()==ID_name)
422 id=cpp_name.
get_sub().front().get(ID_identifier);
469 if(dest.
id()!=ID_merged_type)
482 sub.emplace(sub.begin(), src);
488 #define ERROR_TOKENS 4
498 source_location.
set_file(t[0].filename);
501 std::string message =
"parse error before '";
556 std::cout << std::string(__indent,
' ') <<
"Parser::rDefinition 1 " << t
562 else if(t==TOK_TYPEDEF)
564 else if(t==TOK_TEMPLATE)
568 else if(t==TOK_EXTERN &&
lex.
LookAhead(1)==TOK_TEMPLATE)
570 else if(t==TOK_NAMESPACE)
572 else if(t==TOK_INLINE &&
lex.
LookAhead(1)==TOK_NAMESPACE)
574 else if(t==TOK_USING &&
578 else if(t==TOK_USING)
580 else if(t==TOK_STATIC_ASSERT)
611 std::cout << std::string(__indent,
' ') <<
"Parser::rTypedef 1\n";
640 std::cout << std::string(__indent,
' ') <<
"Parser::rTypedefUsing 1\n";
656 std::cout << std::string(__indent,
' ') <<
"Parser::rTypedefUsing 2\n";
673 std::cout << std::string(__indent,
' ') <<
"Parser::rTypedefUsing 3\n";
697 std::cout << std::string(__indent,
' ') <<
"Parser::rTypeSpecifier 0\n";
708 std::cout << std::string(__indent,
' ') <<
"Parser::rTypeSpecifier 0.1\n";
720 std::cout << std::string(__indent,
' ') <<
"Parser::rTypeSpecifier 1\n";
728 std::cout << std::string(__indent,
' ') <<
"Parser::rTypeSpecifier 2\n";
736 std::cout << std::string(__indent,
' ') <<
"Parser::rTypeSpecifier 3\n";
745 std::cout << std::string(__indent,
' ') <<
"Parser::rTypeSpecifier 4\n";
757 if(t==TOK_IDENTIFIER || t==TOK_SCOPE
758 || t==TOK_CONSTEXPR || t==TOK_CONST || t==TOK_VOLATILE || t==TOK_RESTRICT
759 || t==TOK_CHAR || t==TOK_INT || t==TOK_SHORT || t==TOK_LONG
760 || t==TOK_CHAR16_T || t==TOK_CHAR32_T
761 || t==TOK_WCHAR_T || t==TOK_COMPLEX
762 || t==TOK_SIGNED || t==TOK_UNSIGNED || t==TOK_FLOAT || t==TOK_DOUBLE
763 || t==TOK_INT8 || t==TOK_INT16 || t==TOK_INT32 || t==TOK_INT64
765 || t==TOK_PTR32 || t==TOK_PTR64
766 || t==TOK_GCC_FLOAT80 || t==TOK_GCC_FLOAT128
767 || t==TOK_VOID || t==TOK_BOOL || t==TOK_CPROVER_BOOL
768 || t==TOK_CLASS || t==TOK_STRUCT || t==TOK_UNION || t==TOK_ENUM
773 || t==TOK_UNDERLYING_TYPE
812 linkage_spec.
items().push_back(item);
828 bool is_inline=
false;
845 name=tk2.
data.
get(ID_C_base_name);
975 items.push_back(item);
979 items.push_back(item);
1011 typet template_type;
1030 std::cout << std::string(__indent,
' ') <<
"BODY: "
1031 << body.
pretty() <<
'\n';
1032 std::cout << std::string(__indent,
' ') <<
"TEMPLATE_TYPE: "
1033 << template_type.
pretty() <<
'\n';
1035 body.
add(ID_template_type).
swap(template_type);
1036 body.
set(ID_is_template,
true);
1046 body.
add(ID_template_type).
swap(template_type);
1047 body.
set(ID_is_template,
true);
1067 decl=
typet(ID_template);
1080 irept &template_parameters=decl.
add(ID_template_parameters);
1104 if(template_parameters.
get_sub().empty())
1129 args.
get_sub().back().swap(a);
1140 args.
get_sub().back().swap(a);
1157 std::cout << std::string(__indent,
' ') <<
"Parser::rTempArgDeclaration 0\n";
1162 if((t0==TOK_CLASS || t0==TOK_TYPENAME))
1172 declaration.
set(ID_is_type,
true);
1173 declaration.
type()=
typet(
"cpp-template-type");
1183 bool has_ellipsis=
false;
1232 std::cout << std::string(__indent,
' ') <<
"Parser::rTempArgDeclaration 1\n";
1235 if(t0==TOK_TEMPLATE)
1239 typet template_type;
1270 std::cout << std::string(__indent,
' ')
1271 <<
"Parser::rTempArgDeclaration 2\n";
1275 declaration.
set(ID_is_type,
false);
1281 std::cout << std::string(__indent,
' ')
1282 <<
"Parser::rTempArgDeclaration 3\n";
1285 bool has_ellipsis=
false;
1302 std::cout << std::string(__indent,
' ')
1303 <<
"Parser::rTempArgDeclaration 4\n";
1389 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclaration 0.1 token: "
1401 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclaration 0.2\n";
1409 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclaration 1\n";
1417 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclaration 3\n";
1420 typet cv_q, integral;
1434 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclaration 4\n";
1448 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclaration 5\n";
1452 declaration, storage_spec, member_spec, integral, cv_q);
1459 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclaration 6 " << t
1464 ((t==TOK_IDENTIFIER &&
lex.
LookAhead(1)==
'=') || t==
'*'))
1475 typet cv_q, integral;
1501 integral.
swap(cv_q);
1540 std::cout << std::string(__indent,
' ')
1541 <<
"Parser::rIntegralDeclaration 1 token: "
1549 std::cout << std::string(__indent,
' ') <<
"Parser::rIntegralDeclaration 2\n";
1555 std::cout << std::string(__indent,
' ') <<
"Parser::rIntegralDeclaration 3\n";
1568 std::cout << std::string(__indent,
' ')
1569 <<
"Parser::rIntegralDeclaration 4\n";
1577 std::cout << std::string(__indent,
' ')
1578 <<
"Parser::rIntegralDeclaration 5\n";
1598 std::cout << std::string(__indent,
' ') <<
"Parser::rIntegralDeclaration 6 "
1607 declaration.
type().
id() == ID_auto &&
1609 declaration.
declarators().front().type().id() == ID_function_type &&
1610 declaration.
declarators().front().type().subtype().is_not_nil())
1612 declaration.
type() = declaration.
declarators().front().type().subtype();
1613 declaration.
declarators().front().type().subtype().make_nil();
1617 std::cout << std::string(__indent,
' ')
1618 <<
"Parser::rIntegralDeclaration 7\n";
1624 std::cout << std::string(__indent,
' ')
1625 <<
"Parser::rIntegralDeclaration 8 "
1626 << declaration.
pretty() <<
'\n';
1634 std::cout << std::string(__indent,
' ')
1635 <<
"Parser::rIntegralDeclaration 9\n";
1645 std::cout << std::string(__indent,
' ')
1646 <<
"Parser::rIntegralDeclaration 10\n";
1658 std::cout << std::string(__indent,
' ') <<
"Parser::rConstDeclaration\n";
1683 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 1\n";
1686 if(!
rName(type_name))
1692 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 2\n";
1706 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 3\n";
1710 bool is_operator =
false;
1715 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 4\n";
1718 assert(!type_name.
get_sub().empty());
1720 for(std::size_t i=0; i < type_name.
get_sub().size(); i++)
1722 if(type_name.
get_sub()[i].id() == ID_operator)
1733 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 5\n";
1737 typet type = type_name;
1741 typet trailing_return_type;
1743 conv_operator_declarator, type_name, trailing_return_type))
1746 type_name=
typet(
"cpp-cast-operator");
1748 declaration.
declarators().push_back(conv_operator_declarator);
1753 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 6\n";
1756 assert(!type_name.
get_sub().empty());
1758 bool is_destructor=
false;
1759 for(
const auto &irep : type_name.
get_sub())
1761 if(irep.id() ==
"~")
1769 typet trailing_return_type;
1771 constructor_declarator, type_name, trailing_return_type))
1775 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 7\n";
1780 type_name=trailing_return_type;
1782 type_name=
typet(is_destructor?ID_destructor:ID_constructor);
1784 declaration.
declarators().push_back(constructor_declarator);
1789 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 8\n";
1807 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 9\n";
1819 declaration.
type().
swap(type_name);
1824 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 10\n";
1830 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 11\n";
1839 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 12\n";
1863 std::cout << std::string(__indent,
' ') <<
"Parser::isConstructorDecl "
1872 if(t==
'*' || t==
'&' || t==
'(')
1874 else if(t==TOK_STDCALL || t==TOK_FASTCALL || t==TOK_CLRCALL || t==TOK_CDECL)
1878 else if(t==TOK_IDENTIFIER)
1902 while(t0==TOK_IDENTIFIER)
1925 else if(v==
'\0' || v==
';' || v==
'}')
1929 else if(u==
'\0' || u==
';' || u==
'}')
1954 member_spec.
clear();
1959 t == TOK_FRIEND || t == TOK_INLINE || t == TOK_VIRTUAL ||
1960 t == TOK_EXPLICIT || t == TOK_MSC_FORCEINLINE)
1968 case TOK_MSC_FORCEINLINE:
1971 case TOK_VIRTUAL: member_spec.
set_virtual(
true);
break;
1972 case TOK_FRIEND: member_spec.
set_friend(
true);
break;
1973 case TOK_EXPLICIT: member_spec.
set_explicit(
true);
break;
1997 t==TOK_THREAD_LOCAL)
2004 case TOK_STATIC: storage_spec.
set_static();
break;
2005 case TOK_EXTERN: storage_spec.
set_extern();
break;
2006 case TOK_AUTO: storage_spec.
set_auto();
break;
2008 case TOK_MUTABLE: storage_spec.
set_mutable();
break;
2009 case TOK_GCC_ASM: storage_spec.
set_asm();
break;
2028 if(t==TOK_CONSTEXPR ||
2029 t==TOK_CONST || t==TOK_VOLATILE || t==TOK_RESTRICT ||
2030 t==TOK_PTR32 || t==TOK_PTR64 ||
2031 t==TOK_GCC_ATTRIBUTE || t==TOK_GCC_ASM)
2040 p=
typet(ID_constexpr);
2052 p=
typet(ID_volatile);
2058 p=
typet(ID_restrict);
2075 case TOK_GCC_ATTRIBUTE:
2130 exprt exp(ID_alignof);
2131 exp.
add(ID_type_arg).
swap(tname);
2134 typet attr(ID_aligned);
2136 attr.
add(ID_size, exp);
2153 typet attr(ID_aligned);
2155 attr.
add(ID_size, exp);
2169 std::cout << std::string(__indent,
' ') <<
"Parser::rAttribute "
2186 case TOK_GCC_ATTRIBUTE_PACKED:
2188 typet attr(ID_packed);
2194 case TOK_GCC_ATTRIBUTE_TRANSPARENT_UNION:
2196 typet attr(ID_transparent_union);
2202 case TOK_GCC_ATTRIBUTE_VECTOR_SIZE:
2217 attr.
set(ID_size, exp);
2223 case TOK_GCC_ATTRIBUTE_ALIGNED:
2225 typet attr(ID_aligned);
2242 attr.
add(ID_size, exp);
2249 case TOK_GCC_ATTRIBUTE_MODE:
2263 typet attr(ID_gcc_attribute_mode);
2270 case TOK_GCC_ATTRIBUTE_GNU_INLINE:
2272 typet attr(ID_static);
2278 case TOK_GCC_ATTRIBUTE_WEAK:
2280 typet attr(ID_weak);
2286 case TOK_GCC_ATTRIBUTE_ALIAS:
2299 typet attr(ID_alias);
2306 case TOK_GCC_ATTRIBUTE_SECTION:
2319 typet attr(ID_section);
2326 case TOK_GCC_ATTRIBUTE_NORETURN:
2328 typet attr(ID_noreturn);
2334 case TOK_GCC_ATTRIBUTE_CONSTRUCTOR:
2336 typet attr(ID_constructor);
2342 case TOK_GCC_ATTRIBUTE_DESTRUCTOR:
2344 typet attr(ID_destructor);
2388 typet attr(ID_noreturn);
2415 std::cout << std::string(__indent,
' ')
2416 <<
"Parser::optIntegralTypeOrClassSpec 0\n";
2426 bool is_integral=
false;
2436 std::cout << std::string(__indent,
' ')
2437 <<
"Parser::optIntegralTypeOrClassSpec 1\n";
2444 case TOK_CHAR: type_id=ID_char;
break;
2445 case TOK_CHAR16_T: type_id=ID_char16_t;
break;
2446 case TOK_CHAR32_T: type_id=ID_char32_t;
break;
2447 case TOK_INT: type_id=ID_int;
break;
2448 case TOK_SHORT: type_id=ID_short;
break;
2449 case TOK_LONG: type_id=ID_long;
break;
2450 case TOK_SIGNED: type_id=ID_signed;
break;
2451 case TOK_WCHAR_T: type_id=ID_wchar_t;
break;
2452 case TOK_COMPLEX: type_id=ID_complex;
break;
2453 case TOK_UNSIGNED: type_id=ID_unsigned;
break;
2454 case TOK_FLOAT: type_id=ID_float;
break;
2455 case TOK_DOUBLE: type_id=ID_double;
break;
2456 case TOK_VOID: type_id=ID_void;
break;
2457 case TOK_INT8: type_id=ID_int8;
break;
2458 case TOK_INT16: type_id=ID_int16;
break;
2459 case TOK_INT32: type_id=ID_int32;
break;
2460 case TOK_INT64: type_id=ID_int64;
break;
2461 case TOK_GCC_INT128: type_id=ID_gcc_int128;
break;
2462 case TOK_GCC_FLOAT80: type_id=ID_gcc_float80;
break;
2463 case TOK_GCC_FLOAT128: type_id=ID_gcc_float128;
break;
2465 type_id = ID_c_bool;
2467 case TOK_CPROVER_BOOL: type_id=ID_proper_bool;
break;
2468 case TOK_AUTO: type_id = ID_auto;
break;
2472 if(!type_id.
empty())
2489 std::cout << std::string(__indent,
' ')
2490 <<
"Parser::optIntegralTypeOrClassSpec 2\n";
2497 std::cout << std::string(__indent,
' ')
2498 <<
"Parser::optIntegralTypeOrClassSpec 3\n";
2501 if(t==TOK_CLASS || t==TOK_STRUCT || t==TOK_UNION || t==TOK_INTERFACE)
2503 else if(t==TOK_ENUM)
2505 else if(t==TOK_TYPEOF)
2508 std::cout << std::string(__indent,
' ')
2509 <<
"Parser::optIntegralTypeOrClassSpec 4\n";
2516 std::cout << std::string(__indent,
' ')
2517 <<
"Parser::optIntegralTypeOrClassSpec 5\n";
2537 p.
add(ID_type_arg).
swap(tname);
2546 std::cout << std::string(__indent,
' ')
2547 <<
"Parser::optIntegralTypeOrClassSpec 6\n";
2555 std::cout << std::string(__indent,
' ')
2556 <<
"Parser::optIntegralTypeOrClassSpec 7\n";
2563 std::cout << std::string(__indent,
' ')
2564 <<
"Parser::optIntegralTypeOrClassSpec 8\n";
2567 p.
add(ID_expr_arg).
swap(expr);
2571 else if(t==TOK_DECLTYPE)
2576 p=
typet(ID_decltype);
2592 p.
add(ID_expr_arg).
swap(expr);
2596 else if(t==TOK_UNDERLYING_TYPE)
2603 p=
typet(ID_msc_underlying_type);
2620 p.
add(ID_type_arg).
swap(tname);
2639 typet &trailing_return_type)
2643 std::cout << std::string(__indent,
' ') <<
"Parser::rConstructorDecl 0\n";
2650 constructor.
name().
swap(type_name);
2657 std::cout << std::string(__indent,
' ') <<
"Parser::rConstructorDecl 1\n";
2660 irept ¶meters=constructor.
type().
add(ID_parameters);
2670 std::cout << std::string(__indent,
' ') <<
"Parser::rConstructorDecl 2\n";
2673 typet &cv=
static_cast<typet &
>(constructor.
add(ID_method_qualifier));
2682 std::cout << std::string(__indent,
' ') <<
"Parser::rConstructorDecl 3\n";
2694 std::cout << std::string(__indent,
' ') <<
"Parser::rConstructorDecl 4\n";
2708 std::cout << std::string(__indent,
' ') <<
"Parser::rConstructorDecl 5\n";
2720 constructor.
value()=
codet(
"cpp-pure-virtual");
2790 else if(t==TOK_ELLIPSIS)
2836 bool should_be_declarator,
2847 declarators.push_back(declarator);
2865 bool should_be_declarator,
2878 typet bit_field_type(ID_c_bit_field);
2879 bit_field_type.
set(ID_size, e);
2892 declarator,
kDeclarator, should_be_declarator, is_statement))
2937 if(declarator.
type().
id()!=ID_function_type)
2953 typet bit_field_type(ID_c_bit_field);
2954 bit_field_type.
set(ID_size, e);
2961 dw.
swap(declarator);
2978 while(t==TOK_STDCALL || t==TOK_FASTCALL || t==TOK_CLRCALL || t==TOK_CDECL)
3008 bool should_be_declarator,
3015 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 1\n";
3022 typet d_outer, d_inner;
3037 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 2\n";
3045 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 3\n";
3056 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 4\n";
3064 if(!should_be_declarator)
3069 if(t!=
'[' && t!=
'(')
3075 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 5\n";
3082 (kind==
kDeclarator || t==TOK_IDENTIFIER || t==TOK_SCOPE))
3085 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 6\n";
3094 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 7\n";
3107 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 8\n";
3127 typet function_type(ID_function_type);
3129 function_type.
add(ID_parameters).
swap(args);
3133 d_outer.
swap(d_inner);
3139 init_args.
swap(args);
3144 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 9\n";
3153 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 10\n";
3174 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 11\n";
3192 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 12\n";
3207 std::list<typet> tl;
3208 tl.push_back(d_outer);
3209 while(tl.back().id() == ID_array)
3211 tl.push_back(tl.back().subtype());
3216 d_outer.
swap(array_type);
3219 tl.back().subtype().swap(d_outer);
3220 d_outer.
swap(tl.back());
3236 d_outer.
swap(merged_type);
3240 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 13\n";
3266 std::cout << std::string(__indent,
' ') <<
"Parser::optPtrOperator 1\n";
3269 std::list<typet> t_list;
3276 std::cout << std::string(__indent,
' ') <<
"Parser::optPtrOperator 2 " << t
3282 typet op(ID_frontend_pointer);
3293 t_list.push_back(op);
3298 typet op(ID_block_pointer);
3309 t_list.push_back(op);
3323 t_list.push_back(cv);
3326 t_list.push_back(op);
3339 typet op(ID_frontend_pointer);
3340 op.
set(ID_C_reference,
true);
3342 t_list.push_front(op);
3344 else if(t==TOK_ANDAND)
3348 typet op(ID_frontend_pointer);
3349 op.
set(ID_C_rvalue_reference,
true);
3351 t_list.push_front(op);
3355 for(std::list<typet>::reverse_iterator
3360 if(it->id()==ID_merged_type)
3363 merged_type.last_type().subtype().swap(ptrs);
3367 assert(it->is_not_nil());
3368 it->subtype().swap(ptrs);
3388 init=
irept(ID_member_initializers);
3418 std::cout << std::string(__indent,
' ') <<
"Parser::rMemberInit 1\n";
3427 std::cout << std::string(__indent,
' ') <<
"Parser::rMemberInit 2\n";
3430 init=
codet(ID_member_initializer);
3431 init.
add(ID_member).
swap(name);
3441 std::cout << std::string(__indent,
' ') <<
"Parser::rMemberInit 3\n";
3460 std::cout << std::string(__indent,
' ') <<
"Parser::rMemberInit 4\n";
3500 std::cout << std::string(__indent,
' ') <<
"Parser::rName 0\n";
3510 name.
set(ID_typename,
true);
3520 std::cout << std::string(__indent,
' ') <<
"Parser::rName 1\n";
3528 std::cout << std::string(__indent,
' ') <<
"Parser::rName 2 "
3536 std::cout << std::string(__indent,
' ') <<
"Parser::rName 3\n";
3546 std::cout << std::string(__indent,
' ') <<
"Parser::rName 4\n";
3553 components.push_back(
irept(ID_template_args));
3554 components.back().
add(ID_arguments).
swap(args);
3562 case TOK_IDENTIFIER:
3564 std::cout << std::string(__indent,
' ') <<
"Parser::rName 5\n";
3573 if(t!=TOK_SCOPE && t!=
'<')
3580 std::cout << std::string(__indent,
' ') <<
"Parser::rName 6\n";
3583 components.push_back(
irept(
"::"));
3589 std::cout << std::string(__indent,
' ') <<
"Parser::rName 7\n";
3597 components.push_back(
irept(
"~"));
3603 std::cout << std::string(__indent,
' ') <<
"Parser::rName 8\n";
3607 components.push_back(
irept(ID_operator));
3610 components.push_back(
irept());
3663 operator_id = std::string(1,
static_cast<char>(t));
3666 case TOK_MULTASSIGN: operator_id=
"*=";
break;
3667 case TOK_DIVASSIGN: operator_id=
"/=";
break;
3668 case TOK_MODASSIGN: operator_id=
"%=";
break;
3669 case TOK_PLUSASSIGN: operator_id=
"+=";
break;
3670 case TOK_MINUSASSIGN: operator_id=
"-=";
break;
3671 case TOK_SHLASSIGN: operator_id=
"<<=";
break;
3672 case TOK_SHRASSIGN: operator_id=
">>=";
break;
3673 case TOK_ANDASSIGN: operator_id=
"&=";
break;
3674 case TOK_XORASSIGN: operator_id=
"^=";
break;
3675 case TOK_ORASSIGN: operator_id=
"|=";
break;
3676 case TOK_SHIFTLEFT: operator_id=
"<<";
break;
3677 case TOK_SHIFTRIGHT: operator_id=
">>";
break;
3678 case TOK_EQ: operator_id=
"==";
break;
3679 case TOK_NE: operator_id=
"!=";
break;
3680 case TOK_LE: operator_id=
"<=";
break;
3681 case TOK_GE: operator_id=
">=";
break;
3682 case TOK_ANDAND: operator_id=
"&&";
break;
3683 case TOK_OROR: operator_id=
"||";
break;
3684 case TOK_INCR: operator_id=
"++";
break;
3685 case TOK_DECR: operator_id=
"--";
break;
3686 case TOK_DOTPM: operator_id=
".*";
break;
3687 case TOK_ARROWPM: operator_id=
"->*";
break;
3688 case TOK_ARROW: operator_id=
"->";
break;
3697 name=
irept(t==TOK_NEW?ID_cpp_new:ID_cpp_delete);
3702 name=
irept(t==TOK_NEW?ID_cpp_new_array:ID_cpp_delete_array);
3729 assert(!operator_id.
empty());
3731 name=
irept(operator_id);
3745 typet cv1, cv2, type_name, ptr;
3760 if(!
rName(type_name))
3787 std::cout << std::string(__indent,
' ') <<
"Parser::rPtrToMember 0\n";
3790 typet ptm(ID_frontend_pointer);
3791 irept &name = ptm.
add(ID_to_member);
3801 bool loop_cond =
true;
3821 components.push_back(
irept(ID_template_args));
3822 components.back().
add(ID_arguments).
swap(args);
3829 case TOK_IDENTIFIER:
3836 if(t!=TOK_SCOPE && t!=
'<')
3843 components.push_back(
irept(
"::"));
3850 ptr_to_mem.
swap(ptm);
3853 std::cout << std::string(__indent,
' ') <<
"Parser::rPtrToMember 1\n";
3884 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 0\n";
3895 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 1\n";
3907 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 2\n";
3916 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 3\n";
3931 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 4\n";
3943 exp.
id(ID_ambiguous);
3945 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 4.1\n";
3957 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 4.2\n";
3964 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 5\n";
3982 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 6\n";
3986 template_args.
get_sub().back().swap(exp);
3998 case TOK_SHIFTRIGHT:
4079 else if(t==TOK_ELLIPSIS)
4091 list.
get_sub().back().swap(declaration);
4095 else if(t==TOK_ELLIPSIS)
4100 else if(t!=
')' && t!=TOK_ELLIPSIS)
4129 header=
typet(ID_register);
4147 declaration.
declarators().push_back(arg_declarator);
4177 expr.
id(ID_initializer_list);
4186 if(t==TOK_MSC_IF_EXISTS ||
4187 t==TOK_MSC_IF_NOT_EXISTS)
4297 std::cout << std::string(__indent,
' ') <<
"Parser::rEnumSpec 1\n";
4314 spec.
set(ID_C_class,
true);
4331 std::cout << std::string(__indent,
' ') <<
"Parser::rEnumSpec 2\n";
4343 std::cout << std::string(__indent,
' ') <<
"Parser::rEnumSpec 3\n";
4366 std::cout << std::string(__indent,
' ') <<
"Parser::rEnumSpec 4\n";
4438 std::cout << std::string(__indent,
' ') <<
"Parser::rClassSpec 1\n";
4442 if(t!=TOK_CLASS && t!=TOK_STRUCT &&
4443 t!=TOK_UNION && t!=TOK_INTERFACE)
4447 std::cout << std::string(__indent,
' ') <<
"Parser::rClassSpec 2\n";
4452 spec=
typet(ID_struct);
4453 spec.
set(ID_C_class,
true);
4455 else if(t==TOK_INTERFACE)
4457 spec=
typet(ID_struct);
4458 spec.
set(ID_C_interface,
true);
4460 else if(t==TOK_STRUCT)
4461 spec=
typet(ID_struct);
4462 else if(t==TOK_UNION)
4463 spec=
typet(ID_union);
4470 std::cout << std::string(__indent,
' ') <<
"Parser::rClassSpec 3\n";
4477 std::cout << std::string(__indent,
' ') <<
"Parser::rClassSpec 4\n";
4501 std::cout << std::string(__indent,
' ') <<
"Parser::rClassSpec 5\n";
4521 std::cout << std::string(__indent,
' ') <<
"Parser::rClassSpec 6\n";
4533 std::cout << std::string(__indent,
' ') <<
"Parser::rClassSpec 7\n";
4557 irept base(ID_base);
4562 base.
set(ID_virtual,
true);
4566 if(t==TOK_PUBLIC || t==TOK_PROTECTED || t==TOK_PRIVATE)
4571 base.
set(ID_protection, ID_public);
4575 base.
set(ID_protection, ID_protected);
4579 base.
set(ID_protection, ID_private);
4592 base.
set(ID_virtual,
true);
4606 bases.
get_sub().back().swap(base);
4624 std::cout << std::string(__indent,
' ') <<
"Parser::rClassBody 0\n";
4649 std::cout << std::string(__indent,
' ') <<
"Parser::rClassBody "
4650 << member.
pretty() <<
'\n';
4654 std::move(
static_cast<exprt &
>(
static_cast<irept &
>(member))));
4686 std::cout << std::string(__indent,
' ') <<
"Parser::rClassMember 0 " << t
4690 if(t==TOK_PUBLIC || t==TOK_PROTECTED || t==TOK_PRIVATE)
4695 member.
id(
"cpp-public");
4699 member.
id(
"cpp-protected");
4703 member.
id(
"cpp-private");
4719 else if(t==TOK_TYPEDEF)
4721 else if(t==TOK_TEMPLATE)
4723 else if(t==TOK_USING &&
4727 else if(t==TOK_USING)
4729 else if(t==TOK_STATIC_ASSERT)
4758 name_decl.
name() = name;
4775 std::cout << std::string(__indent,
' ') <<
"Parser::rCommaExpression 0\n";
4782 std::cout << std::string(__indent,
' ') <<
"Parser::rCommaExpression 1\n";
4798 exp=
exprt(ID_comma);
4804 std::cout << std::string(__indent,
' ') <<
"Parser::rCommaExpression 2\n";
4820 std::cout << std::string(__indent,
' ') <<
"Parser::rExpression 0\n";
4827 std::cout << std::string(__indent,
' ') <<
"Parser::rExpression 1\n";
4833 t==TOK_MULTASSIGN || t==TOK_DIVASSIGN || t==TOK_MODASSIGN ||
4834 t==TOK_PLUSASSIGN || t==TOK_MINUSASSIGN || t==TOK_SHLASSIGN ||
4835 t==TOK_SHRASSIGN || t==TOK_ANDASSIGN ||
4836 t==TOK_XORASSIGN || t==TOK_ORASSIGN)
4841 std::cout << std::string(__indent,
' ') <<
"Parser::rExpression 2\n";
4849 std::cout << std::string(__indent,
' ') <<
"Parser::rExpression 3\n";
4855 exp=
exprt(ID_side_effect);
4858 exp.
set(ID_statement, ID_assign);
4859 else if(t==TOK_PLUSASSIGN)
4860 exp.
set(ID_statement, ID_assign_plus);
4861 else if(t==TOK_MINUSASSIGN)
4862 exp.
set(ID_statement, ID_assign_minus);
4863 else if(t==TOK_MULTASSIGN)
4864 exp.
set(ID_statement, ID_assign_mult);
4865 else if(t==TOK_DIVASSIGN)
4866 exp.
set(ID_statement, ID_assign_div);
4867 else if(t==TOK_MODASSIGN)
4868 exp.
set(ID_statement, ID_assign_mod);
4869 else if(t==TOK_SHLASSIGN)
4870 exp.
set(ID_statement, ID_assign_shl);
4871 else if(t==TOK_SHRASSIGN)
4872 exp.
set(ID_statement, ID_assign_shr);
4873 else if(t==TOK_ANDASSIGN)
4874 exp.
set(ID_statement, ID_assign_bitand);
4875 else if(t==TOK_XORASSIGN)
4876 exp.
set(ID_statement, ID_assign_bitxor);
4877 else if(t==TOK_ORASSIGN)
4878 exp.
set(ID_statement, ID_assign_bitor);
4885 std::cout << std::string(__indent,
' ') <<
"Parser::rExpression 4\n";
4899 std::cout << std::string(__indent,
' ') <<
"Parser::rConditionalExpr 0\n";
4906 std::cout << std::string(__indent,
' ') <<
"Parser::rConditionalExpr 1\n";
4912 exprt then, otherwise;
4919 std::cout << std::string(__indent,
' ') <<
"Parser::rConditionalExpr 2\n";
4932 if_exprt(std::move(cond), std::move(then), std::move(otherwise),
typet());
4948 std::cout << std::string(__indent,
' ') <<
"Parser::rLogicalOrExpr 0\n";
4955 std::cout << std::string(__indent,
' ') <<
"Parser::rLogicalOrExpr 1\n";
4987 std::cout << std::string(__indent,
' ') <<
"Parser::rLogicalAndExpr 1\n";
4994 std::cout << std::string(__indent,
' ') <<
"Parser::rLogicalAndExpr 1\n";
5026 std::cout << std::string(__indent,
' ') <<
"Parser::rInclusiveOrExpr 0\n";
5033 std::cout << std::string(__indent,
' ') <<
"Parser::rInclusiveOrExpr 1\n";
5048 exp=
exprt(ID_bitor);
5065 std::cout << std::string(__indent,
' ') <<
"Parser::rExclusiveOrExpr 0\n";
5072 std::cout << std::string(__indent,
' ') <<
"Parser::rExclusiveOrExpr 1\n";
5081 if(!
rAndExpr(right, template_args))
5087 exp=
exprt(ID_bitxor);
5104 std::cout << std::string(__indent,
' ') <<
"Parser::rAndExpr 0\n";
5111 std::cout << std::string(__indent,
' ') <<
"Parser::rAndExpr 1\n";
5126 exp=
exprt(ID_bitand);
5143 std::cout << std::string(__indent,
' ') <<
"Parser::rEqualityExpr 0\n";
5150 std::cout << std::string(__indent,
' ') <<
"Parser::rEqualityExpr 1\n";
5166 exp=
exprt(tk.
kind==TOK_EQ?ID_equal:ID_notequal);
5183 std::cout << std::string(__indent,
' ') <<
"Parser::rRelationalExpr 0\n";
5190 std::cout << std::string(__indent,
' ') <<
"Parser::rRelationalExpr 1\n";
5196 (t==TOK_LE || t==TOK_GE || t==
'<' || (t==
'>' && !template_args)))
5212 case TOK_LE:
id=ID_le;
break;
5213 case TOK_GE:
id=ID_ge;
break;
5214 case '<':
id=ID_lt;
break;
5215 case '>':
id=ID_gt;
break;
5235 std::cout << std::string(__indent,
' ') <<
"Parser::rShiftExpr 0\n";
5242 std::cout << std::string(__indent,
' ') <<
"Parser::rShiftExpr 1\n";
5258 exp=
exprt((tk.
kind==TOK_SHIFTRIGHT)?ID_shr:ID_shl);
5275 std::cout << std::string(__indent,
' ') <<
"Parser::rAdditiveExpr 0\n";
5282 std::cout << std::string(__indent,
' ') <<
"Parser::rAdditiveExpr 1\n";
5301 case '+':
id=ID_plus;
break;
5302 case '-':
id=ID_minus;
break;
5322 std::cout << std::string(__indent,
' ') <<
"Parser::rMultiplyExpr 0\n";
5329 std::cout << std::string(__indent,
' ') <<
"Parser::rMultiplyExpr 1\n";
5333 while(t=
lex.
LookAhead(0), (t==
'*' || t==
'/' || t==
'%'))
5348 case '*':
id=ID_mult;
break;
5349 case '/':
id=ID_div;
break;
5350 case '%':
id=ID_mod;
break;
5359 std::cout << std::string(__indent,
' ') <<
"Parser::rMultiplyExpr 2\n";
5375 std::cout << std::string(__indent,
' ') <<
"Parser::rPmExpr 0\n";
5382 std::cout << std::string(__indent,
' ') <<
"Parser::rPmExpr 1\n";
5398 exp =
exprt(ID_pointer_to_member);
5404 std::cout << std::string(__indent,
' ') <<
"Parser::rPmExpr 2\n";
5419 std::cout << std::string(__indent,
' ') <<
"Parser::rCastExpr 0\n";
5435 std::cout << std::string(__indent,
' ') <<
"Parser::rCastExpr 1\n";
5456 exp=
exprt(
"explicit-typecast");
5479 std::cout << std::string(__indent,
' ') <<
"Parser::rTypeName 0\n";
5488 std::cout << std::string(__indent,
' ') <<
"Parser::rTypeName 1\n";
5508 std::cout << std::string(__indent,
' ') <<
"Parser::rTypeName 2\n";
5523 std::cout << std::string(__indent,
' ')
5524 <<
"Parser::rTypeNameOrFunctionType 0\n";
5532 std::cout << std::string(__indent,
' ')
5533 <<
"Parser::rTypeNameOrFunctionType 1\n";
5545 std::cout << std::string(__indent,
' ')
5546 <<
"Parser::rTypeNameOrFunctionType 2\n";
5554 std::cout << std::string(__indent,
' ')
5555 <<
"Parser::rTypeNameOrFunctionType 3\n";
5560 tname.
swap(return_type);
5569 std::cout << std::string(__indent,
' ')
5570 <<
"Parser::rTypeNameOrFunctionType 4\n";
5597 type.set(ID_identifier, op.data.get(ID_C_base_name));
5608 type.set(ID_identifier, op.data.get(ID_C_base_name));
5618 std::cout << std::string(__indent,
' ')
5619 <<
"Parser::rTypeNameOrFunctionType 5\n";
5625 else if(t==TOK_ELLIPSIS)
5629 type.make_ellipsis();
5638 parameter.
swap(parameter_declaration);
5639 type.parameters().push_back(parameter);
5647 else if(t==TOK_ELLIPSIS)
5653 type.make_ellipsis();
5661 std::cout << std::string(__indent,
' ')
5662 <<
"Parser::rTypeNameOrFunctionType 6\n";
5673 std::cout << std::string(__indent,
' ')
5674 <<
"Parser::rTypeNameOrFunctionType 7\n";
5684 std::cout << std::string(__indent,
' ')
5685 <<
"Parser::rTypeNameOrFunctionType 8\n";
5707 std::cout << std::string(__indent,
' ') <<
"Parser::rUnaryExpr 0\n";
5710 if(t==
'*' || t==
'&' || t==
'+' ||
5711 t==
'-' || t==
'!' || t==
'~' ||
5712 t==TOK_INCR || t==TOK_DECR)
5718 std::cout << std::string(__indent,
' ') <<
"Parser::rUnaryExpr 1\n";
5726 std::cout << std::string(__indent,
' ') <<
"Parser::rUnaryExpr 2\n";
5732 exp=
exprt(ID_dereference);
5736 exp=
exprt(ID_address_of);
5740 exp=
exprt(ID_unary_plus);
5744 exp=
exprt(ID_unary_minus);
5752 exp=
exprt(ID_bitnot);
5756 exp=
exprt(ID_side_effect);
5757 exp.
set(ID_statement, ID_preincrement);
5761 exp=
exprt(ID_side_effect);
5762 exp.
set(ID_statement, ID_predecrement);
5774 else if(t==TOK_SIZEOF)
5776 else if(t==TOK_ALIGNOF)
5778 else if(t==TOK_THROW)
5780 else if(t==TOK_NOEXCEPT)
5782 else if(t==TOK_REAL || t==TOK_IMAG)
5793 exp=
exprt(t==TOK_REAL?ID_complex_real:ID_complex_imag);
5814 std::cout << std::string(__indent,
' ') <<
"Parser::rThrowExpr 0\n";
5825 if(t==
':' || t==
';')
5853 std::cout << std::string(__indent,
' ') <<
"Parser::rTypeidExpr 0\n";
5875 exp =
exprt(ID_typeid);
5894 exp =
exprt(ID_typeid);
5919 std::cout << std::string(__indent,
' ') <<
"Parser::rSizeofExpr 0\n";
5937 exp=
exprt(ID_sizeof);
5938 exp.
add(ID_type_arg).
swap(tname);
5959 exp=
exprt(ID_sizeof);
5960 exp.
add(ID_type_arg).
swap(tname);
5974 exp=
exprt(ID_sizeof);
6003 exp=
exprt(ID_alignof);
6004 exp.
add(ID_type_arg).
swap(tname);
6019 std::cout << std::string(__indent,
' ') <<
"Parser::rNoexceptExpr 0\n";
6037 exp=
exprt(ID_noexcept);
6055 return t==TOK_NEW || t==TOK_DELETE;
6070 std::cout << std::string(__indent,
' ') <<
"Parser::rAllocateExpr 0\n";
6081 std::cout << std::string(__indent,
' ') <<
"Parser::rAllocateExpr 1\n";
6087 std::cout << std::string(__indent,
' ') <<
"Parser::rAllocateExpr 2\n";
6101 exp=
exprt(ID_side_effect);
6102 exp.
set(ID_statement, ID_cpp_delete_array);
6106 exp=
exprt(ID_side_effect);
6107 exp.
set(ID_statement, ID_cpp_delete);
6122 std::cout << std::string(__indent,
' ') <<
"Parser::rAllocateExpr 3\n";
6125 exp=
exprt(ID_side_effect);
6126 exp.
set(ID_statement, ID_cpp_new);
6129 exprt arguments, initializer;
6135 std::cout << std::string(__indent,
' ') <<
"Parser::rAllocateExpr 4\n";
6138 exp.
add(ID_initializer).
swap(initializer);
6270 decl.
swap(array_type);
6341 std::cout << std::string(__indent,
' ') <<
"Parser::rPostfixExpr 0\n";
6348 std::cout << std::string(__indent,
' ') <<
"Parser::rPostfixExpr 1\n";
6365 std::cout << std::string(__indent,
' ') <<
"Parser::rPostfixExpr 2\n";
6375 exp=
exprt(ID_index);
6383 std::cout << std::string(__indent,
' ') <<
"Parser::rPostfixExpr 3\n";
6394 std::cout << std::string(__indent,
' ') <<
"Parser::rPostfixExpr 4\n";
6404 fc.arguments().push_back(*it);
6437 std::cout << std::string(__indent,
' ') <<
"Parser::rPostfixExpr 5\n";
6444 std::cout << std::string(__indent,
' ') <<
"Parser::rPostfixExpr 6\n";
6452 exp=
exprt(ID_member);
6454 exp=
exprt(ID_ptrmember);
6460 exp.
add(ID_component_cpp_name).
swap(e);
6496 expr=
exprt(ID_msc_uuidof);
6497 expr.
add(ID_type_arg).
swap(tname);
6514 expr=
exprt(ID_msc_uuidof);
6531 if(tk1.
kind!=TOK_MSC_IF_EXISTS &&
6532 tk1.
kind!=TOK_MSC_IF_NOT_EXISTS)
6560 tk1.
kind==TOK_MSC_IF_EXISTS?ID_msc_if_exists:
6561 ID_msc_if_not_exists);
6576 if(tk1.
kind != TOK_MSC_IF_EXISTS && tk1.
kind != TOK_MSC_IF_NOT_EXISTS)
6600 block.
add(std::move(*statement));
6609 tk1.
kind == TOK_MSC_IF_EXISTS ? ID_msc_if_exists : ID_msc_if_not_exists);
6615 return std::move(code);
6634 typet tname1, tname2;
6638 case TOK_UNARY_TYPE_PREDICATE:
6645 expr.
add(ID_type_arg).
swap(tname1);
6648 case TOK_BINARY_TYPE_PREDICATE:
6659 expr.
add(
"type_arg1").
swap(tname1);
6660 expr.
add(
"type_arg2").
swap(tname2);
6693 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 0 "
6706 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 1\n";
6715 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 2\n";
6721 exp=
exprt(
"cpp-this");
6724 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 3\n";
6733 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 4\n";
6742 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 5\n";
6752 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 6\n";
6758 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 7\n";
6766 exp =
exprt(ID_side_effect);
6767 exp.
set(ID_statement, ID_statement_expression);
6785 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 8\n";
6795 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 9\n";
6801 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 10\n";
6808 case TOK_UNARY_TYPE_PREDICATE:
6809 case TOK_BINARY_TYPE_PREDICATE:
6811 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 11\n";
6815 case TOK_MSC_UUIDOF:
6817 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 12\n";
6823 case TOK_MSC_IF_EXISTS:
6824 case TOK_MSC_IF_NOT_EXISTS:
6826 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 13\n";
6832 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 14\n";
6841 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 15\n";
6854 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 16\n";
6864 exp=
exprt(
"explicit-constructor-call");
6880 exp=
exprt(
"explicit-constructor-call");
6904 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 17\n";
6925 std::cout << std::string(__indent,
' ') <<
"Parser::rVarName 0\n";
6938 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 0\n";
6948 name.
set(ID_typename,
true);
6958 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 1\n";
6966 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 1.1 "
6976 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 2\n";
6984 case TOK_IDENTIFIER:
6986 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 3\n";
6999 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 4\n";
7009 components.push_back(
irept(ID_template_args));
7010 components.back().add(ID_arguments).swap(args);
7019 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 5\n";
7023 components.push_back(
irept(
"::"));
7029 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 6\n";
7037 components.push_back(
irept(
"~"));
7043 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 7\n";
7048 components.push_back(
irept(ID_operator));
7056 components.push_back(op);
7071 if(t==TOK_IDENTIFIER || t==
'~' || t==TOK_OPERATOR || t==TOK_TEMPLATE)
7090 std::cout << std::string(__indent,
' ') <<
"Parser::maybeTemplateArgs 0\n";
7099 if(u==
'\0' || u==
';' || u==
'}')
7101 else if((u==
'>' || u==TOK_SHIFTRIGHT) &&
7112 std::cout << std::string(__indent,
' ')
7113 <<
"Parser::maybeTemplateArgs 1\n";
7119 std::cout << std::string(__indent,
' ')
7120 <<
"Parser::maybeTemplateArgs 2\n";
7135 std::cout << std::string(__indent,
' ')
7136 <<
"Parser::maybeTemplateArgs 3\n";
7143 else if(v==
'\0' || v==
';' || v==
'}')
7147 else if(u==
'\0' || u==
';' || u==
'}')
7149 else if(u==TOK_SHIFTRIGHT && n>=2)
7153 std::cout << std::string(__indent,
' ')
7154 <<
"Parser::maybeTemplateArgs 4\n";
7159 std::cout << std::string(__indent,
' ') <<
"Parser::maybeTemplateArgs 5\n";
7165 std::cout << std::string(__indent,
' ') <<
"Parser::maybeTemplateArgs 6\n";
7168 return t==TOK_SCOPE || t==
'(';
7173 std::cout << std::string(__indent,
' ') <<
"Parser::maybeTemplateArgs 7\n";
7204 declarator.
value()=body;
7214 declarator.
value() = std::move(*body);
7237 std::cout << std::string(__indent,
' ') <<
"Parser::rCompoundStatement 1\n";
7244 std::cout << std::string(__indent,
' ') <<
"Parser::rCompoundStatement 2\n";
7253 statement.
add(std::move(*statement2));
7261 return std::move(statement);
7268 return std::move(statement);
7299 std::cout << std::string(__indent,
' ') <<
"Parser::rStatement 0 "
7340 codet statement(k == TOK_BREAK ? ID_break : ID_continue);
7346 return std::move(statement);
7351 std::cout << std::string(__indent,
' ') <<
"Parser::rStatement RETURN 0\n";
7362 std::cout << std::string(__indent,
' ')
7363 <<
"Parser::rStatement RETURN 1\n";
7370 std::cout << std::string(__indent,
' ')
7371 <<
"Parser::rStatement RETURN 2\n";
7378 std::cout << std::string(__indent,
' ')
7379 <<
"Parser::rStatement RETURN 3\n";
7386 return std::move(statement);
7401 return std::move(statement);
7427 std::move(case_expr), std::move(range_end), std::move(*statement2));
7429 return std::move(code);
7442 std::move(case_expr), std::move(*statement2));
7444 return std::move(statement);
7463 return std::move(statement);
7475 case TOK_MSC_IF_EXISTS:
7476 case TOK_MSC_IF_NOT_EXISTS:
7479 case TOK_IDENTIFIER:
7491 return std::move(label);
7510 return std::move(statement);
7521 case TOK_STATIC_ASSERT:
7528 codet statement(ID_static_assert);
7530 statement.
operands().swap(cpp_static_assert.operands());
7532 return std::move(statement);
7562 if(!then.has_value())
7572 std::move(exp), std::move(*then), std::move(*otherwise));
7574 return std::move(statement);
7583 return std::move(statement);
7610 code_switcht statement(std::move(exp), std::move(*body));
7612 return std::move(statement);
7641 code_whilet statement(std::move(exp), std::move(*body));
7643 return std::move(statement);
7661 if(!body.has_value())
7682 return std::move(statement);
7702 if(!exp1.has_value())
7732 std::move(*exp1), std::move(exp2), std::move(exp3), std::move(*body));
7734 return std::move(statement);
7756 if(!try_body.has_value())
7779 codet ellipsis(ID_ellipsis);
7781 catch_op = std::move(ellipsis);
7793 if(declaration.
declarators().front().name().is_nil())
7800 catch_op = std::move(code_decl);
7819 return std::move(statement);
7834 if(!body1.has_value())
7839 codet statement(ID_msc_try_except);
7859 std::move(*body1), std::move(exp), std::move(*body2));
7860 return std::move(statement);
7867 codet statement(ID_msc_try_finally);
7875 return std::move(statement);
7894 codet statement(ID_msc_leave);
7897 return std::move(statement);
7906 std::cout << std::string(__indent,
' ') <<
"Parser::rGCCAsmStatement 1\n";
7921 std::cout << std::string(__indent,
' ') <<
"Parser::rGCCAsmStatement 3\n";
7932 std::cout << std::string(__indent,
' ') <<
"Parser::rGCCAsmStatement 3\n";
7938 std::cout << std::string(__indent,
' ') <<
"Parser::rGCCAsmStatement 4\n";
7959 std::cout << std::string(__indent,
' ')
7960 <<
"Parser::rGCCAsmStatement 5\n";
7968 std::cout << std::string(__indent,
' ')
7969 <<
"Parser::rGCCAsmStatement 6\n";
7984 std::cout << std::string(__indent,
' ') <<
"Parser::rGCCAsmStatement 7\n";
7993 std::cout << std::string(__indent,
' ') <<
"Parser::rGCCAsmStatement 8\n";
7996 return std::move(statement);
8005 std::cout << std::string(__indent,
' ') <<
"Parser::rMSCAsmStatement 1\n";
8019 std::cout << std::string(__indent,
' ') <<
"Parser::rMSCAsmStatement 2\n";
8027 std::cout << std::string(__indent,
' ') <<
"Parser::rMSCAsmStatement 3\n";
8040 std::cout << std::string(__indent,
' ') <<
"Parser::rMSCAsmStatement 4\n";
8046 std::cout << std::string(__indent,
' ') <<
"Parser::rMSCAsmStatement 5\n";
8050 return std::move(statement);
8056 std::cout << std::string(__indent,
' ') <<
"Parser::rMSCAsmStatement 6\n";
8061 std::cout << std::string(__indent,
' ') <<
"Parser::rMSCAsmStatement 7\n";
8064 return std::move(statement);
8081 std::cout << std::string(__indent,
' ') <<
"Parser::rExprStatement 0\n";
8087 std::cout << std::string(__indent,
' ') <<
"Parser::rExprStatement 1\n";
8093 return std::move(statement);
8098 std::cout << std::string(__indent,
' ') <<
"Parser::rExprStatement 2\n";
8106 std::cout << std::string(__indent,
' ') <<
"rDe " << statement->pretty()
8118 std::cout << std::string(__indent,
' ') <<
"Parser::rExprStatement 3\n";
8125 std::cout << std::string(__indent,
' ') <<
"Parser::rExprStatement 4\n";
8129 std::cout << std::string(__indent,
' ') <<
"Parser::rExprStatement 5 "
8137 std::cout << std::string(__indent,
' ') <<
"Parser::rExprStatement 6\n";
8142 return std::move(expr_statement);
8157 statement=
codet(ID_decl);
8189 typet cv_q, integral;
8194 std::cout << std::string(__indent,
' ')
8195 <<
"Parser::rDeclarationStatement 1\n";
8217 std::cout << std::string(__indent,
' ')
8218 <<
"Parser::rDeclarationStatement 2\n";
8228 std::cout << std::string(__indent,
' ')
8229 <<
"Parser::rDeclarationStatement 3 " << t <<
'\n';
8233 ((t==TOK_IDENTIFIER &&
lex.
LookAhead(1)==
'=') || t==
'*'))
8236 std::cout << std::string(__indent,
' ')
8237 <<
"Parser::rDeclarationStatement 4\n";
8277 return std::move(statement);
8290 return std::move(statement);
8306 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclStatement 1\n";
8309 if(!
rName(type_name))
8313 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclStatement 2\n";
8320 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclStatement 3\n";
8326 declaration.
type().
swap(type_name);
8333 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclStatement 4\n";
8342 return std::move(statement);
8357 if(t==token || t==
'\0')