[erlang-questions] Erlang AST with locations

Robert Virding <>
Wed Oct 10 21:29:44 CEST 2007

On 05/10/2007, Joel Reymont <> wrote:
> The result of erl_scan:string/1 has line numbers in it but these get
> lost once erl_parse:parse/1 runs.
> I would like to have an AST with locations, is there a way to
> accomplish that?

Sorry I don't really understand what you mean. If you do

28> {ok,Ts,_}=erl_scan:string("abc([a])->\n1.").
29> erl_parse:parse(Ts).


you that you do have the line numbers in the AST. If you use parse_term,
however, line numbers are removed as it is the term which returned not the

On a related note, I think it's a bummer that there's no
> erl_scan:binary/1.

True, true. One of these years ...

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20071010/70707a6b/attachment.html>

More information about the erlang-questions mailing list