tree-sitter-swift icon indicating copy to clipboard operation
tree-sitter-swift copied to clipboard

Parse `package` visibility modifier.

Open patrickt opened this issue 5 months ago • 5 comments

No highlighting changes needed for this to look nice: image

patrickt avatar Mar 14 '24 16:03 patrickt

Looks like this causes a parse failure on line 39 of: https://github.com/daltoniam/Starscream/blob/master/Package.swift#L39

we might need to special-case this as an allowed identifier, like we do with async, so that tree-sitter doesn’t choose the keyword over the identifier too early.

alex-pinkus avatar Mar 14 '24 17:03 alex-pinkus

You should be able to run top-repos locally btw — in this case ./scripts/top-repos.sh 36 will test exactly the failing repository

A corpus test for this case would be greatly appreciated too!

alex-pinkus avatar Mar 14 '24 19:03 alex-pinkus

Ah, well now ./scripts/top-repos.sh 25

alex-pinkus avatar Mar 14 '24 19:03 alex-pinkus

Maybe try adding it to the simple_identifier declaration itself here? Then it would cover the enum case we see from Moya. Sorry for pointing you in the wrong direction, I thought that was where I special cased async too...

alex-pinkus avatar Mar 14 '24 19:03 alex-pinkus

I added a _contextual_simple_identifier rule in #385 that should be the right place to put these going forward.

alex-pinkus avatar Mar 15 '24 03:03 alex-pinkus

This was super close to being done so I finished it up in #407.

alex-pinkus avatar Apr 22 '24 02:04 alex-pinkus