@@ -200,33 +200,26 @@ DelimTokenTree::as_string () const
200
200
end_delim = " }" ;
201
201
break ;
202
202
default :
203
- // error
204
- return " " ;
203
+ fprintf (stderr, " Invalid delimiter type, "
204
+ " Should be PARENS, SQUARE, or CURLY." );
205
+ return " Invalid delimiter type" ;
205
206
}
206
207
::std::string str = start_delim;
207
- if (token_trees.empty ())
208
+ if (! token_trees.empty ())
208
209
{
209
- str += " none" ;
210
- }
211
- else
212
- {
213
- auto i = token_trees.begin ();
214
- auto e = token_trees.end ();
215
-
216
- // DEBUG: null pointer check
217
- if (*i == NULL )
210
+ for (const auto &tree : token_trees)
218
211
{
219
- fprintf (stderr,
220
- " something really terrible has gone wrong - null pointer "
221
- " token tree in delim token tree." );
222
- return " NULL_POINTER_MARK" ;
223
- }
212
+ // DEBUG: null pointer check
213
+ if (tree == NULL )
214
+ {
215
+ fprintf (
216
+ stderr,
217
+ " something really terrible has gone wrong - null pointer "
218
+ " token tree in delim token tree." );
219
+ return " NULL_POINTER_MARK" ;
220
+ }
224
221
225
- for (; i != e; i++)
226
- {
227
- str += (*i)->as_string ();
228
- if (e != i + 1 )
229
- str += " , " ;
222
+ str += tree->as_string ();
230
223
}
231
224
}
232
225
str += end_delim;
@@ -1529,7 +1522,8 @@ MacroRulesDefinition::as_string () const
1529
1522
::std::string
1530
1523
MacroInvocation::as_string () const
1531
1524
{
1532
- return path.as_string () + " !" + token_tree.as_string ();
1525
+ return " MacroInvocation: " + path.as_string () + " !"
1526
+ + token_tree.as_string ();
1533
1527
}
1534
1528
1535
1529
::std::string
0 commit comments