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().add_subtype().is_not_nil())
1609 declaration.
type() =
1612 declaration.
declarators().front().type().add_subtype().make_nil();
1616 std::cout << std::string(__indent,
' ')
1617 <<
"Parser::rIntegralDeclaration 7\n";
1623 std::cout << std::string(__indent,
' ')
1624 <<
"Parser::rIntegralDeclaration 8 "
1625 << declaration.
pretty() <<
'\n';
1633 std::cout << std::string(__indent,
' ')
1634 <<
"Parser::rIntegralDeclaration 9\n";
1644 std::cout << std::string(__indent,
' ')
1645 <<
"Parser::rIntegralDeclaration 10\n";
1657 std::cout << std::string(__indent,
' ') <<
"Parser::rConstDeclaration\n";
1682 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 1\n";
1685 if(!
rName(type_name))
1691 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 2\n";
1705 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 3\n";
1714 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 4\n";
1717 assert(!type_name.
get_sub().empty());
1719 for(std::size_t i=0; i < type_name.
get_sub().size(); i++)
1721 if(type_name.
get_sub()[i].id() == ID_operator)
1732 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 5\n";
1736 typet type = type_name;
1740 typet trailing_return_type;
1742 conv_operator_declarator, type_name, trailing_return_type))
1745 type_name=
typet(
"cpp-cast-operator");
1747 declaration.
declarators().push_back(conv_operator_declarator);
1752 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 6\n";
1755 assert(!type_name.
get_sub().empty());
1757 bool is_destructor=
false;
1758 for(
const auto &irep : type_name.
get_sub())
1760 if(irep.id() ==
"~")
1768 typet trailing_return_type;
1770 constructor_declarator, type_name, trailing_return_type))
1774 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 7\n";
1779 type_name=trailing_return_type;
1781 type_name=
typet(is_destructor?ID_destructor:ID_constructor);
1783 declaration.
declarators().push_back(constructor_declarator);
1788 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 8\n";
1806 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 9\n";
1818 declaration.
type().
swap(type_name);
1823 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 10\n";
1829 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 11\n";
1838 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 12\n";
1862 std::cout << std::string(__indent,
' ') <<
"Parser::isConstructorDecl "
1871 if(t==
'*' || t==
'&' || t==
'(')
1873 else if(t==TOK_STDCALL || t==TOK_FASTCALL || t==TOK_CLRCALL || t==TOK_CDECL)
1877 else if(t==TOK_IDENTIFIER)
1901 while(t0==TOK_IDENTIFIER)
1924 else if(v==
'\0' || v==
';' || v==
'}')
1928 else if(u==
'\0' || u==
';' || u==
'}')
1953 member_spec.
clear();
1958 t == TOK_FRIEND || t == TOK_INLINE || t == TOK_VIRTUAL ||
1959 t == TOK_EXPLICIT || t == TOK_MSC_FORCEINLINE)
1967 case TOK_MSC_FORCEINLINE:
1970 case TOK_VIRTUAL: member_spec.
set_virtual(
true);
break;
1971 case TOK_FRIEND: member_spec.
set_friend(
true);
break;
1972 case TOK_EXPLICIT: member_spec.
set_explicit(
true);
break;
1996 t==TOK_THREAD_LOCAL)
2003 case TOK_STATIC: storage_spec.
set_static();
break;
2004 case TOK_EXTERN: storage_spec.
set_extern();
break;
2005 case TOK_AUTO: storage_spec.
set_auto();
break;
2007 case TOK_MUTABLE: storage_spec.
set_mutable();
break;
2008 case TOK_GCC_ASM: storage_spec.
set_asm();
break;
2027 if(t==TOK_CONSTEXPR ||
2028 t==TOK_CONST || t==TOK_VOLATILE || t==TOK_RESTRICT ||
2029 t==TOK_PTR32 || t==TOK_PTR64 ||
2030 t==TOK_GCC_ATTRIBUTE || t==TOK_GCC_ASM)
2039 p=
typet(ID_constexpr);
2051 p=
typet(ID_volatile);
2057 p=
typet(ID_restrict);
2074 case TOK_GCC_ATTRIBUTE:
2129 exprt exp(ID_alignof);
2130 exp.
add(ID_type_arg).
swap(tname);
2133 typet attr(ID_aligned);
2135 attr.
add(ID_size, exp);
2152 typet attr(ID_aligned);
2154 attr.
add(ID_size, exp);
2168 std::cout << std::string(__indent,
' ') <<
"Parser::rAttribute "
2185 case TOK_GCC_ATTRIBUTE_PACKED:
2187 typet attr(ID_packed);
2193 case TOK_GCC_ATTRIBUTE_TRANSPARENT_UNION:
2195 typet attr(ID_transparent_union);
2201 case TOK_GCC_ATTRIBUTE_VECTOR_SIZE:
2216 attr.
set(ID_size, exp);
2222 case TOK_GCC_ATTRIBUTE_ALIGNED:
2224 typet attr(ID_aligned);
2241 attr.
add(ID_size, exp);
2248 case TOK_GCC_ATTRIBUTE_MODE:
2262 typet attr(ID_gcc_attribute_mode);
2269 case TOK_GCC_ATTRIBUTE_GNU_INLINE:
2271 typet attr(ID_static);
2277 case TOK_GCC_ATTRIBUTE_WEAK:
2279 typet attr(ID_weak);
2285 case TOK_GCC_ATTRIBUTE_ALIAS:
2298 typet attr(ID_alias);
2305 case TOK_GCC_ATTRIBUTE_SECTION:
2318 typet attr(ID_section);
2325 case TOK_GCC_ATTRIBUTE_NORETURN:
2327 typet attr(ID_noreturn);
2333 case TOK_GCC_ATTRIBUTE_CONSTRUCTOR:
2335 typet attr(ID_constructor);
2341 case TOK_GCC_ATTRIBUTE_DESTRUCTOR:
2343 typet attr(ID_destructor);
2387 typet attr(ID_noreturn);
2414 std::cout << std::string(__indent,
' ')
2415 <<
"Parser::optIntegralTypeOrClassSpec 0\n";
2425 bool is_integral=
false;
2435 std::cout << std::string(__indent,
' ')
2436 <<
"Parser::optIntegralTypeOrClassSpec 1\n";
2443 case TOK_CHAR: type_id=ID_char;
break;
2444 case TOK_CHAR16_T: type_id=ID_char16_t;
break;
2445 case TOK_CHAR32_T: type_id=ID_char32_t;
break;
2446 case TOK_INT: type_id=ID_int;
break;
2447 case TOK_SHORT: type_id=ID_short;
break;
2448 case TOK_LONG: type_id=ID_long;
break;
2449 case TOK_SIGNED: type_id=ID_signed;
break;
2450 case TOK_WCHAR_T: type_id=ID_wchar_t;
break;
2451 case TOK_COMPLEX: type_id=ID_complex;
break;
2452 case TOK_UNSIGNED: type_id=ID_unsigned;
break;
2453 case TOK_FLOAT: type_id=ID_float;
break;
2454 case TOK_DOUBLE: type_id=ID_double;
break;
2455 case TOK_VOID: type_id=ID_void;
break;
2456 case TOK_INT8: type_id=ID_int8;
break;
2457 case TOK_INT16: type_id=ID_int16;
break;
2458 case TOK_INT32: type_id=ID_int32;
break;
2459 case TOK_INT64: type_id=ID_int64;
break;
2460 case TOK_GCC_INT128: type_id=ID_gcc_int128;
break;
2461 case TOK_GCC_FLOAT80: type_id=ID_gcc_float80;
break;
2462 case TOK_GCC_FLOAT128: type_id=ID_gcc_float128;
break;
2464 type_id = ID_c_bool;
2466 case TOK_CPROVER_BOOL: type_id=ID_proper_bool;
break;
2467 case TOK_AUTO: type_id = ID_auto;
break;
2471 if(!type_id.
empty())
2488 std::cout << std::string(__indent,
' ')
2489 <<
"Parser::optIntegralTypeOrClassSpec 2\n";
2496 std::cout << std::string(__indent,
' ')
2497 <<
"Parser::optIntegralTypeOrClassSpec 3\n";
2500 if(t==TOK_CLASS || t==TOK_STRUCT || t==TOK_UNION || t==TOK_INTERFACE)
2502 else if(t==TOK_ENUM)
2504 else if(t==TOK_TYPEOF)
2507 std::cout << std::string(__indent,
' ')
2508 <<
"Parser::optIntegralTypeOrClassSpec 4\n";
2515 std::cout << std::string(__indent,
' ')
2516 <<
"Parser::optIntegralTypeOrClassSpec 5\n";
2536 p.
add(ID_type_arg).
swap(tname);
2545 std::cout << std::string(__indent,
' ')
2546 <<
"Parser::optIntegralTypeOrClassSpec 6\n";
2554 std::cout << std::string(__indent,
' ')
2555 <<
"Parser::optIntegralTypeOrClassSpec 7\n";
2562 std::cout << std::string(__indent,
' ')
2563 <<
"Parser::optIntegralTypeOrClassSpec 8\n";
2566 p.
add(ID_expr_arg).
swap(expr);
2570 else if(t==TOK_DECLTYPE)
2575 p=
typet(ID_decltype);
2591 p.
add(ID_expr_arg).
swap(expr);
2595 else if(t==TOK_UNDERLYING_TYPE)
2602 p=
typet(ID_msc_underlying_type);
2619 p.
add(ID_type_arg).
swap(tname);
2638 typet &trailing_return_type)
2642 std::cout << std::string(__indent,
' ') <<
"Parser::rConstructorDecl 0\n";
2649 constructor.
name().
swap(type_name);
2656 std::cout << std::string(__indent,
' ') <<
"Parser::rConstructorDecl 1\n";
2659 irept ¶meters=constructor.
type().
add(ID_parameters);
2669 std::cout << std::string(__indent,
' ') <<
"Parser::rConstructorDecl 2\n";
2672 typet &cv=
static_cast<typet &
>(constructor.
add(ID_method_qualifier));
2681 std::cout << std::string(__indent,
' ') <<
"Parser::rConstructorDecl 3\n";
2693 std::cout << std::string(__indent,
' ') <<
"Parser::rConstructorDecl 4\n";
2707 std::cout << std::string(__indent,
' ') <<
"Parser::rConstructorDecl 5\n";
2719 constructor.
value()=
codet(
"cpp-pure-virtual");
2789 else if(t==TOK_ELLIPSIS)
2835 bool should_be_declarator,
2846 declarators.push_back(declarator);
2864 bool should_be_declarator,
2877 typet bit_field_type(ID_c_bit_field);
2878 bit_field_type.
set(ID_size, e);
2891 declarator,
kDeclarator, should_be_declarator, is_statement))
2936 if(declarator.
type().
id()!=ID_function_type)
2952 typet bit_field_type(ID_c_bit_field);
2953 bit_field_type.
set(ID_size, e);
2960 dw.
swap(declarator);
2977 while(t==TOK_STDCALL || t==TOK_FASTCALL || t==TOK_CLRCALL || t==TOK_CDECL)
3007 bool should_be_declarator,
3014 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 1\n";
3021 typet d_outer, d_inner;
3036 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 2\n";
3044 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 3\n";
3055 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 4\n";
3063 if(!should_be_declarator)
3068 if(t!=
'[' && t!=
'(')
3074 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 5\n";
3081 (kind==
kDeclarator || t==TOK_IDENTIFIER || t==TOK_SCOPE))
3084 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 6\n";
3093 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 7\n";
3106 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 8\n";
3126 typet function_type(ID_function_type);
3128 function_type.
add(ID_parameters).
swap(args);
3132 d_outer.
swap(d_inner);
3138 init_args.
swap(args);
3143 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 9\n";
3152 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 10\n";
3173 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 11\n";
3191 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 12\n";
3206 std::list<typet> tl;
3207 tl.push_back(d_outer);
3208 while(tl.back().id() == ID_array)
3210 tl.push_back(tl.back().add_subtype());
3215 d_outer.
swap(array_type);
3218 tl.back().add_subtype().swap(d_outer);
3219 d_outer.
swap(tl.back());
3235 d_outer.
swap(merged_type);
3239 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 13\n";
3265 std::cout << std::string(__indent,
' ') <<
"Parser::optPtrOperator 1\n";
3268 std::list<typet> t_list;
3275 std::cout << std::string(__indent,
' ') <<
"Parser::optPtrOperator 2 " << t
3281 typet op(ID_frontend_pointer);
3292 t_list.push_back(op);
3297 typet op(ID_block_pointer);
3308 t_list.push_back(op);
3322 t_list.push_back(cv);
3325 t_list.push_back(op);
3338 typet op(ID_frontend_pointer);
3339 op.
set(ID_C_reference,
true);
3341 t_list.push_front(op);
3343 else if(t==TOK_ANDAND)
3347 typet op(ID_frontend_pointer);
3348 op.
set(ID_C_rvalue_reference,
true);
3350 t_list.push_front(op);
3354 for(std::list<typet>::reverse_iterator
3359 if(it->id()==ID_merged_type)
3362 merged_type.last_type().add_subtype().swap(ptrs);
3366 assert(it->is_not_nil());
3367 it->add_subtype().swap(ptrs);
3387 init=
irept(ID_member_initializers);
3417 std::cout << std::string(__indent,
' ') <<
"Parser::rMemberInit 1\n";
3426 std::cout << std::string(__indent,
' ') <<
"Parser::rMemberInit 2\n";
3429 init=
codet(ID_member_initializer);
3430 init.
add(ID_member).
swap(name);
3440 std::cout << std::string(__indent,
' ') <<
"Parser::rMemberInit 3\n";
3459 std::cout << std::string(__indent,
' ') <<
"Parser::rMemberInit 4\n";
3499 std::cout << std::string(__indent,
' ') <<
"Parser::rName 0\n";
3509 name.
set(ID_typename,
true);
3519 std::cout << std::string(__indent,
' ') <<
"Parser::rName 1\n";
3527 std::cout << std::string(__indent,
' ') <<
"Parser::rName 2 "
3535 std::cout << std::string(__indent,
' ') <<
"Parser::rName 3\n";
3545 std::cout << std::string(__indent,
' ') <<
"Parser::rName 4\n";
3552 components.push_back(
irept(ID_template_args));
3553 components.back().
add(ID_arguments).
swap(args);
3561 case TOK_IDENTIFIER:
3563 std::cout << std::string(__indent,
' ') <<
"Parser::rName 5\n";
3572 if(t!=TOK_SCOPE && t!=
'<')
3579 std::cout << std::string(__indent,
' ') <<
"Parser::rName 6\n";
3582 components.push_back(
irept(
"::"));
3588 std::cout << std::string(__indent,
' ') <<
"Parser::rName 7\n";
3596 components.push_back(
irept(
"~"));
3602 std::cout << std::string(__indent,
' ') <<
"Parser::rName 8\n";
3606 components.push_back(
irept(ID_operator));
3609 components.push_back(
irept());
3662 operator_id = std::string(1,
static_cast<char>(t));
3665 case TOK_MULTASSIGN: operator_id=
"*=";
break;
3666 case TOK_DIVASSIGN: operator_id=
"/=";
break;
3667 case TOK_MODASSIGN: operator_id=
"%=";
break;
3668 case TOK_PLUSASSIGN: operator_id=
"+=";
break;
3669 case TOK_MINUSASSIGN: operator_id=
"-=";
break;
3670 case TOK_SHLASSIGN: operator_id=
"<<=";
break;
3671 case TOK_SHRASSIGN: operator_id=
">>=";
break;
3672 case TOK_ANDASSIGN: operator_id=
"&=";
break;
3673 case TOK_XORASSIGN: operator_id=
"^=";
break;
3674 case TOK_ORASSIGN: operator_id=
"|=";
break;
3675 case TOK_SHIFTLEFT: operator_id=
"<<";
break;
3676 case TOK_SHIFTRIGHT: operator_id=
">>";
break;
3677 case TOK_EQ: operator_id=
"==";
break;
3678 case TOK_NE: operator_id=
"!=";
break;
3679 case TOK_LE: operator_id=
"<=";
break;
3680 case TOK_GE: operator_id=
">=";
break;
3681 case TOK_ANDAND: operator_id=
"&&";
break;
3682 case TOK_OROR: operator_id=
"||";
break;
3683 case TOK_INCR: operator_id=
"++";
break;
3684 case TOK_DECR: operator_id=
"--";
break;
3685 case TOK_DOTPM: operator_id=
".*";
break;
3686 case TOK_ARROWPM: operator_id=
"->*";
break;
3687 case TOK_ARROW: operator_id=
"->";
break;
3696 name=
irept(t==TOK_NEW?ID_cpp_new:ID_cpp_delete);
3701 name=
irept(t==TOK_NEW?ID_cpp_new_array:ID_cpp_delete_array);
3728 assert(!operator_id.
empty());
3730 name=
irept(operator_id);
3744 typet cv1, cv2, type_name, ptr;
3759 if(!
rName(type_name))
3786 std::cout << std::string(__indent,
' ') <<
"Parser::rPtrToMember 0\n";
3789 typet ptm(ID_frontend_pointer);
3790 irept &name = ptm.
add(ID_to_member);
3800 bool loop_cond =
true;
3820 components.push_back(
irept(ID_template_args));
3821 components.back().
add(ID_arguments).
swap(args);
3828 case TOK_IDENTIFIER:
3835 if(t!=TOK_SCOPE && t!=
'<')
3842 components.push_back(
irept(
"::"));
3849 ptr_to_mem.
swap(ptm);
3852 std::cout << std::string(__indent,
' ') <<
"Parser::rPtrToMember 1\n";
3883 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 0\n";
3894 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 1\n";
3906 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 2\n";
3915 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 3\n";
3930 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 4\n";
3942 exp.
id(ID_ambiguous);
3944 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 4.1\n";
3956 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 4.2\n";
3963 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 5\n";
3981 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 6\n";
3985 template_args.
get_sub().back().swap(exp);
3997 case TOK_SHIFTRIGHT:
4078 else if(t==TOK_ELLIPSIS)
4090 list.
get_sub().back().swap(declaration);
4094 else if(t==TOK_ELLIPSIS)
4099 else if(t!=
')' && t!=TOK_ELLIPSIS)
4128 header=
typet(ID_register);
4146 declaration.
declarators().push_back(arg_declarator);
4176 expr.
id(ID_initializer_list);
4185 if(t==TOK_MSC_IF_EXISTS ||
4186 t==TOK_MSC_IF_NOT_EXISTS)
4296 std::cout << std::string(__indent,
' ') <<
"Parser::rEnumSpec 1\n";
4313 spec.
set(ID_C_class,
true);
4330 std::cout << std::string(__indent,
' ') <<
"Parser::rEnumSpec 2\n";
4342 std::cout << std::string(__indent,
' ') <<
"Parser::rEnumSpec 3\n";
4365 std::cout << std::string(__indent,
' ') <<
"Parser::rEnumSpec 4\n";
4437 std::cout << std::string(__indent,
' ') <<
"Parser::rClassSpec 1\n";
4441 if(t!=TOK_CLASS && t!=TOK_STRUCT &&
4442 t!=TOK_UNION && t!=TOK_INTERFACE)
4446 std::cout << std::string(__indent,
' ') <<
"Parser::rClassSpec 2\n";
4451 spec=
typet(ID_struct);
4452 spec.
set(ID_C_class,
true);
4454 else if(t==TOK_INTERFACE)
4456 spec=
typet(ID_struct);
4457 spec.
set(ID_C_interface,
true);
4459 else if(t==TOK_STRUCT)
4460 spec=
typet(ID_struct);
4461 else if(t==TOK_UNION)
4462 spec=
typet(ID_union);
4469 std::cout << std::string(__indent,
' ') <<
"Parser::rClassSpec 3\n";
4476 std::cout << std::string(__indent,
' ') <<
"Parser::rClassSpec 4\n";
4500 std::cout << std::string(__indent,
' ') <<
"Parser::rClassSpec 5\n";
4520 std::cout << std::string(__indent,
' ') <<
"Parser::rClassSpec 6\n";
4532 std::cout << std::string(__indent,
' ') <<
"Parser::rClassSpec 7\n";
4556 irept base(ID_base);
4561 base.
set(ID_virtual,
true);
4565 if(t==TOK_PUBLIC || t==TOK_PROTECTED || t==TOK_PRIVATE)
4570 base.
set(ID_protection, ID_public);
4574 base.
set(ID_protection, ID_protected);
4578 base.
set(ID_protection, ID_private);
4591 base.
set(ID_virtual,
true);
4605 bases.
get_sub().back().swap(base);
4623 std::cout << std::string(__indent,
' ') <<
"Parser::rClassBody 0\n";
4648 std::cout << std::string(__indent,
' ') <<
"Parser::rClassBody "
4649 << member.
pretty() <<
'\n';
4653 std::move(
static_cast<exprt &
>(
static_cast<irept &
>(member))));
4685 std::cout << std::string(__indent,
' ') <<
"Parser::rClassMember 0 " << t
4689 if(t==TOK_PUBLIC || t==TOK_PROTECTED || t==TOK_PRIVATE)
4694 member.
id(
"cpp-public");
4698 member.
id(
"cpp-protected");
4702 member.
id(
"cpp-private");
4718 else if(t==TOK_TYPEDEF)
4720 else if(t==TOK_TEMPLATE)
4722 else if(t==TOK_USING &&
4726 else if(t==TOK_USING)
4728 else if(t==TOK_STATIC_ASSERT)
4757 name_decl.
name() = name;
4774 std::cout << std::string(__indent,
' ') <<
"Parser::rCommaExpression 0\n";
4781 std::cout << std::string(__indent,
' ') <<
"Parser::rCommaExpression 1\n";
4797 exp=
exprt(ID_comma);
4803 std::cout << std::string(__indent,
' ') <<
"Parser::rCommaExpression 2\n";
4819 std::cout << std::string(__indent,
' ') <<
"Parser::rExpression 0\n";
4826 std::cout << std::string(__indent,
' ') <<
"Parser::rExpression 1\n";
4832 t==TOK_MULTASSIGN || t==TOK_DIVASSIGN || t==TOK_MODASSIGN ||
4833 t==TOK_PLUSASSIGN || t==TOK_MINUSASSIGN || t==TOK_SHLASSIGN ||
4834 t==TOK_SHRASSIGN || t==TOK_ANDASSIGN ||
4835 t==TOK_XORASSIGN || t==TOK_ORASSIGN)
4840 std::cout << std::string(__indent,
' ') <<
"Parser::rExpression 2\n";
4848 std::cout << std::string(__indent,
' ') <<
"Parser::rExpression 3\n";
4854 exp=
exprt(ID_side_effect);
4857 exp.
set(ID_statement, ID_assign);
4858 else if(t==TOK_PLUSASSIGN)
4859 exp.
set(ID_statement, ID_assign_plus);
4860 else if(t==TOK_MINUSASSIGN)
4861 exp.
set(ID_statement, ID_assign_minus);
4862 else if(t==TOK_MULTASSIGN)
4863 exp.
set(ID_statement, ID_assign_mult);
4864 else if(t==TOK_DIVASSIGN)
4865 exp.
set(ID_statement, ID_assign_div);
4866 else if(t==TOK_MODASSIGN)
4867 exp.
set(ID_statement, ID_assign_mod);
4868 else if(t==TOK_SHLASSIGN)
4869 exp.
set(ID_statement, ID_assign_shl);
4870 else if(t==TOK_SHRASSIGN)
4871 exp.
set(ID_statement, ID_assign_shr);
4872 else if(t==TOK_ANDASSIGN)
4873 exp.
set(ID_statement, ID_assign_bitand);
4874 else if(t==TOK_XORASSIGN)
4875 exp.
set(ID_statement, ID_assign_bitxor);
4876 else if(t==TOK_ORASSIGN)
4877 exp.
set(ID_statement, ID_assign_bitor);
4884 std::cout << std::string(__indent,
' ') <<
"Parser::rExpression 4\n";
4898 std::cout << std::string(__indent,
' ') <<
"Parser::rConditionalExpr 0\n";
4905 std::cout << std::string(__indent,
' ') <<
"Parser::rConditionalExpr 1\n";
4911 exprt then, otherwise;
4918 std::cout << std::string(__indent,
' ') <<
"Parser::rConditionalExpr 2\n";
4931 if_exprt(std::move(cond), std::move(then), std::move(otherwise),
typet());
4947 std::cout << std::string(__indent,
' ') <<
"Parser::rLogicalOrExpr 0\n";
4954 std::cout << std::string(__indent,
' ') <<
"Parser::rLogicalOrExpr 1\n";
4986 std::cout << std::string(__indent,
' ') <<
"Parser::rLogicalAndExpr 1\n";
4993 std::cout << std::string(__indent,
' ') <<
"Parser::rLogicalAndExpr 1\n";
5025 std::cout << std::string(__indent,
' ') <<
"Parser::rInclusiveOrExpr 0\n";
5032 std::cout << std::string(__indent,
' ') <<
"Parser::rInclusiveOrExpr 1\n";
5047 exp=
exprt(ID_bitor);
5064 std::cout << std::string(__indent,
' ') <<
"Parser::rExclusiveOrExpr 0\n";
5071 std::cout << std::string(__indent,
' ') <<
"Parser::rExclusiveOrExpr 1\n";
5080 if(!
rAndExpr(right, template_args))
5086 exp=
exprt(ID_bitxor);
5103 std::cout << std::string(__indent,
' ') <<
"Parser::rAndExpr 0\n";
5110 std::cout << std::string(__indent,
' ') <<
"Parser::rAndExpr 1\n";
5125 exp=
exprt(ID_bitand);
5142 std::cout << std::string(__indent,
' ') <<
"Parser::rEqualityExpr 0\n";
5149 std::cout << std::string(__indent,
' ') <<
"Parser::rEqualityExpr 1\n";
5165 exp=
exprt(tk.
kind==TOK_EQ?ID_equal:ID_notequal);
5182 std::cout << std::string(__indent,
' ') <<
"Parser::rRelationalExpr 0\n";
5189 std::cout << std::string(__indent,
' ') <<
"Parser::rRelationalExpr 1\n";
5195 (t==TOK_LE || t==TOK_GE || t==
'<' || (t==
'>' && !template_args)))
5211 case TOK_LE:
id=ID_le;
break;
5212 case TOK_GE:
id=ID_ge;
break;
5213 case '<':
id=ID_lt;
break;
5214 case '>':
id=ID_gt;
break;
5234 std::cout << std::string(__indent,
' ') <<
"Parser::rShiftExpr 0\n";
5241 std::cout << std::string(__indent,
' ') <<
"Parser::rShiftExpr 1\n";
5257 exp=
exprt((tk.
kind==TOK_SHIFTRIGHT)?ID_shr:ID_shl);
5274 std::cout << std::string(__indent,
' ') <<
"Parser::rAdditiveExpr 0\n";
5281 std::cout << std::string(__indent,
' ') <<
"Parser::rAdditiveExpr 1\n";
5300 case '+':
id=ID_plus;
break;
5301 case '-':
id=ID_minus;
break;
5321 std::cout << std::string(__indent,
' ') <<
"Parser::rMultiplyExpr 0\n";
5328 std::cout << std::string(__indent,
' ') <<
"Parser::rMultiplyExpr 1\n";
5332 while(t=
lex.
LookAhead(0), (t==
'*' || t==
'/' || t==
'%'))
5347 case '*':
id=ID_mult;
break;
5348 case '/':
id=ID_div;
break;
5349 case '%':
id=ID_mod;
break;
5358 std::cout << std::string(__indent,
' ') <<
"Parser::rMultiplyExpr 2\n";
5374 std::cout << std::string(__indent,
' ') <<
"Parser::rPmExpr 0\n";
5381 std::cout << std::string(__indent,
' ') <<
"Parser::rPmExpr 1\n";
5397 exp =
exprt(ID_pointer_to_member);
5403 std::cout << std::string(__indent,
' ') <<
"Parser::rPmExpr 2\n";
5418 std::cout << std::string(__indent,
' ') <<
"Parser::rCastExpr 0\n";
5434 std::cout << std::string(__indent,
' ') <<
"Parser::rCastExpr 1\n";
5455 exp=
exprt(
"explicit-typecast");
5478 std::cout << std::string(__indent,
' ') <<
"Parser::rTypeName 0\n";
5487 std::cout << std::string(__indent,
' ') <<
"Parser::rTypeName 1\n";
5507 std::cout << std::string(__indent,
' ') <<
"Parser::rTypeName 2\n";
5522 std::cout << std::string(__indent,
' ')
5523 <<
"Parser::rTypeNameOrFunctionType 0\n";
5531 std::cout << std::string(__indent,
' ')
5532 <<
"Parser::rTypeNameOrFunctionType 1\n";
5544 std::cout << std::string(__indent,
' ')
5545 <<
"Parser::rTypeNameOrFunctionType 2\n";
5553 std::cout << std::string(__indent,
' ')
5554 <<
"Parser::rTypeNameOrFunctionType 3\n";
5559 tname.
swap(return_type);
5568 std::cout << std::string(__indent,
' ')
5569 <<
"Parser::rTypeNameOrFunctionType 4\n";
5596 type.set(ID_identifier, op.data.get(ID_C_base_name));
5607 type.set(ID_identifier, op.data.get(ID_C_base_name));
5617 std::cout << std::string(__indent,
' ')
5618 <<
"Parser::rTypeNameOrFunctionType 5\n";
5624 else if(t==TOK_ELLIPSIS)
5628 type.make_ellipsis();
5637 parameter.
swap(parameter_declaration);
5638 type.parameters().push_back(parameter);
5646 else if(t==TOK_ELLIPSIS)
5652 type.make_ellipsis();
5660 std::cout << std::string(__indent,
' ')
5661 <<
"Parser::rTypeNameOrFunctionType 6\n";
5672 std::cout << std::string(__indent,
' ')
5673 <<
"Parser::rTypeNameOrFunctionType 7\n";
5683 std::cout << std::string(__indent,
' ')
5684 <<
"Parser::rTypeNameOrFunctionType 8\n";
5706 std::cout << std::string(__indent,
' ') <<
"Parser::rUnaryExpr 0\n";
5709 if(t==
'*' || t==
'&' || t==
'+' ||
5710 t==
'-' || t==
'!' || t==
'~' ||
5711 t==TOK_INCR || t==TOK_DECR)
5717 std::cout << std::string(__indent,
' ') <<
"Parser::rUnaryExpr 1\n";
5725 std::cout << std::string(__indent,
' ') <<
"Parser::rUnaryExpr 2\n";
5731 exp=
exprt(ID_dereference);
5735 exp=
exprt(ID_address_of);
5739 exp=
exprt(ID_unary_plus);
5743 exp=
exprt(ID_unary_minus);
5751 exp=
exprt(ID_bitnot);
5755 exp=
exprt(ID_side_effect);
5756 exp.
set(ID_statement, ID_preincrement);
5760 exp=
exprt(ID_side_effect);
5761 exp.
set(ID_statement, ID_predecrement);
5773 else if(t==TOK_SIZEOF)
5775 else if(t==TOK_ALIGNOF)
5777 else if(t==TOK_THROW)
5779 else if(t==TOK_NOEXCEPT)
5781 else if(t==TOK_REAL || t==TOK_IMAG)
5792 exp=
exprt(t==TOK_REAL?ID_complex_real:ID_complex_imag);
5813 std::cout << std::string(__indent,
' ') <<
"Parser::rThrowExpr 0\n";
5824 if(t==
':' || t==
';')
5852 std::cout << std::string(__indent,
' ') <<
"Parser::rTypeidExpr 0\n";
5874 exp =
exprt(ID_typeid);
5893 exp =
exprt(ID_typeid);
5918 std::cout << std::string(__indent,
' ') <<
"Parser::rSizeofExpr 0\n";
5936 exp=
exprt(ID_sizeof);
5937 exp.
add(ID_type_arg).
swap(tname);
5958 exp=
exprt(ID_sizeof);
5959 exp.
add(ID_type_arg).
swap(tname);
5973 exp=
exprt(ID_sizeof);
6002 exp=
exprt(ID_alignof);
6003 exp.
add(ID_type_arg).
swap(tname);
6018 std::cout << std::string(__indent,
' ') <<
"Parser::rNoexceptExpr 0\n";
6036 exp=
exprt(ID_noexcept);
6054 return t==TOK_NEW || t==TOK_DELETE;
6069 std::cout << std::string(__indent,
' ') <<
"Parser::rAllocateExpr 0\n";
6080 std::cout << std::string(__indent,
' ') <<
"Parser::rAllocateExpr 1\n";
6086 std::cout << std::string(__indent,
' ') <<
"Parser::rAllocateExpr 2\n";
6100 exp=
exprt(ID_side_effect);
6101 exp.
set(ID_statement, ID_cpp_delete_array);
6105 exp=
exprt(ID_side_effect);
6106 exp.
set(ID_statement, ID_cpp_delete);
6121 std::cout << std::string(__indent,
' ') <<
"Parser::rAllocateExpr 3\n";
6124 exp=
exprt(ID_side_effect);
6125 exp.
set(ID_statement, ID_cpp_new);
6128 exprt arguments, initializer;
6134 std::cout << std::string(__indent,
' ') <<
"Parser::rAllocateExpr 4\n";
6137 exp.
add(ID_initializer).
swap(initializer);
6269 decl.
swap(array_type);
6340 std::cout << std::string(__indent,
' ') <<
"Parser::rPostfixExpr 0\n";
6347 std::cout << std::string(__indent,
' ') <<
"Parser::rPostfixExpr 1\n";
6364 std::cout << std::string(__indent,
' ') <<
"Parser::rPostfixExpr 2\n";
6374 exp=
exprt(ID_index);
6382 std::cout << std::string(__indent,
' ') <<
"Parser::rPostfixExpr 3\n";
6393 std::cout << std::string(__indent,
' ') <<
"Parser::rPostfixExpr 4\n";
6403 fc.arguments().push_back(*it);
6436 std::cout << std::string(__indent,
' ') <<
"Parser::rPostfixExpr 5\n";
6443 std::cout << std::string(__indent,
' ') <<
"Parser::rPostfixExpr 6\n";
6451 exp=
exprt(ID_member);
6453 exp=
exprt(ID_ptrmember);
6459 exp.
add(ID_component_cpp_name).
swap(e);
6495 expr=
exprt(ID_msc_uuidof);
6496 expr.
add(ID_type_arg).
swap(tname);
6513 expr=
exprt(ID_msc_uuidof);
6530 if(tk1.
kind!=TOK_MSC_IF_EXISTS &&
6531 tk1.
kind!=TOK_MSC_IF_NOT_EXISTS)
6559 tk1.
kind==TOK_MSC_IF_EXISTS?ID_msc_if_exists:
6560 ID_msc_if_not_exists);
6575 if(tk1.
kind != TOK_MSC_IF_EXISTS && tk1.
kind != TOK_MSC_IF_NOT_EXISTS)
6599 block.
add(std::move(*statement));
6608 tk1.
kind == TOK_MSC_IF_EXISTS ? ID_msc_if_exists : ID_msc_if_not_exists);
6614 return std::move(code);
6633 typet tname1, tname2;
6637 case TOK_UNARY_TYPE_PREDICATE:
6644 expr.
add(ID_type_arg).
swap(tname1);
6647 case TOK_BINARY_TYPE_PREDICATE:
6658 expr.
add(
"type_arg1").
swap(tname1);
6659 expr.
add(
"type_arg2").
swap(tname2);
6692 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 0 "
6705 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 1\n";
6714 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 2\n";
6720 exp=
exprt(
"cpp-this");
6723 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 3\n";
6732 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 4\n";
6741 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 5\n";
6751 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 6\n";
6757 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 7\n";
6765 exp =
exprt(ID_side_effect);
6766 exp.
set(ID_statement, ID_statement_expression);
6784 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 8\n";
6794 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 9\n";
6800 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 10\n";
6807 case TOK_UNARY_TYPE_PREDICATE:
6808 case TOK_BINARY_TYPE_PREDICATE:
6810 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 11\n";
6814 case TOK_MSC_UUIDOF:
6816 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 12\n";
6822 case TOK_MSC_IF_EXISTS:
6823 case TOK_MSC_IF_NOT_EXISTS:
6825 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 13\n";
6831 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 14\n";
6840 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 15\n";
6853 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 16\n";
6863 exp=
exprt(
"explicit-constructor-call");
6879 exp=
exprt(
"explicit-constructor-call");
6903 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 17\n";
6924 std::cout << std::string(__indent,
' ') <<
"Parser::rVarName 0\n";
6937 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 0\n";
6947 name.
set(ID_typename,
true);
6957 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 1\n";
6965 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 1.1 "
6975 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 2\n";
6983 case TOK_IDENTIFIER:
6985 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 3\n";
6998 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 4\n";
7008 components.push_back(
irept(ID_template_args));
7009 components.back().add(ID_arguments).swap(args);
7018 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 5\n";
7022 components.push_back(
irept(
"::"));
7028 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 6\n";
7036 components.push_back(
irept(
"~"));
7042 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 7\n";
7047 components.push_back(
irept(ID_operator));
7055 components.push_back(op);
7070 if(t==TOK_IDENTIFIER || t==
'~' || t==TOK_OPERATOR || t==TOK_TEMPLATE)
7089 std::cout << std::string(__indent,
' ') <<
"Parser::maybeTemplateArgs 0\n";
7098 if(u==
'\0' || u==
';' || u==
'}')
7100 else if((u==
'>' || u==TOK_SHIFTRIGHT) &&
7111 std::cout << std::string(__indent,
' ')
7112 <<
"Parser::maybeTemplateArgs 1\n";
7118 std::cout << std::string(__indent,
' ')
7119 <<
"Parser::maybeTemplateArgs 2\n";
7134 std::cout << std::string(__indent,
' ')
7135 <<
"Parser::maybeTemplateArgs 3\n";
7142 else if(v==
'\0' || v==
';' || v==
'}')
7146 else if(u==
'\0' || u==
';' || u==
'}')
7148 else if(u==TOK_SHIFTRIGHT && n>=2)
7152 std::cout << std::string(__indent,
' ')
7153 <<
"Parser::maybeTemplateArgs 4\n";
7158 std::cout << std::string(__indent,
' ') <<
"Parser::maybeTemplateArgs 5\n";
7164 std::cout << std::string(__indent,
' ') <<
"Parser::maybeTemplateArgs 6\n";
7167 return t==TOK_SCOPE || t==
'(';
7172 std::cout << std::string(__indent,
' ') <<
"Parser::maybeTemplateArgs 7\n";
7203 declarator.
value()=body;
7213 declarator.
value() = std::move(*body);
7236 std::cout << std::string(__indent,
' ') <<
"Parser::rCompoundStatement 1\n";
7243 std::cout << std::string(__indent,
' ') <<
"Parser::rCompoundStatement 2\n";
7252 statement.
add(std::move(*statement2));
7260 return std::move(statement);
7267 return std::move(statement);
7298 std::cout << std::string(__indent,
' ') <<
"Parser::rStatement 0 "
7339 codet statement(k == TOK_BREAK ? ID_break : ID_continue);
7345 return std::move(statement);
7350 std::cout << std::string(__indent,
' ') <<
"Parser::rStatement RETURN 0\n";
7361 std::cout << std::string(__indent,
' ')
7362 <<
"Parser::rStatement RETURN 1\n";
7369 std::cout << std::string(__indent,
' ')
7370 <<
"Parser::rStatement RETURN 2\n";
7377 std::cout << std::string(__indent,
' ')
7378 <<
"Parser::rStatement RETURN 3\n";
7385 return std::move(statement);
7400 return std::move(statement);
7426 std::move(case_expr), std::move(range_end), std::move(*statement2));
7428 return std::move(code);
7441 std::move(case_expr), std::move(*statement2));
7443 return std::move(statement);
7462 return std::move(statement);
7474 case TOK_MSC_IF_EXISTS:
7475 case TOK_MSC_IF_NOT_EXISTS:
7478 case TOK_IDENTIFIER:
7490 return std::move(label);
7509 return std::move(statement);
7520 case TOK_STATIC_ASSERT:
7527 codet statement(ID_static_assert);
7529 statement.
operands().swap(cpp_static_assert.operands());
7531 return std::move(statement);
7561 if(!then.has_value())
7571 std::move(exp), std::move(*then), std::move(*otherwise));
7573 return std::move(statement);
7582 return std::move(statement);
7609 code_switcht statement(std::move(exp), std::move(*body));
7611 return std::move(statement);
7640 code_whilet statement(std::move(exp), std::move(*body));
7642 return std::move(statement);
7660 if(!body.has_value())
7681 return std::move(statement);
7701 if(!exp1.has_value())
7731 std::move(*exp1), std::move(exp2), std::move(exp3), std::move(*body));
7733 return std::move(statement);
7755 if(!try_body.has_value())
7778 codet ellipsis(ID_ellipsis);
7780 catch_op = std::move(ellipsis);
7792 if(declaration.
declarators().front().name().is_nil())
7799 catch_op = std::move(code_decl);
7818 return std::move(statement);
7833 if(!body1.has_value())
7838 codet statement(ID_msc_try_except);
7858 std::move(*body1), std::move(exp), std::move(*body2));
7859 return std::move(statement);
7866 codet statement(ID_msc_try_finally);
7874 return std::move(statement);
7893 codet statement(ID_msc_leave);
7896 return std::move(statement);
7905 std::cout << std::string(__indent,
' ') <<
"Parser::rGCCAsmStatement 1\n";
7920 std::cout << std::string(__indent,
' ') <<
"Parser::rGCCAsmStatement 3\n";
7931 std::cout << std::string(__indent,
' ') <<
"Parser::rGCCAsmStatement 3\n";
7937 std::cout << std::string(__indent,
' ') <<
"Parser::rGCCAsmStatement 4\n";
7958 std::cout << std::string(__indent,
' ')
7959 <<
"Parser::rGCCAsmStatement 5\n";
7967 std::cout << std::string(__indent,
' ')
7968 <<
"Parser::rGCCAsmStatement 6\n";
7983 std::cout << std::string(__indent,
' ') <<
"Parser::rGCCAsmStatement 7\n";
7992 std::cout << std::string(__indent,
' ') <<
"Parser::rGCCAsmStatement 8\n";
7995 return std::move(statement);
8004 std::cout << std::string(__indent,
' ') <<
"Parser::rMSCAsmStatement 1\n";
8018 std::cout << std::string(__indent,
' ') <<
"Parser::rMSCAsmStatement 2\n";
8026 std::cout << std::string(__indent,
' ') <<
"Parser::rMSCAsmStatement 3\n";
8039 std::cout << std::string(__indent,
' ') <<
"Parser::rMSCAsmStatement 4\n";
8045 std::cout << std::string(__indent,
' ') <<
"Parser::rMSCAsmStatement 5\n";
8049 return std::move(statement);
8055 std::cout << std::string(__indent,
' ') <<
"Parser::rMSCAsmStatement 6\n";
8060 std::cout << std::string(__indent,
' ') <<
"Parser::rMSCAsmStatement 7\n";
8063 return std::move(statement);
8080 std::cout << std::string(__indent,
' ') <<
"Parser::rExprStatement 0\n";
8086 std::cout << std::string(__indent,
' ') <<
"Parser::rExprStatement 1\n";
8092 return std::move(statement);
8097 std::cout << std::string(__indent,
' ') <<
"Parser::rExprStatement 2\n";
8105 std::cout << std::string(__indent,
' ') <<
"rDe " << statement->pretty()
8117 std::cout << std::string(__indent,
' ') <<
"Parser::rExprStatement 3\n";
8124 std::cout << std::string(__indent,
' ') <<
"Parser::rExprStatement 4\n";
8128 std::cout << std::string(__indent,
' ') <<
"Parser::rExprStatement 5 "
8136 std::cout << std::string(__indent,
' ') <<
"Parser::rExprStatement 6\n";
8141 return std::move(expr_statement);
8156 statement=
codet(ID_decl);
8188 typet cv_q, integral;
8193 std::cout << std::string(__indent,
' ')
8194 <<
"Parser::rDeclarationStatement 1\n";
8216 std::cout << std::string(__indent,
' ')
8217 <<
"Parser::rDeclarationStatement 2\n";
8227 std::cout << std::string(__indent,
' ')
8228 <<
"Parser::rDeclarationStatement 3 " << t <<
'\n';
8232 ((t==TOK_IDENTIFIER &&
lex.
LookAhead(1)==
'=') || t==
'*'))
8235 std::cout << std::string(__indent,
' ')
8236 <<
"Parser::rDeclarationStatement 4\n";
8276 return std::move(statement);
8289 return std::move(statement);
8305 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclStatement 1\n";
8308 if(!
rName(type_name))
8312 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclStatement 2\n";
8319 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclStatement 3\n";
8325 declaration.
type().
swap(type_name);
8332 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclStatement 4\n";
8341 return std::move(statement);
8356 if(t==token || t==
'\0')