@@ -200,33 +200,26 @@ DelimTokenTree::as_string () const
200200 end_delim = " }" ;
201201 break ;
202202 default :
203- // error
204- return " " ;
203+ fprintf (stderr, " Invalid delimiter type, "
204+ " Should be PARENS, SQUARE, or CURLY." );
205+ return " Invalid delimiter type" ;
205206 }
206207 ::std::string str = start_delim;
207- if (token_trees.empty ())
208+ if (! token_trees.empty ())
208209 {
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)
218211 {
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+ }
224221
225- for (; i != e; i++)
226- {
227- str += (*i)->as_string ();
228- if (e != i + 1 )
229- str += " , " ;
222+ str += tree->as_string ();
230223 }
231224 }
232225 str += end_delim;
@@ -1529,7 +1522,8 @@ MacroRulesDefinition::as_string () const
15291522::std::string
15301523MacroInvocation::as_string () const
15311524{
1532- return path.as_string () + " !" + token_tree.as_string ();
1525+ return " MacroInvocation: " + path.as_string () + " !"
1526+ + token_tree.as_string ();
15331527}
15341528
15351529::std::string
0 commit comments