[erlang-questions] Syntax highlight erlang code with erlang

Petter Larsson XA (TN/EAB) <>
Wed May 23 13:41:54 CEST 2007


> Petter Larsson XA (TN/EAB) wrote:
> > I would actually prefer doing it in erlang code, soo I can create 
> > links fo other filer etc. when possible.
> > 
> > Doesn't anyone have an example code of highligting erlang code with 
> > erl_syntax etc.
> 
> I don't have any example code at hand, but you can do it 
> fairly easily, the following way:
> 
>    1. Traverse the syntax tree (use erl_syntax:subtrees/1) and add
>       annotations (erl_syntax:add_ann/2) on nodes of interest.

How do I get this syntax tree in the first place, if I use
epp_dogder:parse_file all comments in the file is lost. What is the
correct function to create a full syntax tree from a source code?

/Petter




More information about the erlang-questions mailing list