From: Andreas L. <ale...@ra...> - 2007-05-24 09:01:27
|
Hi all: I have been generating a lot of code over the years. Printing indentation was always a messy issue. It involved lots of unreadable '% T's. I very much liked Eric's approach in gec where you have a tripple of rouintes (one for increasing indentation, one for decreasing and one for printing the current level). I have generalized this approach now for Erl-G into an output filter. It is a class that you put in front of your actual text output stream. This class _is_ an outputstream with the two additional public commands of `indent' and `detent' (better names welcome!) and transparently prints indentation for every line to a given target output stream. I have attached the class as it might be useful to others. Eric if you like it please feel free to include it in Gobo. Andreas |