33 static unsigned __indent;
37 indenter() { __indent+=2; }
38 ~indenter() { __indent-=2; }
44 lex.LookAhead(0, _tk); \
45 std::cout << std::string(__indent, ' ') << "Text [" << _tk.line_no << "]: " \
46 << _tk.text << '\n'; \
122 return "CLASS_TEMPLATE";
124 return "MEMBER_TEMPLATE";
126 return "FUNCTION_TEMPLATE";
130 return "NON_TYPE_TEMPLATE_PARAMETER";
132 return "TYPE_TEMPLATE_PARAMETER";
134 return "TEMPLATE_TEMPLATE_PARAMETER";
140 typedef std::map<irep_idt, new_scopet>
id_mapt;
147 inline void print(std::ostream &out)
const
165 void print_rec(std::ostream &,
unsigned indent)
const;
188 for(id_mapt::const_iterator
193 out << std::string(indent,
' ')
197 it->second.print_rec(out, indent+2);
205 lex(_cpp_parser.token_buffer),
282 typet &trailing_return_type);
390 static_cast<source_locationt &>(dest.
add(ID_C_source_location));
403 if(p->
id()==ID_merged_type)
406 p = &merged_type.last_type();
422 if(cpp_name.
get_sub().size()==1 &&
423 cpp_name.
get_sub().front().id()==ID_name)
424 id=cpp_name.
get_sub().front().get(ID_identifier);
471 if(dest.
id()!=ID_merged_type)
484 sub.emplace(sub.begin(), src);
490 #define ERROR_TOKENS 4
500 source_location.
set_file(t[0].filename);
503 std::string message=
"parse error before `";
558 std::cout << std::string(__indent,
' ') <<
"Parser::rDefinition 1 " << t
613 std::cout << std::string(__indent,
' ') <<
"Parser::rTypedef 1\n";
642 std::cout << std::string(__indent,
' ') <<
"Parser::rTypedefUsing 1\n";
658 std::cout << std::string(__indent,
' ') <<
"Parser::rTypedefUsing 2\n";
675 std::cout << std::string(__indent,
' ') <<
"Parser::rTypedefUsing 3\n";
683 statement=
codet(ID_decl);
696 std::cout << std::string(__indent,
' ') <<
"Parser::rTypeSpecifier 0\n";
707 std::cout << std::string(__indent,
' ') <<
"Parser::rTypeSpecifier 0.1\n";
719 std::cout << std::string(__indent,
' ') <<
"Parser::rTypeSpecifier 1\n";
727 std::cout << std::string(__indent,
' ') <<
"Parser::rTypeSpecifier 2\n";
735 std::cout << std::string(__indent,
' ') <<
"Parser::rTypeSpecifier 3\n";
744 std::cout << std::string(__indent,
' ') <<
"Parser::rTypeSpecifier 4\n";
811 linkage_spec.
items().push_back(item);
827 bool is_inline=
false;
845 name=tk2.
data.
get(ID_C_base_name);
970 items.push_back(item);
974 items.push_back(item);
1006 typet template_type;
1025 std::cout << std::string(__indent,
' ') <<
"BODY: "
1026 << body.
pretty() <<
'\n';
1027 std::cout << std::string(__indent,
' ') <<
"TEMPLATE_TYPE: "
1028 << template_type.
pretty() <<
'\n';
1030 body.
add(ID_template_type).
swap(template_type);
1031 body.
set(ID_is_template,
true);
1041 body.
add(ID_template_type).
swap(template_type);
1042 body.
set(ID_is_template,
true);
1061 decl=
typet(ID_template);
1074 irept &template_parameters=decl.
add(ID_template_parameters);
1098 if(template_parameters.
get_sub().empty())
1123 args.
get_sub().back().swap(a);
1134 args.
get_sub().back().swap(a);
1151 std::cout << std::string(__indent,
' ') <<
"Parser::rTempArgDeclaration 0\n";
1166 declaration.
set(ID_is_type,
true);
1167 declaration.
type()=
typet(
"cpp-template-type");
1177 bool has_ellipsis=
false;
1226 std::cout << std::string(__indent,
' ') <<
"Parser::rTempArgDeclaration 1\n";
1233 typet template_type;
1264 std::cout << std::string(__indent,
' ')
1265 <<
"Parser::rTempArgDeclaration 2\n";
1269 declaration.
set(ID_is_type,
false);
1275 std::cout << std::string(__indent,
' ')
1276 <<
"Parser::rTempArgDeclaration 3\n";
1279 bool has_ellipsis=
false;
1296 std::cout << std::string(__indent,
' ')
1297 <<
"Parser::rTempArgDeclaration 4\n";
1383 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclaration 0.1 token: "
1395 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclaration 0.2\n";
1403 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclaration 1\n";
1411 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclaration 3\n";
1414 typet cv_q, integral;
1428 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclaration 4\n";
1442 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclaration 5\n";
1446 declaration, storage_spec, member_spec, integral, cv_q);
1453 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclaration 6 " << t
1469 typet cv_q, integral;
1495 integral.
swap(cv_q);
1534 std::cout << std::string(__indent,
' ')
1535 <<
"Parser::rIntegralDeclaration 1 token: "
1543 std::cout << std::string(__indent,
' ') <<
"Parser::rIntegralDeclaration 2\n";
1549 std::cout << std::string(__indent,
' ') <<
"Parser::rIntegralDeclaration 3\n";
1562 std::cout << std::string(__indent,
' ')
1563 <<
"Parser::rIntegralDeclaration 4\n";
1571 std::cout << std::string(__indent,
' ')
1572 <<
"Parser::rIntegralDeclaration 5\n";
1592 std::cout << std::string(__indent,
' ')
1593 <<
"Parser::rIntegralDeclaration 6 "
1602 declaration.
type().
id() == ID_auto &&
1604 declaration.
declarators().front().type().id() == ID_function_type &&
1605 declaration.
declarators().front().type().subtype().is_not_nil())
1607 declaration.
type() = declaration.
declarators().front().type().subtype();
1608 declaration.
declarators().front().type().subtype().make_nil();
1612 std::cout << std::string(__indent,
' ')
1613 <<
"Parser::rIntegralDeclaration 7\n";
1619 std::cout << std::string(__indent,
' ')
1620 <<
"Parser::rIntegralDeclaration 8 "
1621 << declaration.
pretty() <<
'\n';
1629 std::cout << std::string(__indent,
' ')
1630 <<
"Parser::rIntegralDeclaration 9\n";
1640 std::cout << std::string(__indent,
' ')
1641 <<
"Parser::rIntegralDeclaration 10\n";
1653 std::cout << std::string(__indent,
' ') <<
"Parser::rConstDeclaration\n";
1678 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 1\n";
1681 if(!
rName(type_name))
1687 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 2\n";
1701 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 3\n";
1705 bool is_operator =
false;
1710 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 4\n";
1713 assert(!type_name.
get_sub().empty());
1715 for(std::size_t i=0; i < type_name.
get_sub().size(); i++)
1717 if(type_name.
get_sub()[i].id() == ID_operator)
1728 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 5\n";
1732 typet type = type_name;
1736 typet trailing_return_type;
1738 conv_operator_declarator, type_name, trailing_return_type))
1741 type_name=
typet(
"cpp-cast-operator");
1743 declaration.
declarators().push_back(conv_operator_declarator);
1748 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 6\n";
1751 assert(!type_name.
get_sub().empty());
1753 bool is_destructor=
false;
1762 typet trailing_return_type;
1764 constructor_declarator, type_name, trailing_return_type))
1768 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 7\n";
1773 type_name=trailing_return_type;
1775 type_name=
typet(is_destructor?ID_destructor:ID_constructor);
1777 declaration.
declarators().push_back(constructor_declarator);
1782 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 8\n";
1800 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 9\n";
1812 declaration.
type().
swap(type_name);
1817 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 10\n";
1823 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 11\n";
1832 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 12\n";
1856 std::cout << std::string(__indent,
' ') <<
"Parser::isConstructorDecl "
1865 if(t==
'*' || t==
'&' || t==
'(')
1918 else if(v==
'\0' || v==
';' || v==
'}')
1922 else if(u==
'\0' || u==
';' || u==
'}')
1947 member_spec.
clear();
2033 p=
typet(ID_constexpr);
2045 p=
typet(ID_volatile);
2051 p=
typet(ID_restrict);
2123 exprt exp(ID_alignof);
2124 exp.
add(ID_type_arg).
swap(tname);
2127 typet attr(ID_aligned);
2129 attr.
add(ID_size, exp);
2146 typet attr(ID_aligned);
2148 attr.
add(ID_size, exp);
2162 std::cout << std::string(__indent,
' ') <<
"Parser::rAttribute "
2181 typet attr(ID_packed);
2189 typet attr(ID_transparent_union);
2217 typet attr(ID_aligned);
2234 attr.
add(ID_size, exp);
2255 typet attr(ID_gcc_attribute_mode);
2257 attr.
set(ID_size, name.
get(ID_identifier));
2264 typet attr(ID_static);
2272 typet attr(ID_weak);
2291 typet attr(ID_alias);
2311 typet attr(ID_section);
2320 typet attr(ID_noreturn);
2328 typet attr(ID_constructor);
2336 typet attr(ID_destructor);
2380 typet attr(ID_noreturn);
2407 std::cout << std::string(__indent,
' ')
2408 <<
"Parser::optIntegralTypeOrClassSpec 0\n";
2418 bool is_integral=
false;
2428 std::cout << std::string(__indent,
' ')
2429 <<
"Parser::optIntegralTypeOrClassSpec 1\n";
2436 case TOK_CHAR: type_id=ID_char;
break;
2439 case TOK_INT: type_id=ID_int;
break;
2440 case TOK_SHORT: type_id=ID_short;
break;
2441 case TOK_LONG: type_id=ID_long;
break;
2446 case TOK_FLOAT: type_id=ID_float;
break;
2448 case TOK_VOID: type_id=ID_void;
break;
2449 case TOK_INT8: type_id=ID_int8;
break;
2450 case TOK_INT16: type_id=ID_int16;
break;
2451 case TOK_INT32: type_id=ID_int32;
break;
2452 case TOK_INT64: type_id=ID_int64;
break;
2457 type_id = ID_c_bool;
2460 case TOK_AUTO: type_id = ID_auto;
break;
2464 if(!type_id.
empty())
2481 std::cout << std::string(__indent,
' ')
2482 <<
"Parser::optIntegralTypeOrClassSpec 2\n";
2489 std::cout << std::string(__indent,
' ')
2490 <<
"Parser::optIntegralTypeOrClassSpec 3\n";
2500 std::cout << std::string(__indent,
' ')
2501 <<
"Parser::optIntegralTypeOrClassSpec 4\n";
2508 std::cout << std::string(__indent,
' ')
2509 <<
"Parser::optIntegralTypeOrClassSpec 5\n";
2529 p.
add(ID_type_arg).
swap(tname);
2538 std::cout << std::string(__indent,
' ')
2539 <<
"Parser::optIntegralTypeOrClassSpec 6\n";
2547 std::cout << std::string(__indent,
' ')
2548 <<
"Parser::optIntegralTypeOrClassSpec 7\n";
2555 std::cout << std::string(__indent,
' ')
2556 <<
"Parser::optIntegralTypeOrClassSpec 8\n";
2559 p.
add(ID_expr_arg).
swap(expr);
2568 p=
typet(ID_decltype);
2584 p.
add(ID_expr_arg).
swap(expr);
2595 p=
typet(ID_msc_underlying_type);
2612 p.
add(ID_type_arg).
swap(tname);
2631 typet &trailing_return_type)
2635 std::cout << std::string(__indent,
' ') <<
"Parser::rConstructorDecl 0\n";
2642 constructor.
name().
swap(type_name);
2649 std::cout << std::string(__indent,
' ') <<
"Parser::rConstructorDecl 1\n";
2652 irept ¶meters=constructor.
type().
add(ID_parameters);
2662 std::cout << std::string(__indent,
' ') <<
"Parser::rConstructorDecl 2\n";
2665 typet &cv=static_cast<typet &>(constructor.
add(ID_method_qualifier));
2674 std::cout << std::string(__indent,
' ') <<
"Parser::rConstructorDecl 3\n";
2686 std::cout << std::string(__indent,
' ') <<
"Parser::rConstructorDecl 4\n";
2700 std::cout << std::string(__indent,
' ') <<
"Parser::rConstructorDecl 5\n";
2712 constructor.
value()=
codet(
"cpp-pure-virtual");
2828 bool should_be_declarator,
2839 declarators.push_back(declarator);
2857 bool should_be_declarator,
2870 typet bit_field_type(ID_c_bit_field);
2871 bit_field_type.
set(ID_size, e);
2884 declarator,
kDeclarator, should_be_declarator, is_statement))
2929 if(declarator.
type().
id()!=ID_function_type)
2945 typet bit_field_type(ID_c_bit_field);
2946 bit_field_type.
set(ID_size, e);
2953 dw.
swap(declarator);
3000 bool should_be_declarator,
3007 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 1\n";
3014 typet d_outer, d_inner;
3029 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 2\n";
3037 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 3\n";
3048 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 4\n";
3056 if(!should_be_declarator)
3061 if(t!=
'[' && t!=
'(')
3067 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 5\n";
3077 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 6\n";
3086 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 7\n";
3099 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 8\n";
3119 typet function_type(ID_function_type);
3121 function_type.
add(ID_parameters).
swap(args);
3125 d_outer.
swap(d_inner);
3131 init_args.
swap(args);
3136 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 9\n";
3145 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 10\n";
3166 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 11\n";
3184 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 12\n";
3199 std::list<typet> tl;
3200 tl.push_back(d_outer);
3201 while(tl.back().id() == ID_array)
3203 tl.push_back(tl.back().subtype());
3208 d_outer.
swap(array_type);
3211 tl.back().subtype().swap(d_outer);
3212 d_outer.
swap(tl.back());
3223 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 13\n";
3249 std::cout << std::string(__indent,
' ') <<
"Parser::optPtrOperator 1\n";
3252 std::list<typet> t_list;
3259 std::cout << std::string(__indent,
' ') <<
"Parser::optPtrOperator 2 "
3265 typet op(ID_frontend_pointer);
3276 t_list.push_back(op);
3281 typet op(ID_block_pointer);
3292 t_list.push_back(op);
3306 t_list.push_back(cv);
3309 t_list.push_back(op);
3322 typet op(ID_frontend_pointer);
3323 op.
set(ID_C_reference,
true);
3325 t_list.push_front(op);
3331 typet op(ID_frontend_pointer);
3332 op.
set(ID_C_rvalue_reference,
true);
3334 t_list.push_front(op);
3338 for(std::list<typet>::reverse_iterator
3343 if(it->id()==ID_merged_type)
3346 merged_type.last_type().subtype().swap(ptrs);
3350 assert(it->is_not_nil());
3351 it->subtype().swap(ptrs);
3371 init=
irept(ID_member_initializers);
3401 std::cout << std::string(__indent,
' ') <<
"Parser::rMemberInit 1\n";
3410 std::cout << std::string(__indent,
' ') <<
"Parser::rMemberInit 2\n";
3413 init=
codet(ID_member_initializer);
3414 init.
add(ID_member).
swap(name);
3424 std::cout << std::string(__indent,
' ') <<
"Parser::rMemberInit 3\n";
3443 std::cout << std::string(__indent,
' ') <<
"Parser::rMemberInit 4\n";
3483 std::cout << std::string(__indent,
' ') <<
"Parser::rName 0\n";
3493 name.
set(ID_typename,
true);
3503 std::cout << std::string(__indent,
' ') <<
"Parser::rName 1\n";
3511 std::cout << std::string(__indent,
' ') <<
"Parser::rName 2 "
3519 std::cout << std::string(__indent,
' ') <<
"Parser::rName 3\n";
3529 std::cout << std::string(__indent,
' ') <<
"Parser::rName 4\n";
3536 components.push_back(
irept(ID_template_args));
3537 components.back().
add(ID_arguments).
swap(args);
3547 std::cout << std::string(__indent,
' ') <<
"Parser::rName 5\n";
3563 std::cout << std::string(__indent,
' ') <<
"Parser::rName 6\n";
3566 components.push_back(
irept(
"::"));
3572 std::cout << std::string(__indent,
' ') <<
"Parser::rName 7\n";
3580 components.push_back(
irept(
"~"));
3586 std::cout << std::string(__indent,
' ') <<
"Parser::rName 8\n";
3590 components.push_back(
irept(ID_operator));
3593 components.push_back(
irept());
3646 operator_id = std::string(1, static_cast<char>(t));
3661 case TOK_EQ: operator_id=
"==";
break;
3662 case TOK_NE: operator_id=
"!=";
break;
3663 case TOK_LE: operator_id=
"<=";
break;
3664 case TOK_GE: operator_id=
">=";
break;
3666 case TOK_OROR: operator_id=
"||";
break;
3667 case TOK_INCR: operator_id=
"++";
break;
3668 case TOK_DECR: operator_id=
"--";
break;
3669 case TOK_DOTPM: operator_id=
".*";
break;
3671 case TOK_ARROW: operator_id=
"->";
break;
3685 name=
irept(t==
TOK_NEW?ID_cpp_new_array:ID_cpp_delete_array);
3712 assert(!operator_id.
empty());
3714 name=
irept(operator_id);
3728 typet cv1, cv2, type_name, ptr;
3743 if(!
rName(type_name))
3770 std::cout << std::string(__indent,
' ') <<
"Parser::rPtrToMember 0\n";
3773 typet ptm(ID_frontend_pointer);
3774 irept &name = ptm.
add(
"to-member");
3784 bool loop_cond =
true;
3804 components.push_back(
irept(ID_template_args));
3805 components.back().
add(ID_arguments).
swap(args);
3826 components.push_back(
irept(
"::"));
3833 ptr_to_mem.
swap(ptm);
3837 std::cout << std::string(__indent,
' ') <<
"Parser::rPtrToMember 1\n";
3868 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 0\n";
3879 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 1\n";
3891 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 2\n";
3900 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 3\n";
3915 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 4\n";
3927 exp.
id(ID_ambiguous);
3929 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 4.1\n";
3941 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 4.2\n";
3948 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 5\n";
3966 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 6\n";
3970 template_args.
get_sub().back().swap(exp);
4075 list.
get_sub().back().swap(declaration);
4113 header=
typet(ID_register);
4129 declaration.
declarators().push_back(arg_declarator);
4159 expr.
id(ID_initializer_list);
4279 std::cout << std::string(__indent,
' ') <<
"Parser::rEnumSpec 1\n";
4296 spec.
set(ID_C_class,
true);
4313 std::cout << std::string(__indent,
' ') <<
"Parser::rEnumSpec 2\n";
4325 std::cout << std::string(__indent,
' ') <<
"Parser::rEnumSpec 3\n";
4348 std::cout << std::string(__indent,
' ') <<
"Parser::rEnumSpec 4\n";
4420 std::cout << std::string(__indent,
' ') <<
"Parser::rClassSpec 1\n";
4429 std::cout << std::string(__indent,
' ') <<
"Parser::rClassSpec 2\n";
4434 spec=
typet(ID_struct);
4435 spec.
set(ID_C_class,
true);
4439 spec=
typet(ID_struct);
4440 spec.
set(ID_C_interface,
true);
4443 spec=
typet(ID_struct);
4445 spec=
typet(ID_union);
4452 std::cout << std::string(__indent,
' ') <<
"Parser::rClassSpec 3\n";
4459 std::cout << std::string(__indent,
' ') <<
"Parser::rClassSpec 4\n";
4483 std::cout << std::string(__indent,
' ') <<
"Parser::rClassSpec 5\n";
4503 std::cout << std::string(__indent,
' ') <<
"Parser::rClassSpec 6\n";
4515 std::cout << std::string(__indent,
' ') <<
"Parser::rClassSpec 7\n";
4518 ((
exprt&)spec.
add(ID_body)).operands().
swap(body.operands());
4539 irept base(ID_base);
4544 base.
set(ID_virtual,
true);
4553 base.
set(ID_protection, ID_public);
4557 base.
set(ID_protection, ID_protected);
4561 base.
set(ID_protection, ID_private);
4574 base.
set(ID_virtual,
true);
4588 bases.
get_sub().back().swap(base);
4606 std::cout << std::string(__indent,
' ') <<
"Parser::rClassBody 0\n";
4631 std::cout << std::string(__indent,
' ') <<
"Parser::rClassBody "
4632 << member.
pretty() <<
'\n';
4636 static_cast<exprt &>(static_cast<irept &>(member)));
4668 std::cout << std::string(__indent,
' ') <<
"Parser::rClassMember 0 " << t
4677 member.
id(
"cpp-public");
4681 member.
id(
"cpp-protected");
4685 member.
id(
"cpp-private");
4740 name_decl.
name() = name;
4757 std::cout << std::string(__indent,
' ') <<
"Parser::rCommaExpression 0\n";
4764 std::cout << std::string(__indent,
' ') <<
"Parser::rCommaExpression 1\n";
4780 exp=
exprt(ID_comma);
4786 std::cout << std::string(__indent,
' ') <<
"Parser::rCommaExpression 2\n";
4802 std::cout << std::string(__indent,
' ') <<
"Parser::rExpression 0\n";
4809 std::cout << std::string(__indent,
' ') <<
"Parser::rExpression 1\n";
4823 std::cout << std::string(__indent,
' ') <<
"Parser::rExpression 2\n";
4831 std::cout << std::string(__indent,
' ') <<
"Parser::rExpression 3\n";
4837 exp=
exprt(ID_side_effect);
4840 exp.
set(ID_statement, ID_assign);
4842 exp.
set(ID_statement, ID_assign_plus);
4844 exp.
set(ID_statement, ID_assign_minus);
4846 exp.
set(ID_statement, ID_assign_mult);
4848 exp.
set(ID_statement, ID_assign_div);
4850 exp.
set(ID_statement, ID_assign_mod);
4852 exp.
set(ID_statement, ID_assign_shl);
4854 exp.
set(ID_statement, ID_assign_shr);
4856 exp.
set(ID_statement, ID_assign_bitand);
4858 exp.
set(ID_statement, ID_assign_bitxor);
4860 exp.
set(ID_statement, ID_assign_bitor);
4867 std::cout << std::string(__indent,
' ') <<
"Parser::rExpression 4\n";
4881 std::cout << std::string(__indent,
' ') <<
"Parser::rConditionalExpr 0\n";
4888 std::cout << std::string(__indent,
' ') <<
"Parser::rConditionalExpr 1\n";
4894 exprt then, otherwise;
4901 std::cout << std::string(__indent,
' ') <<
"Parser::rConditionalExpr 2\n";
4930 std::cout << std::string(__indent,
' ') <<
"Parser::rLogicalOrExpr 0\n";
4937 std::cout << std::string(__indent,
' ') <<
"Parser::rLogicalOrExpr 1\n";
4969 std::cout << std::string(__indent,
' ') <<
"Parser::rLogicalAndExpr 1\n";
4976 std::cout << std::string(__indent,
' ') <<
"Parser::rLogicalAndExpr 1\n";
5008 std::cout << std::string(__indent,
' ') <<
"Parser::rInclusiveOrExpr 0\n";
5015 std::cout << std::string(__indent,
' ') <<
"Parser::rInclusiveOrExpr 1\n";
5030 exp=
exprt(ID_bitor);
5047 std::cout << std::string(__indent,
' ') <<
"Parser::rExclusiveOrExpr 0\n";
5054 std::cout << std::string(__indent,
' ') <<
"Parser::rExclusiveOrExpr 1\n";
5063 if(!
rAndExpr(right, template_args))
5069 exp=
exprt(ID_bitxor);
5086 std::cout << std::string(__indent,
' ') <<
"Parser::rAndExpr 0\n";
5093 std::cout << std::string(__indent,
' ') <<
"Parser::rAndExpr 1\n";
5108 exp=
exprt(ID_bitand);
5125 std::cout << std::string(__indent,
' ') <<
"Parser::rEqualityExpr 0\n";
5132 std::cout << std::string(__indent,
' ') <<
"Parser::rEqualityExpr 1\n";
5165 std::cout << std::string(__indent,
' ') <<
"Parser::rRelationalExpr 0\n";
5172 std::cout << std::string(__indent,
' ') <<
"Parser::rRelationalExpr 1\n";
5178 (t==
TOK_LE || t==
TOK_GE || t==
'<' || (t==
'>' && !template_args)))
5194 case TOK_LE:
id=ID_le;
break;
5195 case TOK_GE:
id=ID_ge;
break;
5196 case '<':
id=ID_lt;
break;
5197 case '>':
id=ID_gt;
break;
5217 std::cout << std::string(__indent,
' ') <<
"Parser::rShiftExpr 0\n";
5224 std::cout << std::string(__indent,
' ') <<
"Parser::rShiftExpr 1\n";
5257 std::cout << std::string(__indent,
' ') <<
"Parser::rAdditiveExpr 0\n";
5264 std::cout << std::string(__indent,
' ') <<
"Parser::rAdditiveExpr 1\n";
5283 case '+':
id=ID_plus;
break;
5284 case '-':
id=ID_minus;
break;
5304 std::cout << std::string(__indent,
' ') <<
"Parser::rMultiplyExpr 0\n";
5311 std::cout << std::string(__indent,
' ') <<
"Parser::rMultiplyExpr 1\n";
5315 while(t=
lex.
LookAhead(0), (t==
'*' || t==
'/' || t==
'%'))
5330 case '*':
id=ID_mult;
break;
5331 case '/':
id=ID_div;
break;
5332 case '%':
id=ID_mod;
break;
5341 std::cout << std::string(__indent,
' ') <<
"Parser::rMultiplyExpr 2\n";
5357 std::cout << std::string(__indent,
' ') <<
"Parser::rPmExpr 0\n";
5364 std::cout << std::string(__indent,
' ') <<
"Parser::rPmExpr 1\n";
5380 exp=
exprt(
"pointer-to-member");
5386 std::cout << std::string(__indent,
' ') <<
"Parser::rPmExpr 2\n";
5401 std::cout << std::string(__indent,
' ') <<
"Parser::rCastExpr 0\n";
5417 std::cout << std::string(__indent,
' ') <<
"Parser::rCastExpr 1\n";
5438 exp=
exprt(
"explicit-typecast");
5461 std::cout << std::string(__indent,
' ') <<
"Parser::rTypeName 0\n";
5470 std::cout << std::string(__indent,
' ') <<
"Parser::rTypeName 1\n";
5490 std::cout << std::string(__indent,
' ') <<
"Parser::rTypeName 2\n";
5505 std::cout << std::string(__indent,
' ')
5506 <<
"Parser::rTypeNameOrFunctionType 0\n";
5514 std::cout << std::string(__indent,
' ')
5515 <<
"Parser::rTypeNameOrFunctionType 1\n";
5527 std::cout << std::string(__indent,
' ')
5528 <<
"Parser::rTypeNameOrFunctionType 2\n";
5536 std::cout << std::string(__indent,
' ')
5537 <<
"Parser::rTypeNameOrFunctionType 3\n";
5542 tname.
swap(return_type);
5551 std::cout << std::string(__indent,
' ')
5552 <<
"Parser::rTypeNameOrFunctionType 4\n";
5579 type.set(ID_identifier, op.data.get(ID_C_base_name));
5590 type.set(ID_identifier, op.data.get(ID_C_base_name));
5600 std::cout << std::string(__indent,
' ')
5601 <<
"Parser::rTypeNameOrFunctionType 5\n";
5611 type.make_ellipsis();
5620 parameter.
swap(parameter_declaration);
5621 type.parameters().push_back(parameter);
5635 type.make_ellipsis();
5643 std::cout << std::string(__indent,
' ')
5644 <<
"Parser::rTypeNameOrFunctionType 6\n";
5655 std::cout << std::string(__indent,
' ')
5656 <<
"Parser::rTypeNameOrFunctionType 7\n";
5666 std::cout << std::string(__indent,
' ')
5667 <<
"Parser::rTypeNameOrFunctionType 8\n";
5689 std::cout << std::string(__indent,
' ') <<
"Parser::rUnaryExpr 0\n";
5692 if(t==
'*' || t==
'&' || t==
'+' ||
5693 t==
'-' || t==
'!' || t==
'~' ||
5700 std::cout << std::string(__indent,
' ') <<
"Parser::rUnaryExpr 1\n";
5708 std::cout << std::string(__indent,
' ') <<
"Parser::rUnaryExpr 2\n";
5714 exp=
exprt(ID_dereference);
5718 exp=
exprt(ID_address_of);
5722 exp=
exprt(ID_unary_plus);
5726 exp=
exprt(ID_unary_minus);
5734 exp=
exprt(ID_bitnot);
5738 exp=
exprt(ID_side_effect);
5739 exp.
set(ID_statement, ID_preincrement);
5743 exp=
exprt(ID_side_effect);
5744 exp.
set(ID_statement, ID_predecrement);
5796 std::cout << std::string(__indent,
' ') <<
"Parser::rThrowExpr 0\n";
5807 if(t==
':' || t==
';')
5835 std::cout << std::string(__indent,
' ') <<
"Parser::rTypeidExpr 0\n";
5857 exp =
exprt(ID_typeid);
5876 exp =
exprt(ID_typeid);
5901 std::cout << std::string(__indent,
' ') <<
"Parser::rSizeofExpr 0\n";
5919 exp=
exprt(ID_sizeof);
5920 exp.
add(ID_type_arg).
swap(tname);
5941 exp=
exprt(ID_sizeof);
5942 exp.
add(ID_type_arg).
swap(tname);
5956 exp=
exprt(ID_sizeof);
5985 exp=
exprt(ID_alignof);
5986 exp.
add(ID_type_arg).
swap(tname);
6001 std::cout << std::string(__indent,
' ') <<
"Parser::rNoexceptExpr 0\n";
6019 exp=
exprt(ID_noexcept);
6052 std::cout << std::string(__indent,
' ') <<
"Parser::rAllocateExpr 0\n";
6063 std::cout << std::string(__indent,
' ') <<
"Parser::rAllocateExpr 1\n";
6069 std::cout << std::string(__indent,
' ') <<
"Parser::rAllocateExpr 2\n";
6083 exp=
exprt(ID_side_effect);
6084 exp.
set(ID_statement, ID_cpp_delete_array);
6088 exp=
exprt(ID_side_effect);
6089 exp.
set(ID_statement, ID_cpp_delete);
6104 std::cout << std::string(__indent,
' ') <<
"Parser::rAllocateExpr 3\n";
6107 exp=
exprt(ID_side_effect);
6108 exp.
set(ID_statement, ID_cpp_new);
6111 exprt arguments, initializer;
6117 std::cout << std::string(__indent,
' ') <<
"Parser::rAllocateExpr 4\n";
6120 exp.
add(ID_initializer).
swap(initializer);
6252 decl.
swap(array_type);
6323 std::cout << std::string(__indent,
' ') <<
"Parser::rPostfixExpr 0\n";
6330 std::cout << std::string(__indent,
' ') <<
"Parser::rPostfixExpr 1\n";
6347 std::cout << std::string(__indent,
' ') <<
"Parser::rPostfixExpr 2\n";
6357 exp=
exprt(ID_index);
6365 std::cout << std::string(__indent,
' ') <<
"Parser::rPostfixExpr 3\n";
6376 std::cout << std::string(__indent,
' ') <<
"Parser::rPostfixExpr 4\n";
6419 std::cout << std::string(__indent,
' ') <<
"Parser::rPostfixExpr 5\n";
6426 std::cout << std::string(__indent,
' ') <<
"Parser::rPostfixExpr 6\n";
6434 exp=
exprt(ID_member);
6436 exp=
exprt(ID_ptrmember);
6442 exp.
add(ID_component_cpp_name).
swap(e);
6478 expr=
exprt(ID_msc_uuidof);
6479 expr.
add(ID_type_arg).
swap(tname);
6496 expr=
exprt(ID_msc_uuidof);
6543 ID_msc_if_not_exists);
6595 ID_msc_if_not_exists);
6620 typet tname1, tname2;
6631 expr.
add(ID_type_arg).
swap(tname1);
6645 expr.
add(
"type_arg1").
swap(tname1);
6646 expr.
add(
"type_arg2").
swap(tname2);
6679 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 0 "
6692 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 1\n";
6701 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 2\n";
6707 exp=
exprt(
"cpp-this");
6710 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 3\n";
6719 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 4\n";
6728 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 5\n";
6738 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 6\n";
6744 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 7\n";
6755 exp=
exprt(ID_side_effect);
6756 exp.
set(ID_statement, ID_statement_expression);
6771 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 8\n";
6781 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 9\n";
6787 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 10\n";
6797 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 11\n";
6803 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 12\n";
6812 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 13\n";
6818 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 14\n";
6827 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 15\n";
6840 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 16\n";
6850 exp=
exprt(
"explicit-constructor-call");
6866 exp=
exprt(
"explicit-constructor-call");
6890 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 17\n";
6911 std::cout << std::string(__indent,
' ') <<
"Parser::rVarName 0\n";
6924 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 0\n";
6934 name.
set(ID_typename,
true);
6944 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 1\n";
6952 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 1.1 "
6962 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 2\n";
6972 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 3\n";
6985 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 4\n";
6995 components.push_back(
irept(ID_template_args));
6996 components.back().add(ID_arguments).swap(args);
7005 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 5\n";
7009 components.push_back(
irept(
"::"));
7015 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 6\n";
7023 components.push_back(
irept(
"~"));
7029 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 7\n";
7034 components.push_back(
irept(ID_operator));
7042 components.push_back(op);
7076 std::cout << std::string(__indent,
' ') <<
"Parser::maybeTemplateArgs 0\n";
7085 if(u==
'\0' || u==
';' || u==
'}')
7098 std::cout << std::string(__indent,
' ')
7099 <<
"Parser::maybeTemplateArgs 1\n";
7105 std::cout << std::string(__indent,
' ')
7106 <<
"Parser::maybeTemplateArgs 2\n";
7121 std::cout << std::string(__indent,
' ')
7122 <<
"Parser::maybeTemplateArgs 3\n";
7129 else if(v==
'\0' || v==
';' || v==
'}')
7133 else if(u==
'\0' || u==
';' || u==
'}')
7139 std::cout << std::string(__indent,
' ')
7140 <<
"Parser::maybeTemplateArgs 4\n";
7145 std::cout << std::string(__indent,
' ') <<
"Parser::maybeTemplateArgs 5\n";
7151 std::cout << std::string(__indent,
' ') <<
"Parser::maybeTemplateArgs 6\n";
7159 std::cout << std::string(__indent,
' ') <<
"Parser::maybeTemplateArgs 7\n";
7190 declarator.
value()=body;
7206 declarator.
value()=body;
7224 std::cout << std::string(__indent,
' ') <<
"Parser::rCompoundStatement 1\n";
7231 std::cout << std::string(__indent,
' ') <<
"Parser::rCompoundStatement 2\n";
7288 std::cout << std::string(__indent,
' ') <<
"Parser::rStatement 0 "
7329 statement=
codet(ID_break);
7331 statement=
codet(ID_continue);
7342 std::cout << std::string(__indent,
' ') <<
"Parser::rStatement RETURN 0\n";
7347 statement=
codet(ID_return);
7353 std::cout << std::string(__indent,
' ')
7354 <<
"Parser::rStatement RETURN 1\n";
7361 std::cout << std::string(__indent,
' ')
7362 <<
"Parser::rStatement RETURN 2\n";
7371 std::cout << std::string(__indent,
' ')
7372 <<
"Parser::rStatement RETURN 3\n";
7386 statement=
codet(ID_goto);
7395 statement.
set(ID_destination, tk2.
data.
get(ID_C_base_name));
7417 statement=
codet(ID_gcc_switch_case_range);
7419 statement.
op0()=case_expr;
7420 statement.
op1()=range_end;
7430 statement.
op2().
swap(statement2);
7436 statement.
op0()=case_expr;
7445 statement.
op1().
swap(statement2);
7455 statement.
set(ID_default,
true);
7465 statement.
op1().
swap(statement2);
7484 statement=
codet(ID_label);
7486 statement.
set(ID_label, tk1.
data.
get(ID_C_base_name));
7505 statement=
codet(ID_decl);
7550 statement=
codet(ID_ifthenelse);
7579 statement.
op2().
swap(otherwise);
7598 statement=
codet(ID_switch);
7631 statement=
codet(ID_while);
7664 statement=
codet(ID_dowhile);
7704 statement=
codet(ID_for);
7795 codet ellipsis(ID_ellipsis);
7809 if(declaration.
declarators().front().name().is_nil())
7904 statement =
codet(ID_msc_leave);
7916 std::cout << std::string(__indent,
' ') <<
"Parser::rGCCAsmStatement 1\n";
7924 statement=
codet(ID_asm);
7925 statement.
set(ID_flavor, ID_gcc);
7933 std::cout << std::string(__indent,
' ') <<
"Parser::rGCCAsmStatement 3\n";
7944 std::cout << std::string(__indent,
' ') <<
"Parser::rGCCAsmStatement 3\n";
7950 std::cout << std::string(__indent,
' ') <<
"Parser::rGCCAsmStatement 4\n";
7971 std::cout << std::string(__indent,
' ')
7972 <<
"Parser::rGCCAsmStatement 5\n";
7980 std::cout << std::string(__indent,
' ')
7981 <<
"Parser::rGCCAsmStatement 6\n";
7996 std::cout << std::string(__indent,
' ') <<
"Parser::rGCCAsmStatement 7\n";
8005 std::cout << std::string(__indent,
' ') <<
"Parser::rGCCAsmStatement 8\n";
8017 std::cout << std::string(__indent,
' ') <<
"Parser::rMSCAsmStatement 1\n";
8026 statement=
codet(ID_asm);
8027 statement.
set(ID_flavor, ID_msc);
8031 std::cout << std::string(__indent,
' ') <<
"Parser::rMSCAsmStatement 2\n";
8039 std::cout << std::string(__indent,
' ') <<
"Parser::rMSCAsmStatement 3\n";
8052 std::cout << std::string(__indent,
' ') <<
"Parser::rMSCAsmStatement 4\n";
8058 std::cout << std::string(__indent,
' ') <<
"Parser::rMSCAsmStatement 5\n";
8068 std::cout << std::string(__indent,
' ') <<
"Parser::rMSCAsmStatement 6\n";
8073 std::cout << std::string(__indent,
' ') <<
"Parser::rMSCAsmStatement 7\n";
8093 std::cout << std::string(__indent,
' ') <<
"Parser::rExprStatement 0\n";
8099 std::cout << std::string(__indent,
' ') <<
"Parser::rExprStatement 1\n";
8110 std::cout << std::string(__indent,
' ') <<
"Parser::rExprStatement 2\n";
8118 std::cout << std::string(__indent,
' ') <<
"rDe "
8119 << statement.
pretty() <<
'\n';
8130 std::cout << std::string(__indent,
' ') <<
"Parser::rExprStatement 3\n";
8137 std::cout << std::string(__indent,
' ') <<
"Parser::rExprStatement 4\n";
8141 std::cout << std::string(__indent,
' ') <<
"Parser::rExprStatement 5 "
8149 std::cout << std::string(__indent,
' ') <<
"Parser::rExprStatement 6\n";
8152 statement=
codet(ID_expression);
8170 statement=
codet(ID_decl);
8202 typet cv_q, integral;
8207 std::cout << std::string(__indent,
' ')
8208 <<
"Parser::rDeclarationStatement 1\n";
8230 std::cout << std::string(__indent,
' ')
8231 <<
"Parser::rDeclarationStatement 2\n";
8241 std::cout << std::string(__indent,
' ')
8242 <<
"Parser::rDeclarationStatement 3 " << t <<
"\n";
8249 std::cout << std::string(__indent,
' ')
8250 <<
"Parser::rDeclarationStatement 4\n";
8253 statement=
codet(ID_decl);
8287 statement=
codet(ID_decl);
8299 statement=
codet(ID_decl);
8322 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclStatement 1\n";
8325 if(!
rName(type_name))
8329 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclStatement 2\n";
8336 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclStatement 3\n";
8342 declaration.
type().
swap(type_name);
8349 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclStatement 4\n";
8355 statement=
codet(ID_decl);
8374 if(t==token || t==
'\0')