[SAOC 2024] - Leverage dmd as a library in D-Scanner in order to extend its functionality - Weekly Update 7

Vladiwostok riciuvlad at gmail.com
Sun Nov 3 23:31:57 UTC 2024


Greetings,

I've spent this week doing debugging on my Windows machine.

Delimited strings do add a single `\r\n` sequence for line 
endings on Windows machines. However, when code is written in a 
file (used for testing in D-Scanner) with `std.file.write`, an 
additional '\r' char is prepended to the sequence, resulting in 
`\r\r\n`.

There's no bugs in the compiler; when the lexer encounters a '\r' 
char, it peeks to the next one to see if it's a standalone 
carriage return, or if its a CRLF sequence. Both cases lead to 
incrementing the line counts, causing the tokens to have 
different locations compared to what would be expected in the 
autofix test code.

I've made a fix in D-Scanner that sanitizes the code read from a 
file, before passing it to the lexer: 
https://github.com/Dlang-UPB/D-scanner/pull/151/commits/6c256a9f7835dd510868d4556b4326263528987c


More information about the Digitalmars-d mailing list