On Sun, Oct 1, 2017 at 1:29 AM, Vincent BLONDEAU
<vincent.blondeau(a)polytech-lille.net> wrote:
I think that is dangerous. You will not have the same
results if you change the platform (Windows or Mac). I think you should always consider
that a line return is one char long even if it is a CRLF.
Hi,
You will have the same result because the sourceText method will
return the same result independently of the plateform.
What change depending on the plateform is the default line return
character when you *write* a file. Here we only read source file
without modifying them. (Or else you are doing more than just
analysis)
If you have a project that was written on Windows and analyzed on
linux, you will get CRLF in the source code, and it will be two
characters long even on linux.
Counting one char even for CRLF make it impossible to build robust
tools in top of Moose because we will always have shifts in the source
code if we try to highlight some things. We already got bitten by that
at Synectique multiple times.
Vincent
--
Cyril Ferlicot
https://ferlicot.fr
http://www.synectique.eu
2 rue Jacques Prévert 01,
59650 Villeneuve d'ascq France