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
@@ -1047,11 +1046,6 @@ bool Parser::rLinkageBody(cpp_linkage_spect::itemst &items)
1047
1046
*/
1048
1047
bool Parser::rTemplateDecl (cpp_declarationt &decl)
1049
1048
{
1050
- #ifdef DEBUG
1051
- indenter _i;
1052
- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl 1\n " ;
1053
- #endif
1054
-
1055
1049
TemplateDeclKind kind=tdk_unknown;
1056
1050
1057
1051
make_sub_scope (" #template" , new_scopet::kindt::TEMPLATE);
@@ -1061,10 +1055,6 @@ bool Parser::rTemplateDecl(cpp_declarationt &decl)
1061
1055
if (!rTemplateDecl2 (template_type, kind))
1062
1056
return false ;
1063
1057
1064
- #ifdef DEBUG
1065
- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl 2\n " ;
1066
- #endif
1067
-
1068
1058
cpp_declarationt body;
1069
1059
if (lex.LookAhead (0 )==TOK_USING)
1070
1060
{
@@ -1112,20 +1102,11 @@ bool Parser::rTemplateDecl(cpp_declarationt &decl)
1112
1102
1113
1103
bool Parser::rTemplateDecl2 (typet &decl, TemplateDeclKind &kind)
1114
1104
{
1115
- #ifdef DEBUG
1116
- indenter _i;
1117
- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl2 1\n " ;
1118
- #endif
1119
-
1120
1105
cpp_tokent tk;
1121
1106
1122
1107
if (lex.get_token (tk)!=TOK_TEMPLATE)
1123
1108
return false ;
1124
1109
1125
- #ifdef DEBUG
1126
- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl2 2\n " ;
1127
- #endif
1128
-
1129
1110
decl=typet (ID_template);
1130
1111
set_location (decl, tk);
1131
1112
@@ -1136,33 +1117,17 @@ bool Parser::rTemplateDecl2(typet &decl, TemplateDeclKind &kind)
1136
1117
return true ; // ignore TEMPLATE
1137
1118
}
1138
1119
1139
- #ifdef DEBUG
1140
- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl2 3\n " ;
1141
- #endif
1142
-
1143
1120
if (lex.get_token (tk)!=' <' )
1144
1121
return false ;
1145
1122
1146
1123
irept &template_parameters=decl.add (ID_template_parameters);
1147
1124
1148
- #ifdef DEBUG
1149
- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl2 4\n " ;
1150
- #endif
1151
-
1152
1125
if (!rTempArgList (template_parameters))
1153
1126
return false ;
1154
1127
1155
- #ifdef DEBUG
1156
- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl2 5\n " ;
1157
- #endif
1158
-
1159
1128
if (lex.get_token (tk)!=' >' )
1160
1129
return false ;
1161
1130
1162
- #ifdef DEBUG
1163
- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl2 6\n " ;
1164
- #endif
1165
-
1166
1131
// ignore nested TEMPLATE
1167
1132
while (lex.LookAhead (0 )==TOK_TEMPLATE)
1168
1133
{
@@ -1179,10 +1144,6 @@ bool Parser::rTemplateDecl2(typet &decl, TemplateDeclKind &kind)
1179
1144
return false ;
1180
1145
}
1181
1146
1182
- #ifdef DEBUG
1183
- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl2 7\n " ;
1184
- #endif
1185
-
1186
1147
if (template_parameters.get_sub ().empty ())
1187
1148
// template < > declaration
1188
1149
kind=tdk_specialization;
@@ -1243,10 +1204,6 @@ bool Parser::rTempArgDeclaration(cpp_declarationt &declaration)
1243
1204
1244
1205
if ((t0==TOK_CLASS || t0==TOK_TYPENAME))
1245
1206
{
1246
- #ifdef DEBUG
1247
- std::cout << std::string (__indent, ' ' ) << " Parser::rTempArgDeclaration 0.1\n " ;
1248
- #endif
1249
-
1250
1207
cpp_token_buffert::post pos=lex.Save ();
1251
1208
1252
1209
cpp_tokent tk1;
@@ -1286,10 +1243,6 @@ bool Parser::rTempArgDeclaration(cpp_declarationt &declaration)
1286
1243
1287
1244
if (lex.LookAhead (0 )==' =' )
1288
1245
{
1289
- #ifdef DEBUG
1290
- std::cout << std::string (__indent, ' ' ) << " Parser::rTempArgDeclaration 0.2\n " ;
1291
- #endif
1292
-
1293
1246
if (declarator.get_has_ellipsis ())
1294
1247
return false ;
1295
1248
@@ -1302,38 +1255,10 @@ bool Parser::rTempArgDeclaration(cpp_declarationt &declaration)
1302
1255
declarator.value ()=exprt (ID_type);
1303
1256
declarator.value ().type ().swap (default_type);
1304
1257
}
1305
- #ifdef DEBUG
1306
- std::cout << std::string (__indent, ' ' ) << " Parser::rTempArgDeclaration 0.3\n " ;
1307
- #endif
1308
1258
1309
1259
if (lex.LookAhead (0 )==' ,' ||
1310
1260
lex.LookAhead (0 )==' >' )
1311
1261
return true ;
1312
- #if 0
1313
- else if(lex.LookAhead(0) == TOK_SHIFTRIGHT)
1314
- {
1315
- #ifdef DEBUG
1316
- std::cout << std::string(__indent, ' ') << "Parser::rTempArgDeclaration 0.4\n";
1317
- #endif
1318
-
1319
- // turn >> into > >
1320
- cpp_token_buffert::post pos=lex.Save();
1321
- cpp_tokent tk;
1322
- lex.get_token(tk);
1323
- lex.Restore(pos);
1324
- tk.kind='>';
1325
- tk.text='>';
1326
- lex.Replace(tk);
1327
- lex.Insert(tk);
1328
- DATA_INVARIANT(lex.LookAhead(0) == '>', "should be >");
1329
- DATA_INVARIANT(lex.LookAhead(1) == '>', "should be >");
1330
- return true;
1331
- }
1332
- #endif
1333
- #ifdef DEBUG
1334
- std::cout << std::string (__indent, ' ' ) << " Parser::rTempArgDeclaration 0.5\n " ;
1335
- #endif
1336
-
1337
1262
1338
1263
lex.Restore (pos);
1339
1264
}
@@ -4059,8 +3984,7 @@ bool Parser::rTemplateArgs(irept &template_args)
4059
3984
)
4060
3985
{
4061
3986
#ifdef DEBUG
4062
- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4 " <<
4063
- lex.LookAhead (0 ) << " \n " ;
3987
+ std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4\n " ;
4064
3988
#endif
4065
3989
4066
3990
// ok
@@ -4072,30 +3996,20 @@ bool Parser::rTemplateArgs(irept &template_args)
4072
3996
lex.Restore (pos);
4073
3997
exprt tmp;
4074
3998
if (rConditionalExpr (tmp, true ))
4075
- {
4076
- #ifdef DEBUG
4077
- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4.0\n " ;
4078
- #endif
4079
3999
exp .id (ID_ambiguous);
4080
- }
4081
4000
#ifdef DEBUG
4082
4001
std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4.1\n " ;
4083
4002
#endif
4084
4003
lex.Restore (pos);
4085
4004
rTypeNameOrFunctionType (a);
4086
4005
4087
- #ifdef DEBUG
4088
- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4.1a " <<
4089
- lex.LookAhead (0 ) << " \n " ;
4090
- #endif
4091
4006
if (lex.LookAhead (0 )==TOK_ELLIPSIS)
4092
4007
{
4093
4008
lex.get_token (tk1);
4094
4009
exp .set (ID_ellipsis, true );
4095
4010
}
4096
4011
#ifdef DEBUG
4097
- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4.2 " <<
4098
- lex.LookAhead (0 ) << " \n " ;
4012
+ std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4.2\n " ;
4099
4013
#endif
4100
4014
}
4101
4015
else
0 commit comments