Home Download Buy Blog Forum Support

[BUG][FIX] Valid C syntax marked as invalid.illegal

[BUG][FIX] Valid C syntax marked as invalid.illegal

Postby jix on Sat May 25, 2013 3:46 pm

The current ST3 build (3035) has incorrect syntax highlighting for this perfectly valid C code:
Code: Select all

int main
(int /*argc*/, char */*argv*/[])
 


It sees a */ without being in a comment and triggers invalid.illegal.stray-comment-end.c which has the match
Code: Select all
\*/.*\n


The solution is to exclude the case where the / is part of a block comment start, changing the whole pattern to:
Code: Select all
<dict>
    <key>match</key>
    <string>\*/([^*].*)?\n</string>
    <key>name</key>
    <string>invalid.illegal.stray-comment-end.c</string>
</dict>


Actual use case: When working with -Wall it is not uncommon to use block comments around the names of knowingly unused parameters to silence the warning to actually notice when a parameter was left unused by accident (shadowing etc...).
jix
 
Posts: 2
Joined: Sat May 25, 2013 3:29 pm

Return to Technical Support

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot], Yahoo [Bot] and 11 guests