23
23
#include " cpp_member_spec.h"
24
24
#include " cpp_enum_type.h"
25
25
26
- #define DEBUG
27
26
#ifdef DEBUG
28
27
#include < iostream>
29
28
@@ -1031,11 +1030,6 @@ bool Parser::rLinkageBody(cpp_linkage_spect::itemst &items)
1031
1030
*/
1032
1031
bool Parser::rTemplateDecl (cpp_declarationt &decl)
1033
1032
{
1034
- #ifdef DEBUG
1035
- indenter _i;
1036
- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl 1\n " ;
1037
- #endif
1038
-
1039
1033
TemplateDeclKind kind=tdk_unknown;
1040
1034
1041
1035
make_sub_scope (" #template" , new_scopet::kindt::TEMPLATE);
@@ -1045,10 +1039,6 @@ bool Parser::rTemplateDecl(cpp_declarationt &decl)
1045
1039
if (!rTemplateDecl2 (template_type, kind))
1046
1040
return false ;
1047
1041
1048
- #ifdef DEBUG
1049
- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl 2\n " ;
1050
- #endif
1051
-
1052
1042
cpp_declarationt body;
1053
1043
if (lex.LookAhead (0 )==TOK_USING)
1054
1044
{
@@ -1096,20 +1086,11 @@ bool Parser::rTemplateDecl(cpp_declarationt &decl)
1096
1086
1097
1087
bool Parser::rTemplateDecl2 (typet &decl, TemplateDeclKind &kind)
1098
1088
{
1099
- #ifdef DEBUG
1100
- indenter _i;
1101
- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl2 1\n " ;
1102
- #endif
1103
-
1104
1089
cpp_tokent tk;
1105
1090
1106
1091
if (lex.get_token (tk)!=TOK_TEMPLATE)
1107
1092
return false ;
1108
1093
1109
- #ifdef DEBUG
1110
- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl2 2\n " ;
1111
- #endif
1112
-
1113
1094
decl=typet (ID_template);
1114
1095
set_location (decl, tk);
1115
1096
@@ -1120,33 +1101,17 @@ bool Parser::rTemplateDecl2(typet &decl, TemplateDeclKind &kind)
1120
1101
return true ; // ignore TEMPLATE
1121
1102
}
1122
1103
1123
- #ifdef DEBUG
1124
- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl2 3\n " ;
1125
- #endif
1126
-
1127
1104
if (lex.get_token (tk)!=' <' )
1128
1105
return false ;
1129
1106
1130
1107
irept &template_parameters=decl.add (ID_template_parameters);
1131
1108
1132
- #ifdef DEBUG
1133
- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl2 4\n " ;
1134
- #endif
1135
-
1136
1109
if (!rTempArgList (template_parameters))
1137
1110
return false ;
1138
1111
1139
- #ifdef DEBUG
1140
- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl2 5\n " ;
1141
- #endif
1142
-
1143
1112
if (lex.get_token (tk)!=' >' )
1144
1113
return false ;
1145
1114
1146
- #ifdef DEBUG
1147
- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl2 6\n " ;
1148
- #endif
1149
-
1150
1115
// ignore nested TEMPLATE
1151
1116
while (lex.LookAhead (0 )==TOK_TEMPLATE)
1152
1117
{
@@ -1163,10 +1128,6 @@ bool Parser::rTemplateDecl2(typet &decl, TemplateDeclKind &kind)
1163
1128
return false ;
1164
1129
}
1165
1130
1166
- #ifdef DEBUG
1167
- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl2 7\n " ;
1168
- #endif
1169
-
1170
1131
if (template_parameters.get_sub ().empty ())
1171
1132
// template < > declaration
1172
1133
kind=tdk_specialization;
@@ -1227,10 +1188,6 @@ bool Parser::rTempArgDeclaration(cpp_declarationt &declaration)
1227
1188
1228
1189
if ((t0==TOK_CLASS || t0==TOK_TYPENAME))
1229
1190
{
1230
- #ifdef DEBUG
1231
- std::cout << std::string (__indent, ' ' ) << " Parser::rTempArgDeclaration 0.1\n " ;
1232
- #endif
1233
-
1234
1191
cpp_token_buffert::post pos=lex.Save ();
1235
1192
1236
1193
cpp_tokent tk1;
@@ -1270,10 +1227,6 @@ bool Parser::rTempArgDeclaration(cpp_declarationt &declaration)
1270
1227
1271
1228
if (lex.LookAhead (0 )==' =' )
1272
1229
{
1273
- #ifdef DEBUG
1274
- std::cout << std::string (__indent, ' ' ) << " Parser::rTempArgDeclaration 0.2\n " ;
1275
- #endif
1276
-
1277
1230
if (declarator.get_has_ellipsis ())
1278
1231
return false ;
1279
1232
@@ -1286,38 +1239,10 @@ bool Parser::rTempArgDeclaration(cpp_declarationt &declaration)
1286
1239
declarator.value ()=exprt (ID_type);
1287
1240
declarator.value ().type ().swap (default_type);
1288
1241
}
1289
- #ifdef DEBUG
1290
- std::cout << std::string (__indent, ' ' ) << " Parser::rTempArgDeclaration 0.3\n " ;
1291
- #endif
1292
1242
1293
1243
if (lex.LookAhead (0 )==' ,' ||
1294
1244
lex.LookAhead (0 )==' >' )
1295
1245
return true ;
1296
- #if 0
1297
- else if(lex.LookAhead(0) == TOK_SHIFTRIGHT)
1298
- {
1299
- #ifdef DEBUG
1300
- std::cout << std::string(__indent, ' ') << "Parser::rTempArgDeclaration 0.4\n";
1301
- #endif
1302
-
1303
- // turn >> into > >
1304
- cpp_token_buffert::post pos=lex.Save();
1305
- cpp_tokent tk;
1306
- lex.get_token(tk);
1307
- lex.Restore(pos);
1308
- tk.kind='>';
1309
- tk.text='>';
1310
- lex.Replace(tk);
1311
- lex.Insert(tk);
1312
- DATA_INVARIANT(lex.LookAhead(0) == '>', "should be >");
1313
- DATA_INVARIANT(lex.LookAhead(1) == '>', "should be >");
1314
- return true;
1315
- }
1316
- #endif
1317
- #ifdef DEBUG
1318
- std::cout << std::string (__indent, ' ' ) << " Parser::rTempArgDeclaration 0.5\n " ;
1319
- #endif
1320
-
1321
1246
1322
1247
lex.Restore (pos);
1323
1248
}
@@ -4043,8 +3968,7 @@ bool Parser::rTemplateArgs(irept &template_args)
4043
3968
)
4044
3969
{
4045
3970
#ifdef DEBUG
4046
- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4 " <<
4047
- lex.LookAhead (0 ) << " \n " ;
3971
+ std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4\n " ;
4048
3972
#endif
4049
3973
4050
3974
// ok
@@ -4056,30 +3980,20 @@ bool Parser::rTemplateArgs(irept &template_args)
4056
3980
lex.Restore (pos);
4057
3981
exprt tmp;
4058
3982
if (rConditionalExpr (tmp, true ))
4059
- {
4060
- #ifdef DEBUG
4061
- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4.0\n " ;
4062
- #endif
4063
3983
exp .id (ID_ambiguous);
4064
- }
4065
3984
#ifdef DEBUG
4066
3985
std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4.1\n " ;
4067
3986
#endif
4068
3987
lex.Restore (pos);
4069
3988
rTypeNameOrFunctionType (a);
4070
3989
4071
- #ifdef DEBUG
4072
- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4.1a " <<
4073
- lex.LookAhead (0 ) << " \n " ;
4074
- #endif
4075
3990
if (lex.LookAhead (0 )==TOK_ELLIPSIS)
4076
3991
{
4077
3992
lex.get_token (tk1);
4078
3993
exp .set (ID_ellipsis, true );
4079
3994
}
4080
3995
#ifdef DEBUG
4081
- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4.2 " <<
4082
- lex.LookAhead (0 ) << " \n " ;
3996
+ std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4.2\n " ;
4083
3997
#endif
4084
3998
}
4085
3999
else
0 commit comments