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
@@ -1014,11 +1013,6 @@ bool Parser::rLinkageBody(cpp_linkage_spect::itemst &items)
1014
1013
*/
1015
1014
bool Parser::rTemplateDecl (cpp_declarationt &decl)
1016
1015
{
1017
- #ifdef DEBUG
1018
- indenter _i;
1019
- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl 1\n " ;
1020
- #endif
1021
-
1022
1016
TemplateDeclKind kind=tdk_unknown;
1023
1017
1024
1018
make_sub_scope (" #template" , new_scopet::kindt::TEMPLATE);
@@ -1028,10 +1022,6 @@ bool Parser::rTemplateDecl(cpp_declarationt &decl)
1028
1022
if (!rTemplateDecl2 (template_type, kind))
1029
1023
return false ;
1030
1024
1031
- #ifdef DEBUG
1032
- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl 2\n " ;
1033
- #endif
1034
-
1035
1025
cpp_declarationt body;
1036
1026
if (lex.LookAhead (0 )==TOK_USING)
1037
1027
{
@@ -1079,20 +1069,11 @@ bool Parser::rTemplateDecl(cpp_declarationt &decl)
1079
1069
1080
1070
bool Parser::rTemplateDecl2 (typet &decl, TemplateDeclKind &kind)
1081
1071
{
1082
- #ifdef DEBUG
1083
- indenter _i;
1084
- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl2 1\n " ;
1085
- #endif
1086
-
1087
1072
cpp_tokent tk;
1088
1073
1089
1074
if (lex.get_token (tk)!=TOK_TEMPLATE)
1090
1075
return false ;
1091
1076
1092
- #ifdef DEBUG
1093
- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl2 2\n " ;
1094
- #endif
1095
-
1096
1077
decl=typet (ID_template);
1097
1078
set_location (decl, tk);
1098
1079
@@ -1103,33 +1084,17 @@ bool Parser::rTemplateDecl2(typet &decl, TemplateDeclKind &kind)
1103
1084
return true ; // ignore TEMPLATE
1104
1085
}
1105
1086
1106
- #ifdef DEBUG
1107
- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl2 3\n " ;
1108
- #endif
1109
-
1110
1087
if (lex.get_token (tk)!=' <' )
1111
1088
return false ;
1112
1089
1113
1090
irept &template_parameters=decl.add (ID_template_parameters);
1114
1091
1115
- #ifdef DEBUG
1116
- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl2 4\n " ;
1117
- #endif
1118
-
1119
1092
if (!rTempArgList (template_parameters))
1120
1093
return false ;
1121
1094
1122
- #ifdef DEBUG
1123
- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl2 5\n " ;
1124
- #endif
1125
-
1126
1095
if (lex.get_token (tk)!=' >' )
1127
1096
return false ;
1128
1097
1129
- #ifdef DEBUG
1130
- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl2 6\n " ;
1131
- #endif
1132
-
1133
1098
// ignore nested TEMPLATE
1134
1099
while (lex.LookAhead (0 )==TOK_TEMPLATE)
1135
1100
{
@@ -1146,10 +1111,6 @@ bool Parser::rTemplateDecl2(typet &decl, TemplateDeclKind &kind)
1146
1111
return false ;
1147
1112
}
1148
1113
1149
- #ifdef DEBUG
1150
- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateDecl2 7\n " ;
1151
- #endif
1152
-
1153
1114
if (template_parameters.get_sub ().empty ())
1154
1115
// template < > declaration
1155
1116
kind=tdk_specialization;
@@ -1210,10 +1171,6 @@ bool Parser::rTempArgDeclaration(cpp_declarationt &declaration)
1210
1171
1211
1172
if ((t0==TOK_CLASS || t0==TOK_TYPENAME))
1212
1173
{
1213
- #ifdef DEBUG
1214
- std::cout << std::string (__indent, ' ' ) << " Parser::rTempArgDeclaration 0.1\n " ;
1215
- #endif
1216
-
1217
1174
cpp_token_buffert::post pos=lex.Save ();
1218
1175
1219
1176
cpp_tokent tk1;
@@ -1253,10 +1210,6 @@ bool Parser::rTempArgDeclaration(cpp_declarationt &declaration)
1253
1210
1254
1211
if (lex.LookAhead (0 )==' =' )
1255
1212
{
1256
- #ifdef DEBUG
1257
- std::cout << std::string (__indent, ' ' ) << " Parser::rTempArgDeclaration 0.2\n " ;
1258
- #endif
1259
-
1260
1213
if (declarator.get_has_ellipsis ())
1261
1214
return false ;
1262
1215
@@ -1269,38 +1222,10 @@ bool Parser::rTempArgDeclaration(cpp_declarationt &declaration)
1269
1222
declarator.value ()=exprt (ID_type);
1270
1223
declarator.value ().type ().swap (default_type);
1271
1224
}
1272
- #ifdef DEBUG
1273
- std::cout << std::string (__indent, ' ' ) << " Parser::rTempArgDeclaration 0.3\n " ;
1274
- #endif
1275
1225
1276
1226
if (lex.LookAhead (0 )==' ,' ||
1277
1227
lex.LookAhead (0 )==' >' )
1278
1228
return true ;
1279
- #if 0
1280
- else if(lex.LookAhead(0) == TOK_SHIFTRIGHT)
1281
- {
1282
- #ifdef DEBUG
1283
- std::cout << std::string(__indent, ' ') << "Parser::rTempArgDeclaration 0.4\n";
1284
- #endif
1285
-
1286
- // turn >> into > >
1287
- cpp_token_buffert::post pos=lex.Save();
1288
- cpp_tokent tk;
1289
- lex.get_token(tk);
1290
- lex.Restore(pos);
1291
- tk.kind='>';
1292
- tk.text='>';
1293
- lex.Replace(tk);
1294
- lex.Insert(tk);
1295
- DATA_INVARIANT(lex.LookAhead(0) == '>', "should be >");
1296
- DATA_INVARIANT(lex.LookAhead(1) == '>', "should be >");
1297
- return true;
1298
- }
1299
- #endif
1300
- #ifdef DEBUG
1301
- std::cout << std::string (__indent, ' ' ) << " Parser::rTempArgDeclaration 0.5\n " ;
1302
- #endif
1303
-
1304
1229
1305
1230
lex.Restore (pos);
1306
1231
}
@@ -4011,8 +3936,7 @@ bool Parser::rTemplateArgs(irept &template_args)
4011
3936
)
4012
3937
{
4013
3938
#ifdef DEBUG
4014
- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4 " <<
4015
- lex.LookAhead (0 ) << " \n " ;
3939
+ std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4\n " ;
4016
3940
#endif
4017
3941
4018
3942
// ok
@@ -4024,30 +3948,20 @@ bool Parser::rTemplateArgs(irept &template_args)
4024
3948
lex.Restore (pos);
4025
3949
exprt tmp;
4026
3950
if (rConditionalExpr (tmp, true ))
4027
- {
4028
- #ifdef DEBUG
4029
- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4.0\n " ;
4030
- #endif
4031
3951
exp.id (ID_ambiguous);
4032
- }
4033
3952
#ifdef DEBUG
4034
3953
std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4.1\n " ;
4035
3954
#endif
4036
3955
lex.Restore (pos);
4037
3956
rTypeNameOrFunctionType (a);
4038
3957
4039
- #ifdef DEBUG
4040
- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4.1a " <<
4041
- lex.LookAhead (0 ) << " \n " ;
4042
- #endif
4043
3958
if (lex.LookAhead (0 )==TOK_ELLIPSIS)
4044
3959
{
4045
3960
lex.get_token (tk1);
4046
3961
exp.set (ID_ellipsis, true );
4047
3962
}
4048
3963
#ifdef DEBUG
4049
- std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4.2 " <<
4050
- lex.LookAhead (0 ) << " \n " ;
3964
+ std::cout << std::string (__indent, ' ' ) << " Parser::rTemplateArgs 4.2\n " ;
4051
3965
#endif
4052
3966
}
4053
3967
else
0 commit comments