erl_scan counts white space badly

Ulf Wiger ulf.wiger@REDACTED
Wed Jan 13 00:04:24 CET 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I tried the column tracking functionality of erl_scan:

8> {ok,Fd} = file:open("parse_trans.erl",[read]).
{ok,<0.48.0>}
9> {ok,Epp} = epp:open(parse_trans,Fd,{1,1},["."],[]).
{ok,<0.50.0>}
10> epp:parse_erl_form(Epp).
{ok,{attribute,{1,1},file,{"parse_trans",{1,1}}}}
...
18> epp:parse_erl_form(Epp).
{ok,{attribute,{78,2},
               record,
               {context,[{record_field,{78,19},{atom,{78,19},module}},
                         {record_field,{79,5},{atom,{79,5},function}},
                         {record_field,{80,5},{atom,{80,5},arity}},
                         {record_field,{81,19},{atom,{81,19},file}},
                         {record_field,{82,19},{atom,{82,19},options}}]}}}


The original source code wasn't misaligned, but the indentation
used a mix of tabs and spaces. erl_scan treats all kinds of
white space as one space.

I think it would be reasonable to at the very least increment by
8 if it's a tab. Supporting a tab length option might also be
possible, but then it would also be nice to have e.g. epp support
passing of this option to the scanner.

Apologies for not just making my own patch and committing, but
I was just playing with this out of curiosity.

BR,
Ulf W
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAktM//gACgkQtqqFieqzed0z8ACgmrRZHiHMh98aK04JbYFcQuT+
6AgAnjeee8wG0wUJTTEHA2hhCdQ6GsAP
=Dhk8
-----END PGP SIGNATURE-----
---------------------------------------------------

---------------------------------------------------

WE'VE CHANGED NAMES!

Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD.

www.erlang-solutions.com



More information about the erlang-bugs mailing list