sloganking / scfmt

A code formatter for structured comments
MIT License
0 stars 0 forks source link

handle multi-line strings and comments #1

Open sloganking opened 2 years ago

sloganking commented 2 years ago
let test = 
"
//>
    Hello World!
//<
"

The //> and //< in the above multi-line string will currently be treated as structured comments. This should not happen.

sloganking commented 2 years ago

To find all comments in code, using a scanner

sloganking commented 2 years ago

It appears syntect could be (ab)used to support this. It divides lines into tokens based on their syntax. These tokens are formed in a way that can distinguish between what's a string and what's an actual comment. However it's not ideal.

sloganking commented 2 years ago

This is preventing the creation of tests. Though I guess I could create tests of runs on a language that didn't have // comment starters like rust.

sloganking commented 2 years ago

This issue also causes multi-line comments to have the same problem.

sloganking commented 2 years ago

This is preventing the creation of tests. Though I guess I could create tests of runs on a language that didn't have // comment starters like rust.

Affected tests are being done from loading strings to tests from files