Yes, binary:split preserves empty lines.  It gave the same results as your code in all OTP files.

Sent from my iPad

On Jan 14, 2013, at 8:52 PM, Syed Mushtaq Ahmed <notifications@github.com> wrote:

> In src/erlcscope.erl:
> 
> >  	{ok, FileData} = file:read_file(SrcFile),
> > -	io:format("processing ~p~n",[SrcFile]),
> > -	Lines = split_data_to_lines(binary_to_list(FileData)),
> > -	State = #state{db=Db,data=Lines},
> > -	write_symbol_to_db(?FILE_MARK, SrcFile, 0, State),
> > +	%io:format("processing ~p~n",[SrcFile]),
> > +	FileData1 = re:replace(FileData, "[\r \t]+", " ", [global, {return, binary}]),
> > +	Lines = binary:split(FileData1, <<"\n">>, [global]),
> When splitting the source file data, Does this split also take care of empty lines ? because I use erl_syntax:get_pos() to get the line number of the symbol and then lookup the line in state.
> 
> —
> Reply to this email directly or view it on GitHub.
>