Syntax tools

Richard Carlsson richardc@REDACTED
Fri Aug 12 12:01:14 CEST 2005


Vlad Dumitrescu XX (LN/EAB) wrote:
>  
> I would like to use syntax_tools to prettyprint source code, but with a 
> slightly modified layout - for example, I'd like to have a newline after 
> function clause arrows.

I made the layout so that it tries to be as compact as possible,
so it will not break lines if there is enough room horizontally. Of
course, this might not suit everyone, but it suited me at the time.

> At first I thought this would be done with prettyprinter hooks, but they 
> are only called for annotations.

Yes. In hindsight, maybe I should have added more hooks after all.
Perhaps I can still change it and remain backwards compatible.

> My question is: is there a way to customize the behaviour like this in a 
> friendly way, or do I have to take the axe and hack away?

If you add annotations to the nodes you want to handle, as a prepass,
you should be able to trigger the hooks and do the formatting your way.

> On a related issue: erl_syntax_lib:strip_comments/1 doesn't strip 
> top-level comments...

Thanks, I'll look at it.

	/Richard



More information about the erlang-questions mailing list